diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 52% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md index ed17a41e67..33ae67cc0e 100644 --- a/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,7 +2,7 @@ ## Before reporting -If you have found an issue with ACE3 please make sure that ACE3 is really the cause of the problem. To do this try to reproduce the issue with using only `@CBA_A3` and `@ace` on a newly created mission. +If you have found an issue with ACE3 please make sure that ACE3 really is the cause of the problem. To do this try to reproduce the issue with using only `@CBA_A3` and `@ace` on a newly created mission. Indicate if the issue appears on stable or development version. In case it is the development version, please also include the commit SHA-1 hash. @@ -14,38 +14,10 @@ Indicate if the issue appears on stable or development version. In case it is th ## Reporting the issue -Head over to the [ACE3 GitHub issue tracker](https://github.com/acemod/ACE3/issues) and press the [New issue](https://github.com/acemod/ACE3/issues/new) button in the top right corner. Add a descriptive title and copy the following issue template in to the text area: - -``` -ACE3 Version: 3.x.x -(indicate if stable or dev, if dev indicate the commit the version is based on) - -**Mods:** -* `@CBA_A3` -* `@ace` - -**Placed ACE3 Modules:** -* *Add the list of modules you have placed on the map. Use 'None' if the error occurs without using any modules.* -* You can also press the `Debug to` button in the ACE3 option menu (escape -> ACE3 options -> Debug to) and add a link (pastebin.com) to the results. - -**Description:** -* Add a detailed description of the error. This makes it easier for us to fix the issue.* - -**Steps to reproduce:** -* *Add the steps needed to reproduce the issue.* - -**Where did the issue occur?** -* A possible answer might be "Multiplayer", "Editor" or "Singleplayer"* - -**RPT log file:** -* Add a link (pastebin.com) to the client or server RPT file.* -``` +Head over to the [ACE3 GitHub issue tracker](https://github.com/acemod/ACE3/issues) and press the [New issue](https://github.com/acemod/ACE3/issues/new) button in the top right corner. Add a descriptive title and complete the issue template. A video of the issue might be helpful in resolving it faster. -GitHub uses [Markdown](http://daringfireball.net/projects/markdown/syntax) to style the output. If you want to know more about it (e.g. how to [turn text bold](https://help.github.com/articles/markdown-basics/#styling-text), how to denote [code blocks](https://help.github.com/articles/markdown-basics/#inline-formats) or [inline code](https://help.github.com/articles/markdown-basics/#multiple-lines)) have a look at the [GitHub Markdown Documentation](https://help.github.com/articles/github-flavored-markdown). - - # Feature Requests ## Background @@ -57,8 +29,3 @@ Please refrain from making requests for any planned or existing features from ei In order to avoid duplicates and keep the issue tracker organized, we have created a common issue for [ACE3 Feature requests](https://github.com/acemod/ACE3/issues/414). Any and all relevant requests should be submitted there, where they will also get discussed and evaluated. Before adding a new one, make sure to check the previous entries from the thread and do a quick search for similar suggestions; please don't reiterate requests for features that had already been accepted for inclusion, or those which were disregarded earlier. Following their approval, feature requests may be moved by moderators to a separate issue for further discussion. - -# Regarding Pull Requests (PRs) -- You want to help but don't know where to start? Check the wiki entry for [setting up the development environment](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) -- [Make sure to respect the file structure](http://ace3mod.com/wiki/development/modularity-and-pbo-structure.html) -- [Make sure to respect the coding guidelines](http://ace3mod.com/wiki/development/coding-guidelines.html) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..92ba3070ce --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,25 @@ +**Arma 3 Version:** `x.xx` +*(indicate if stable, rc or dev*) + +**ACE3 Version:** `3.x.x` +*(indicate if stable or dev, if dev indicate the commit the version is based on)* + +**Mods:** +* `@CBA_A3` +* `@ace` +* ... + +**Placed 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 "Dedicated Server", "Local Multiplayer", "Editor", or "Singleplayer"* + +**RPT log file:** +* *Add a link (pastebin.com) to the client and/or server RPT file. An instruction to find your RPT files can be [found here](https://community.bistudio.com/wiki/Crash_Files#Arma_3)* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..982d6137ef --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,10 @@ +### When merged this pull request will: + +1. *Describe what this pull request will do* +2. *Each change in a seperate line* + +--- +*Delete this line and everything below* + +- [Make sure to respect the file structure](http://ace3mod.com/wiki/development/modularity-and-pbo-structure.html) +- [Make sure to respect the coding guidelines](http://ace3mod.com/wiki/development/coding-guidelines.html) diff --git a/AUTHORS.txt b/AUTHORS.txt index 5eee93a7f6..7de58d43f0 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -14,7 +14,8 @@ Garth "L-H" de Wet Giallustio Glowbal Janus -jokoho482 ` +jokoho482 +Jonpas Kieran NouberNou PabstMirror @@ -39,6 +40,7 @@ Alganthe Anthariel Arkhir Asgar Serran +BaerMitUmlaut Bamse Bla1337 BlackPixxel @@ -53,6 +55,7 @@ Coren Crusty Dharma Bellamkonda Dimaslg +dixon13 Drill Dudakov aka [OMCB]Kaban Dslyecxi @@ -63,11 +66,13 @@ Falke75 Ferenczi Ferenzi Filip Basara +fr89k FreeZbe geraldbolso1899 Ghost Gianmarco Varriale (TeamNuke) GieNkoV +GitHawk gpgpgpgp Grzegorz Hamburger SV @@ -75,7 +80,6 @@ Harakhti havena Hawkins Head -Jonpas Karneck Kavinsky Kllrt @@ -103,6 +107,7 @@ Robert Boklahánics ruPaladin simon84 Sniperwolf572 +System98 SzwedzikPL Tachi Toaster @@ -113,3 +118,4 @@ voiper VyMajoris(W-Cephei) Winter zGuba +Grey-Soldierman diff --git a/README.md b/README.md index f313999923..cda0cc7f79 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@

- +

- ACE3 Version + ACE3 Version - + ACE3 Download @@ -64,7 +64,6 @@ The mod is **built modularly**, so almost any included PBO can be easily removed - 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 diff --git a/ace_advanced_ballistics.dll b/ace_advanced_ballistics.dll index 41e0533991..a35dcbd2da 100644 Binary files a/ace_advanced_ballistics.dll and b/ace_advanced_ballistics.dll differ diff --git a/ace_medical.dll b/ace_medical.dll index c54febf34f..3b5e97ca19 100644 Binary files a/ace_medical.dll and b/ace_medical.dll differ diff --git a/addons/advanced_ballistics/CfgEventHandlers.hpp b/addons/advanced_ballistics/CfgEventHandlers.hpp index cc1414eb8f..5da5fd0dc2 100644 --- a/addons/advanced_ballistics/CfgEventHandlers.hpp +++ b/addons/advanced_ballistics/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); @@ -9,11 +16,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - firedBIS = QUOTE(_this call FUNC(handleFired)); - }; - }; -}; \ No newline at end of file diff --git a/addons/advanced_ballistics/XEH_PREP.hpp b/addons/advanced_ballistics/XEH_PREP.hpp new file mode 100644 index 0000000000..df2501467f --- /dev/null +++ b/addons/advanced_ballistics/XEH_PREP.hpp @@ -0,0 +1,14 @@ + +PREP(calculateAmmoTemperatureVelocityShift); +PREP(calculateAtmosphericCorrection); +PREP(calculateBarrelLengthVelocityShift); +PREP(calculateRetardation); +PREP(calculateStabilityFactor); +PREP(diagnoseWeapons); +PREP(displayProtractor); +PREP(handleFired); +PREP(initializeTerrainExtension); +PREP(initModuleSettings); +PREP(readAmmoDataFromConfig); +PREP(readWeaponDataFromConfig); +PREP(handleFirePFH); diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf index 1f9002e606..a541d30ce8 100644 --- a/addons/advanced_ballistics/XEH_postInit.sqf +++ b/addons/advanced_ballistics/XEH_postInit.sqf @@ -22,3 +22,19 @@ if (!GVAR(extensionAvailable)) exitWith { }; */ [] call FUNC(initializeTerrainExtension); + +if (!hasInterface) exitWith {}; + +["SettingsInitialized", { + //If not enabled, dont't add PFEH + if (!GVAR(enabled)) exitWith {}; + + // Register fire event handler + ["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + +}] call EFUNC(common,addEventHandler); + +#ifdef DEBUG_MODE_FULL + call FUNC(diagnoseWeapons); +#endif \ No newline at end of file diff --git a/addons/advanced_ballistics/XEH_preInit.sqf b/addons/advanced_ballistics/XEH_preInit.sqf index f722d9c573..a7feade1c3 100644 --- a/addons/advanced_ballistics/XEH_preInit.sqf +++ b/addons/advanced_ballistics/XEH_preInit.sqf @@ -2,16 +2,6 @@ ADDON = false; -PREP(calculateAmmoTemperatureVelocityShift); -PREP(calculateAtmosphericCorrection); -PREP(calculateBarrelLengthVelocityShift); -PREP(calculateRetardation); -PREP(calculateStabilityFactor); -PREP(displayProtractor); -PREP(handleFired); -PREP(initializeTerrainExtension); -PREP(initModuleSettings); -PREP(readAmmoDataFromConfig); -PREP(readWeaponDataFromConfig); -PREP(handleFirePFH); +#include "XEH_PREP.hpp" + ADDON = true; diff --git a/addons/advanced_ballistics/XEH_preStart.sqf b/addons/advanced_ballistics/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/advanced_ballistics/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf index 9c46cc2423..1f8a7e6eb9 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf @@ -22,6 +22,7 @@ private ["_muzzleVelocityTableCount", "_barrelLengthTableCount", "_lowerDataInde "_upperDataIndex", "_lowerBarrelLength", "_upperBarrelLength", "_lowerMuzzleVelocity", "_upperMuzzleVelocity", "_interpolationRatio"]; params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"]; +TRACE_4("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 }; diff --git a/addons/advanced_ballistics/functions/fnc_diagnoseWeapons.sqf b/addons/advanced_ballistics/functions/fnc_diagnoseWeapons.sqf new file mode 100644 index 0000000000..4d344e8bfe --- /dev/null +++ b/addons/advanced_ballistics/functions/fnc_diagnoseWeapons.sqf @@ -0,0 +1,59 @@ +/* + * Author: esteldunedain + * + * This function diagnoses all primary weapons to find cases in which the initial + * velocity of shots with and without AB significantly mismatch + * + * Arguments: + * None. Parameters inherited from EFUNC(common,firedEH) + * + * Return Value: + * None + * + * Public: No + */ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +private _cfgWeapons = configFile >> "CfgWeapons"; +for "_i" from 0 to (count _cfgWeapons)-1 do { + private _weaponConfig = _cfgWeapons select _i; + if (isClass _weaponConfig) then { + private _weapon = configName _weaponConfig; + private _weaponType = getNumber (_weaponConfig >> "Type"); + if (_weaponType == 1) then { + // The weapon is a primary weapon + + private _weaponInitSpeed = getNumber (_weaponConfig >> "initSpeed"); + private _magazines = getArray (_weaponConfig >> "magazines"); + { + private _magazine = _x; + private _magazineInitSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); + private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); + + // Vanilla initial speed -------------------------- + private _vanillaInitialSpeed = _magazineInitSpeed; + if (_weaponInitSpeed > 0) then { + _vanillaInitialSpeed = _weaponInitSpeed; + } else { + if (_weaponInitSpeed < 0) then { + _vanillaInitialSpeed = _vanillaInitialSpeed * (-_weaponInitSpeed); + }; + }; + // -------------------------------------------------- + + // AB initial speed -------------------------------- + // Get Weapon and Ammo Configurations + private _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig); + private _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig); + _AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable"]; + _WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"]; + + private _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _vanillaInitialSpeed] call FUNC(calculateBarrelLengthVelocityShift); + private _abInitialSpeed = _vanillaInitialSpeed + _barrelVelocityShift; + // -------------------------------------------------- + diag_log text format ["ABDiagnose,%1,%2,%3,%4,%5,%6,%7",_weapon,_magazine,_ammo,_magazineInitSpeed,_weaponInitSpeed,_vanillaInitialSpeed,_abInitialSpeed]; + } forEach _magazines; + }; + }; +}; diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf index 1f7e2ecde7..5ad6cb111e 100644 --- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf +++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf @@ -28,7 +28,7 @@ if (currentWeapon ACE_player != primaryWeapon ACE_player) exitWith { false }; 2 cutText ["", "PLAIN"]; EGVAR(weather,WindInfo) = false; -0 cutText ["", "PLAIN"]; +(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; GVAR(Protractor) = true; [{ diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 90eacf2928..9646f065d4 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -1,16 +1,10 @@ /* * Author: Glowbal, Ruthberg * - * Handles advanced ballistics for (BulletBase) projectiles + * Handles advanced ballistics for (BulletBase) projectiles. Called from the unified fired EH only for players. * * Arguments: - * 0: unit - Object the event handler is assigned to - * 1: weapon - Fired weapon - * 2: muzzle - Muzzle that was used - * 3: mode - Current mode of the fired weapon - * 4: ammo - Ammo used - * 5: magazine - magazine name which was used - * 6: projectile - Object of the projectile that was shot + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -19,20 +13,16 @@ */ #include "script_component.hpp" -// Early Quiting -if (!hasInterface) exitWith {}; -if (!GVAR(enabled)) exitWith {}; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // Parameterization private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletLength", "_barrelTwist", "_stabilityFactor", "_aceTimeSecond", "_barrelVelocityShift", "_ammoTemperatureVelocityShift"]; -params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"]; - _abort = false; if (!(_ammo isKindOf "BulletBase")) exitWith {}; -if (!alive _bullet) exitWith {}; -if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; +if (!alive _projectile) exitWith {}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {}; if (underwater _unit) exitWith {}; if (!GVAR(simulateForEveryone) && !(local _unit)) then { @@ -54,7 +44,7 @@ if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _wea if (_abort || !(GVAR(extensionAvailable))) exitWith { if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then { - EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; + EGVAR(windDeflection,trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; }; }; @@ -72,7 +62,7 @@ _AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMas _WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"]; -_bulletVelocity = velocity _bullet; +_bulletVelocity = velocity _projectile; _muzzleVelocity = vectorMagnitude _bulletVelocity; _barrelVelocityShift = 0; @@ -92,7 +82,7 @@ if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then { if (_muzzleVelocityShift != 0) then { _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); - _bullet setVelocity _bulletVelocity; + _projectile setVelocity _bulletVelocity; }; }; @@ -114,16 +104,16 @@ if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) th if (isNil "_temperature") then { _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); }; - _barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure); + _barometricPressure = ((getPosASL _projectile) select 2) call EFUNC(weather,calculateBarometricPressure); _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); }; GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; _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]; +"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 _projectile, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond]; -GVAR(allBullets) pushBack [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]; +GVAR(allBullets) pushBack [_projectile, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]; if (isNil QGVAR(BulletPFH)) then { GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf index 9839c1dcc3..646096683a 100644 --- a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf @@ -24,6 +24,7 @@ */ #include "script_component.hpp" +TRACE_1("Reading Ammo Config",_this); private ["_ammo", "_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_result"]; _ammoConfig = configFile >> "CfgAmmo" >> _this; @@ -49,6 +50,42 @@ _ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVeloc _muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities"); _barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths"); +//Handle subsonic ammo that would have a huge muzzle velocity shift (when ballistic configs not explicitly defined) +private _typicalSpeed = getNumber (_ammoConfig >> "typicalSpeed"); +if ((_typicalSpeed > 0) && {_typicalSpeed < 360}) then { + private _inheritedBarrelConfig = (!(_muzzleVelocityTable isEqualTo [])) && {(configProperties [_ammoConfig, "(configName _x) == 'ACE_muzzleVelocities'", false]) isEqualTo []}; + private _inheritedTempConfig = (!(_ammoTempMuzzleVelocityShifts isEqualTo [])) && {(configProperties [_ammoConfig, "(configName _x) == 'ACE_ammoTempMuzzleVelocityShifts'", false]) isEqualTo []}; + TRACE_3("subsonic",_typicalSpeed,_inheritedBarrelConfig,_inheritedTempConfig); + if (_inheritedBarrelConfig || _inheritedTempConfig) then { + private _parentConfig = inheritsFrom _ammoConfig; + private _parentSpeed = getNumber (_parentConfig >> "typicalSpeed"); + ACE_LOGWARNING_4("Subsonic Ammo %1 (%2 m/s) missing `ACE_muzzleVelocities` or `ACE_ammoTempMuzzleVelocityShifts` configs, attempting to use parent %3 (%4m/s)",_this,_typicalSpeed,configName _parentConfig, _parentSpeed); + if (_parentSpeed <= 0) exitWith {//Handle weird or null parent + _muzzleVelocityTable = []; + _ammoTempMuzzleVelocityShifts = []; + }; + private _linearMuliplier = _typicalSpeed / _parentSpeed; + if (_inheritedBarrelConfig) then { + if (!((configProperties [_parentConfig, "(configName _x) == 'ACE_muzzleVelocities'", false]) isEqualTo [])) then { + TRACE_2("Parent Has Defined Barrel MV",_linearMuliplier,_muzzleVelocityTable); + { _muzzleVelocityTable set [_forEachIndex, (_x * _linearMuliplier)]; } forEach _muzzleVelocityTable; + } else { + TRACE_2("Parent DOES NOT Have Defined Barrel MV",_linearMuliplier,_muzzleVelocityTable); + _muzzleVelocityTable = []; + }; + }; + if (_inheritedTempConfig) then { + if (!((configProperties [_parentConfig, "(configName _x) == 'ACE_ammoTempMuzzleVelocityShifts'", false]) isEqualTo [])) then { + TRACE_2("Parent Has Defined Ammo Temp Shifts",_linearMuliplier,_muzzleVelocityTable); + { _ammoTempMuzzleVelocityShifts set [_forEachIndex, (_x * _linearMuliplier)]; } forEach _ammoTempMuzzleVelocityShifts; + } else { + TRACE_2("Parent DOES NOT Have Defined Ammo Temp Shifts",_linearMuliplier,_muzzleVelocityTable); + _ammoTempMuzzleVelocityShifts = []; + }; + }; + }; +}; + _result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable]; uiNamespace setVariable [format[QGVAR(%1), _this], _result]; diff --git a/addons/advanced_ballistics/script_component.hpp b/addons/advanced_ballistics/script_component.hpp index 757330a5d0..47af939863 100644 --- a/addons/advanced_ballistics/script_component.hpp +++ b/addons/advanced_ballistics/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT advanced_ballistics #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_ADVANCEDBALLISTICS #define DEBUG_MODE_FULL #endif diff --git a/addons/advanced_ballistics/stringtable.xml b/addons/advanced_ballistics/stringtable.xml index 5ea26cd906..c3d23ae522 100644 --- a/addons/advanced_ballistics/stringtable.xml +++ b/addons/advanced_ballistics/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -10,7 +10,7 @@ Mostrar información del viento Windinformationen anzeigen Széladatok mutatása - Zobrazit informace o větru + Zobrazit údaje o větru Mostrar Informação do Vento @@ -35,6 +35,7 @@ Balistique avancée Fejlett ballisztika Продвинутая баллистика + Balistica Avanzata Advanced Ballistics @@ -46,6 +47,7 @@ Balistique avancée Fejlett ballisztika Продвинутая баллистика + Balistica Avanzata Enables advanced ballistics @@ -57,6 +59,7 @@ Activer la balistique avancée Engedélyezi a fejlett ballisztikát Включает продвинутую баллистику + Abilita Balistica Avanzata Enabled For Snipers @@ -68,17 +71,19 @@ Activer pour les snipers Mesterlövészeknek engedélyezve Включена для снайперов + Abilita per Tiratori Scelti Enables advanced ballistics for non local snipers (when using high power optics) Activa la balística avanzada para francotiradores no locales (cuando se usa una mira telescópica) Aktywuje zaawansowaną balistykę dla nielokalnych snajperów (kiedy używają optyki) 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) + Aktivuje pokročilou balistiku pro nelokální odstřelovače (při použití optiky) 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) Включает продвинутую баллистику для нелокальных снайперов (при использовании мощной оптики) + Abilita Balistica Avanzata per Tiratori Scelti non locali (con ottiche ad alto potenziale) Enabled For Group Members @@ -90,6 +95,7 @@ Activer pour les membres groupés Csoporttagoknak engedélyezve Включена для группы + Abilita per Membri del Gruppo Enables advanced ballistics for non local group members @@ -101,6 +107,7 @@ Active la balistique avancée pour les membres groupés non locaux Engedélyezi a fejlett ballisztikát nem-helyi csoporttagoknak Включает продвинутую баллистику для нелокальных членов группы + Abilita Balistica Avanzata per Membri non locali del Gruppo Enabled For Everyone @@ -112,17 +119,19 @@ Activer pour tout le monde Mindenkinek engedélyezve Включена для всех + Abilita per tutti Enables advanced ballistics for all non local players (enabling this may degrade performance during heavy firefights in multiplayer) Activada la balística avanzada para todos los jugadores no locales (activarlo puede degradar el rendimiento durante grandes tiroteos en multijugador). Aktywuje zaawansowaną balistykę dla wszystkich nielokalnych graczy (aktywacja tej opcji może spodowować spory spadek wydajności podczas ciężkiej wymiany ognia) 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) + Aktivuje pokročilou balistiku pro všechny nelokální hráče (aktivace této možnosti způsobuje pokles FPS během velké 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) Включает продвинутую баллистику для всех нелокальных игроков (включение этой опции может снизить производительность при массовых перестрелках в мультиплеере) + Abilita Balistica Avanzata per tutti i giocatori non locali (abilitare questo parametro potrebbe degradare le prestazioni durante scontri intensi in multiplayer) Always Enabled For Group Members @@ -134,6 +143,7 @@ Toujours activer pour les membres groupés Mindig engedélyezve csoporttagoknak Всегда включена для членов группы + Sempre abilitato per Membri del Gruppo Always enables advanced ballistics when a group member fires @@ -145,6 +155,7 @@ 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 Всегда включает продвинутую баллистику когда стреляет член группы + Abilita sempre Balistica Avanzata quando un Membro del Gruppo spara Disabled In FullAuto Mode @@ -156,6 +167,7 @@ Désactiver en mode rafale libre Automata módban letiltva Выкл. для автомат. режима + Disabilita in modalità di fuoco automatico Disables the advanced ballistics during full auto fire @@ -167,6 +179,7 @@ Désactive la balistique avancée pour les tirs en rafale libre Letiltja a fejlett ballisztikát automata tüzelés folyamán Выключает продвинутую баллистику при стрельбе в полностью автоматическом режиме + Disabilita Balistica Avanzata durante fuoco automatico Enable Ammo Temperature Simulation @@ -178,6 +191,7 @@ Activer la simulation de la température Lőszer-hő szimuláció engedélyezése Симуляция температуры для боеприпасов + Abilita simulazione della temperatura delle munizioni Muzzle velocity varies with ammo temperature @@ -189,6 +203,7 @@ 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ó Начальная скорость пули зависит от температуры + Velocità alla volata varia con la temperatura delle munizioni Enable Barrel Length Simulation @@ -200,6 +215,7 @@ Activer la simulation de la longueur de canon Csőhossz-szimuláció engedélyezése Симуляция длины ствола + Abilita simulazione della lunghezza della canna Muzzle velocity varies with barrel length @@ -211,6 +227,7 @@ La longueur du canon influe sur la vélocité initale A kezdősebesség a cső hosszától függően változó Начальная скорость пули зависит от длины ствола + Velocità alla volata varia con la lunghezza della canna Enable Bullet Trace Effect @@ -222,6 +239,7 @@ Activer l'effet traçante Nyomkövető-effekt engedélyezése Следы пуль + Abilita effetto di tracciatura dei proiettili Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics) @@ -233,6 +251,7 @@ 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ó) Включает эффект следов пуль для больших калибров (видны только через мощную оптику) + Abilita effetto di tracciatura per proiettili di alto calibro (visibile solo attraverso ottiche ad alto potenziale) Simulation Interval @@ -244,6 +263,7 @@ Intervalle de simulation Szimuláció intervalluma Интервал симуляции + Intervallo Simulazione Defines the interval between every calculation step @@ -255,6 +275,7 @@ Défini un intervalle de calcul entre deux simulations Meghatározza a számítási lépések közötti időintervallumot Определяет временной интервал между вычислениями + Definisce l'intervallo tra ogni step di calcolo Simulation Radius @@ -266,6 +287,7 @@ Rayon de simulation Szimuláció hatóköre Радиус симуляции + Raggio Simulazione Defines the radius around the player (in meters) at which advanced ballistics are applied to projectiles @@ -277,9 +299,11 @@ 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 Определяет радиус вокруг игрока (в метрах), в котором продвинутая баллистика применяется к снарядам + Definisce il raggio attorno al giocatore (in metri) per cui la Balistica Avanzata è applicata ai proiettili 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. + Dieses Modul aktiviert die Erweiterte Ballisitk. Die Flugbahn eines Geschosses wird nun von Einflüssen wie z.B Temperatur, Luftdruck, Luftfeuchtigkeit, Schwerkraft, Geschossart sowie der Waffe aus dem es gefeuert wird, beeinflusst. 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. @@ -287,6 +311,7 @@ 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. + Questo modulo abilita la simulazione della Balistica Avanzata - cioè la traiettoria dei proiettili è influenzata da variabili come la temperatura dell'aria, pressione atmosferica, umidità, gravità, il tipo di munizione e l'arma da cui è sparata diff --git a/addons/ai/script_component.hpp b/addons/ai/script_component.hpp index 7add51c06c..0910bf6472 100644 --- a/addons/ai/script_component.hpp +++ b/addons/ai/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT ai #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_AI #define DEBUG_MODE_FULL #endif diff --git a/addons/aircraft/script_component.hpp b/addons/aircraft/script_component.hpp index f6662ce075..baa8e7ee21 100644 --- a/addons/aircraft/script_component.hpp +++ b/addons/aircraft/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT aircraft #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_AIRCRAFT #define DEBUG_MODE_FULL #endif diff --git a/addons/apl/CfgEventHandlers.hpp b/addons/apl/CfgEventHandlers.hpp deleted file mode 100644 index 5bacc02434..0000000000 --- a/addons/apl/CfgEventHandlers.hpp +++ /dev/null @@ -1,7 +0,0 @@ -/* -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); - }; -}; -*/ \ No newline at end of file diff --git a/addons/apl/ace_entrchtool.p3d b/addons/apl/ace_entrchtool.p3d new file mode 100644 index 0000000000..78fbf9e6c9 Binary files /dev/null and b/addons/apl/ace_entrchtool.p3d differ diff --git a/addons/apl/ace_envelope_big.p3d b/addons/apl/ace_envelope_big.p3d new file mode 100644 index 0000000000..3aef6368ca Binary files /dev/null and b/addons/apl/ace_envelope_big.p3d differ diff --git a/addons/apl/ace_envelope_big4.p3d b/addons/apl/ace_envelope_big4.p3d new file mode 100644 index 0000000000..45a23be11b Binary files /dev/null and b/addons/apl/ace_envelope_big4.p3d differ diff --git a/addons/apl/ace_envelope_big4_nogeo.p3d b/addons/apl/ace_envelope_big4_nogeo.p3d new file mode 100644 index 0000000000..66e20e5810 Binary files /dev/null and b/addons/apl/ace_envelope_big4_nogeo.p3d differ diff --git a/addons/apl/ace_envelope_small.p3d b/addons/apl/ace_envelope_small.p3d new file mode 100644 index 0000000000..9bc35d7b4a Binary files /dev/null and b/addons/apl/ace_envelope_small.p3d differ diff --git a/addons/apl/ace_envelope_small4.p3d b/addons/apl/ace_envelope_small4.p3d new file mode 100644 index 0000000000..d139f6bbca Binary files /dev/null and b/addons/apl/ace_envelope_small4.p3d differ diff --git a/addons/apl/ace_envelope_small4_nogeo.p3d b/addons/apl/ace_envelope_small4_nogeo.p3d new file mode 100644 index 0000000000..a39195505c Binary files /dev/null and b/addons/apl/ace_envelope_small4_nogeo.p3d differ diff --git a/addons/apl/config.cpp b/addons/apl/config.cpp index fff902d962..089f4bffe0 100644 --- a/addons/apl/config.cpp +++ b/addons/apl/config.cpp @@ -11,5 +11,3 @@ class CfgPatches { VERSION_CONFIG; }; }; - -#include "CfgEventHandlers.hpp" diff --git a/addons/apl/data/entrchtool.rvmat b/addons/apl/data/entrchtool.rvmat new file mode 100644 index 0000000000..3f7c3f8f9f --- /dev/null +++ b/addons/apl/data/entrchtool.rvmat @@ -0,0 +1,75 @@ +ambient[]={1,1,1,1}; +diffuse[]={2,2,2,0}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.054000214,0.054000214,0.058000047,0}; +specularPower=50.700001; +PixelShaderID="Super"; +VertexShaderID="Super"; +class Stage1 +{ + texture="z\ace\addons\apl\data\entrchtool_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[]={4,0,0}; + up[]={0,6,0}; + dir[]={0,0,2}; + pos[]={0,0,0}; + }; + Filter="Anizotropic"; +}; +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}; + }; + Filter="Anizotropic"; +}; +class Stage4 +{ + texture="z\ace\addons\apl\data\entrchtool_as.paa"; + 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\apl\data\entrchtool_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="a3\data_f\env_co.paa"; + uvSource="none"; +}; diff --git a/addons/apl/data/entrchtool_as.paa b/addons/apl/data/entrchtool_as.paa new file mode 100644 index 0000000000..5facd40186 Binary files /dev/null and b/addons/apl/data/entrchtool_as.paa differ diff --git a/addons/apl/data/entrchtool_co.paa b/addons/apl/data/entrchtool_co.paa new file mode 100644 index 0000000000..ad6dc41e5c Binary files /dev/null and b/addons/apl/data/entrchtool_co.paa differ diff --git a/addons/apl/data/entrchtool_nohq.paa b/addons/apl/data/entrchtool_nohq.paa new file mode 100644 index 0000000000..477e912367 Binary files /dev/null and b/addons/apl/data/entrchtool_nohq.paa differ diff --git a/addons/apl/data/entrchtool_smdi.paa b/addons/apl/data/entrchtool_smdi.paa new file mode 100644 index 0000000000..1011a99ca6 Binary files /dev/null and b/addons/apl/data/entrchtool_smdi.paa differ diff --git a/addons/apl/data/zr_plevel_co.paa b/addons/apl/data/zr_plevel_co.paa new file mode 100644 index 0000000000..723a8ca572 Binary files /dev/null and b/addons/apl/data/zr_plevel_co.paa differ diff --git a/addons/apl/script_component.hpp b/addons/apl/script_component.hpp index ac20a25e21..f2ae3d53f1 100644 --- a/addons/apl/script_component.hpp +++ b/addons/apl/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT APL #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_APL #define DEBUG_MODE_FULL #endif diff --git a/addons/atragmx/CfgEventHandlers.hpp b/addons/atragmx/CfgEventHandlers.hpp index 3996e3371d..1bd535a305 100644 --- a/addons/atragmx/CfgEventHandlers.hpp +++ b/addons/atragmx/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/atragmx/XEH_PREP.hpp b/addons/atragmx/XEH_PREP.hpp new file mode 100644 index 0000000000..20900711c3 --- /dev/null +++ b/addons/atragmx/XEH_PREP.hpp @@ -0,0 +1,67 @@ + +PREP(add_new_gun); +PREP(calculate_range_card); +PREP(calculate_solution); +PREP(calculate_target_range_assist); +PREP(calculate_target_solution); +PREP(calculate_target_speed_assist); +PREP(can_show); +PREP(change_gun); +PREP(change_target_slot); +PREP(clear_user_data); +PREP(create_dialog); +PREP(cycle_gun_list); +PREP(cycle_image_size_units); +PREP(cycle_num_ticks_units); +PREP(cycle_range_card_columns); +PREP(cycle_scope_unit); +PREP(cycle_target_size_units); +PREP(cycle_target_speed_direction); +PREP(delete_gun); +PREP(init); +PREP(parse_input); +PREP(reset_relative_click_memory); +PREP(restore_atmo_default); +PREP(restore_user_data); +PREP(save_gun); +PREP(show_add_new_gun); +PREP(show_atmo_env_data); +PREP(show_gun_ammo_data); +PREP(show_gun_list); +PREP(show_main_page); +PREP(show_range_card); +PREP(show_range_card_setup); +PREP(show_solution_setup); +PREP(show_target_data); +PREP(show_target_range_assist); +PREP(show_target_speed_assist); +PREP(show_target_speed_assist_timer); +PREP(sord); +PREP(store_user_data); +PREP(target_speed_assist_timer); +PREP(toggle_atmo_env_data); +PREP(toggle_gun_ammo_data); +PREP(toggle_gun_list); +PREP(toggle_range_card); +PREP(toggle_range_card_setup); +PREP(toggle_solution_setup); +PREP(toggle_target_data); +PREP(toggle_target_range_assist); +PREP(toggle_target_speed_assist); +PREP(update_atmosphere); +PREP(update_atmo_env_data); +PREP(update_atmo_selection); +PREP(update_gun); +PREP(update_gun_ammo_data); +PREP(update_inclination_angle); +PREP(update_range_card); +PREP(update_relative_click_memory); +PREP(update_result); +PREP(update_scope_unit); +PREP(update_solution_setup); +PREP(update_target); +PREP(update_target_data); +PREP(update_target_selection); +PREP(update_unit_selection); +PREP(update_zero_range); +PREP(on_close_dialog); diff --git a/addons/atragmx/XEH_preInit.sqf b/addons/atragmx/XEH_preInit.sqf index 0277de1c14..a7feade1c3 100644 --- a/addons/atragmx/XEH_preInit.sqf +++ b/addons/atragmx/XEH_preInit.sqf @@ -2,71 +2,6 @@ ADDON = false; -PREP(add_new_gun); -PREP(calculate_range_card); -PREP(calculate_solution); -PREP(calculate_target_range_assist); -PREP(calculate_target_solution); -PREP(calculate_target_speed_assist); -PREP(can_show); -PREP(change_gun); -PREP(change_target_slot); -PREP(clear_user_data); -PREP(create_dialog); -PREP(cycle_gun_list); -PREP(cycle_image_size_units); -PREP(cycle_num_ticks_units); -PREP(cycle_range_card_columns); -PREP(cycle_scope_unit); -PREP(cycle_target_size_units); -PREP(cycle_target_speed_direction); -PREP(delete_gun); -PREP(init); -PREP(parse_input); -PREP(reset_relative_click_memory); -PREP(restore_atmo_default); -PREP(restore_user_data); -PREP(save_gun); -PREP(show_add_new_gun); -PREP(show_atmo_env_data); -PREP(show_gun_ammo_data); -PREP(show_gun_list); -PREP(show_main_page); -PREP(show_range_card); -PREP(show_range_card_setup); -PREP(show_solution_setup); -PREP(show_target_data); -PREP(show_target_range_assist); -PREP(show_target_speed_assist); -PREP(show_target_speed_assist_timer); -PREP(sord); -PREP(store_user_data); -PREP(target_speed_assist_timer); -PREP(toggle_atmo_env_data); -PREP(toggle_gun_ammo_data); -PREP(toggle_gun_list); -PREP(toggle_range_card); -PREP(toggle_range_card_setup); -PREP(toggle_solution_setup); -PREP(toggle_target_data); -PREP(toggle_target_range_assist); -PREP(toggle_target_speed_assist); -PREP(update_atmosphere); -PREP(update_atmo_env_data); -PREP(update_atmo_selection); -PREP(update_gun); -PREP(update_gun_ammo_data); -PREP(update_inclination_angle); -PREP(update_range_card); -PREP(update_relative_click_memory); -PREP(update_result); -PREP(update_scope_unit); -PREP(update_solution_setup); -PREP(update_target); -PREP(update_target_data); -PREP(update_target_selection); -PREP(update_unit_selection); -PREP(update_zero_range); -PREP(on_close_dialog); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/atragmx/XEH_preStart.sqf b/addons/atragmx/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/atragmx/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/atragmx/script_component.hpp b/addons/atragmx/script_component.hpp index 8154ffa04b..ca6a5d24a0 100644 --- a/addons/atragmx/script_component.hpp +++ b/addons/atragmx/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT atragmx #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_ATRAGMX #define DEBUG_MODE_FULL #endif diff --git a/addons/attach/CfgEventHandlers.hpp b/addons/attach/CfgEventHandlers.hpp index c050fbd1c7..73b8553839 100644 --- a/addons/attach/CfgEventHandlers.hpp +++ b/addons/attach/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/attach/XEH_PREP.hpp b/addons/attach/XEH_PREP.hpp new file mode 100644 index 0000000000..5dedc2254e --- /dev/null +++ b/addons/attach/XEH_PREP.hpp @@ -0,0 +1,10 @@ + +PREP(attach); +PREP(canAttach); +PREP(canDetach); +PREP(detach); +PREP(getChildrenAttachActions); +PREP(handleGetIn); +PREP(handleGetOut); +PREP(handleKilled); +PREP(placeApprove); diff --git a/addons/attach/XEH_preInit.sqf b/addons/attach/XEH_preInit.sqf index 17b8490a77..a7feade1c3 100644 --- a/addons/attach/XEH_preInit.sqf +++ b/addons/attach/XEH_preInit.sqf @@ -2,14 +2,6 @@ ADDON = false; -PREP(attach); -PREP(canAttach); -PREP(canDetach); -PREP(detach); -PREP(getChildrenAttachActions); -PREP(handleGetIn); -PREP(handleGetOut); -PREP(handleKilled); -PREP(placeApprove); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/attach/XEH_preStart.sqf b/addons/attach/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/attach/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 6362edb33c..305c3c0960 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -49,7 +49,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment } else { GVAR(placeAction) = PLACE_WAITING; - [_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_Attach", true] call EFUNC(common,statusEffect_set); [{[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame); _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; @@ -88,7 +88,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment {!([_attachToVehicle, _unit, _itemClassname] call FUNC(canAttach))}) then { [_idPFH] call CBA_fnc_removePerFrameHandler; - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_Attach", false] call EFUNC(common,statusEffect_set); [] call EFUNC(interaction,hideMouseHint); [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); _unit removeAction _actionID; diff --git a/addons/attach/script_component.hpp b/addons/attach/script_component.hpp index 604a47fcb4..68300f47cd 100644 --- a/addons/attach/script_component.hpp +++ b/addons/attach/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT attach #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_ATTACH #define DEBUG_MODE_FULL #endif diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index cc09e8f45d..4035b389a2 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -7,7 +7,7 @@ Acoplar objeto >> Przyczep >> Attacher l'objet >> - Připnout předmět >> + Připnout >> Fixar item >> Attacca l'oggetto >> Tárgy hozzácsatolása >> @@ -115,7 +115,7 @@ Sin espacio en inventario Brak miejsca w ekwipunku Pas de place dans l'inventaire - Není místo v inventáři + Nedostatek místa v inventáři Sem espaço no inventário Non hai più spazio Nincs több hely @@ -175,7 +175,7 @@ Befestigen fehlgeschlagen Не удалось присоединить Error al acoplar - Připnutí selhalo + Připnout přesmět se nezdařilo Erro ao fixar Przyczepianie nie powiodło się Hozzácsatolás sikertelen @@ -187,7 +187,7 @@ %1<br/>acoplada Przyczepiono<br/>%1 %1<br/>attachée - %1<br/>Připnutý + %1<br/>Připnuto %1<br/>Fixada %1<br/>attaccata %1<br/>hozzácsatolva @@ -199,7 +199,7 @@ %1<br/>quitada Odczepiono<br/>%1 %1<br/>détachée - %1<br/>Odepnutý + %1<br/>Odepnuto %1<br/>Separada %1<br/>staccata %1<br/>lecsatolva diff --git a/addons/backpacks/CfgEventHandlers.hpp b/addons/backpacks/CfgEventHandlers.hpp index 1aad146690..20cf8f83bf 100644 --- a/addons/backpacks/CfgEventHandlers.hpp +++ b/addons/backpacks/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/backpacks/XEH_PREP.hpp b/addons/backpacks/XEH_PREP.hpp new file mode 100644 index 0000000000..8c8a014235 --- /dev/null +++ b/addons/backpacks/XEH_PREP.hpp @@ -0,0 +1,4 @@ + +PREP(backpackOpened); +PREP(isBackpack); +PREP(onOpenInventory); diff --git a/addons/backpacks/XEH_preInit.sqf b/addons/backpacks/XEH_preInit.sqf index f4c6a1a5d8..a7feade1c3 100644 --- a/addons/backpacks/XEH_preInit.sqf +++ b/addons/backpacks/XEH_preInit.sqf @@ -2,8 +2,6 @@ ADDON = false; -PREP(backpackOpened); -PREP(isBackpack); -PREP(onOpenInventory); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/backpacks/XEH_preStart.sqf b/addons/backpacks/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/backpacks/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/backpacks/functions/fnc_backpackOpened.sqf b/addons/backpacks/functions/fnc_backpackOpened.sqf index 4e61e8fbcc..8b4e05c20e 100644 --- a/addons/backpacks/functions/fnc_backpackOpened.sqf +++ b/addons/backpacks/functions/fnc_backpackOpened.sqf @@ -17,27 +17,20 @@ params ["_target", "_backpack"]; // do cam shake if the target is the player -if ([_target] call EFUNC(common,isPlayer)) then { +if (_target call EFUNC(common,isPlayer)) then { addCamShake [4, 0.5, 5]; }; // play a zipper sound effect -private ["_sounds", "_position"]; - -_sounds = [ - /*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss", - "a3\sounds_f\characters\ingame\AinvPknlMstpSlayWrflDnon_medic.wss", - "a3\sounds_f\characters\ingame\AinvPpneMstpSlayWpstDnon_medic.wss", - "a3\sounds_f\characters\ingame\AinvPpneMstpSlayWrflDnon_medic.wss"*/ - +private _sounds = [ QUOTE(PATHTO_R(sounds\zip_in.wav)), QUOTE(PATHTO_R(sounds\zip_out.wav)) ]; -_position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3")); +private _position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3")); playSound3D [ - _sounds select floor random count _sounds, + selectRandom _sounds, objNull, false, _position, diff --git a/addons/backpacks/functions/fnc_isBackpack.sqf b/addons/backpacks/functions/fnc_isBackpack.sqf index 68b59f803e..d6b0fb1071 100644 --- a/addons/backpacks/functions/fnc_isBackpack.sqf +++ b/addons/backpacks/functions/fnc_isBackpack.sqf @@ -12,13 +12,12 @@ */ #include "script_component.hpp" -params ["_backpack"]; +params [["_backpack", objNull, [objNull]]]; if (_backpack isEqualType objNull) then { _backpack = typeOf _backpack; }; -private "_config"; -_config = configFile >> "CfgVehicles" >> _backpack; +private _config = configFile >> "CfgVehicles" >> _backpack; 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 154000202d..d9a99535eb 100644 --- a/addons/backpacks/functions/fnc_onOpenInventory.sqf +++ b/addons/backpacks/functions/fnc_onOpenInventory.sqf @@ -16,11 +16,10 @@ params ["_unit", "_backpack"]; // exit if the target is not a real backpack, i.e. parachute, static weapon bag etc. -if !([_backpack] call FUNC(isBackpack)) exitWith {false}; +if !(_backpack call FUNC(isBackpack)) exitWith {false}; // get the unit that wears the backpack object -private "_target"; -_target = objectParent _backpack; +private _target = objectParent _backpack; if (isNull _target) exitWith {false}; diff --git a/addons/backpacks/script_component.hpp b/addons/backpacks/script_component.hpp index 2837367bfb..653e8ac684 100644 --- a/addons/backpacks/script_component.hpp +++ b/addons/backpacks/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT backpacks #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_BACKPACKS #define DEBUG_MODE_FULL #endif diff --git a/addons/ballistics/CfgWeapons.hpp b/addons/ballistics/CfgWeapons.hpp index e0cc3f203d..3f6835bbba 100644 --- a/addons/ballistics/CfgWeapons.hpp +++ b/addons/ballistics/CfgWeapons.hpp @@ -14,7 +14,6 @@ class CfgWeapons { class MMG_02_base_F; class Rifle_Base_F; class Rifle_Long_Base_F; - class WeaponSlotsInfo; class MuzzleSlot; /* Long Rifles */ @@ -74,22 +73,12 @@ class CfgWeapons { }; class DMR_01_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_B"}; - }; - }; class Single: Mode_SemiAuto { dispersion = 0.0004; // radians. Equal to 1.375 MOA. }; }; class EBR_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_B"}; - }; - }; class Single: Mode_SemiAuto { dispersion = 0.00029; // radians. Equal to 1.00 MOA. }; @@ -101,13 +90,7 @@ class CfgWeapons { /* MX */ - class arifle_MX_Base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_H"}; - }; - }; - }; + class arifle_MX_Base_F: Rifle_Base_F {}; class arifle_MX_SW_F: arifle_MX_Base_F { magazines[] = { "100Rnd_65x39_caseless_mag_Tracer", @@ -120,13 +103,6 @@ class CfgWeapons { initSpeed = -1.0; ACE_barrelTwist=228.6; ACE_barrelLength=406.4; - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - // Shit is broken again - //compatibleItems[] += {"ACE_muzzle_mzls_H"}; - compatibleItems[] = {"muzzle_snds_H","muzzle_snds_H_SW","ACE_muzzle_mzls_H"}; - }; - }; }; class arifle_MXM_F: arifle_MX_Base_F { magazines[] = { @@ -150,13 +126,7 @@ class CfgWeapons { /* Katiba */ - class arifle_katiba_Base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_H"}; - }; - }; - }; + class arifle_katiba_Base_F: Rifle_Base_F {}; /* Other */ @@ -167,42 +137,16 @@ class CfgWeapons { "ACE_200Rnd_65x39_cased_Box_Tracer_Dim" }; initSpeed = -0.9763; - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_H"}; - }; - }; ACE_barrelTwist=177.8; ACE_barrelLength=317.5; }; class LMG_Zafir_F: Rifle_Long_Base_F { initSpeed = -1.0; - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_B"}; - }; - }; ACE_barrelTwist=304.8; ACE_barrelLength=459.74; }; - - - /* Assault Rifles */ - class Tavor_base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_L"}; - }; - }; - }; - class mk20_base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_L"}; - }; - }; - }; - + class Tavor_base_F: Rifle_Base_F {}; + class mk20_base_F: Rifle_Base_F {}; /* SMGs */ class SDAR_base_F: Rifle_Base_F { @@ -219,93 +163,43 @@ class CfgWeapons { dispersion = 0.0008727; // radians. Equal to 3 MOA. }; }; - class pdw2000_base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; - }; - }; - }; - class SMG_01_Base: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_smg_01"}; - }; - }; - }; - class SMG_02_base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; - }; - }; - }; - + class pdw2000_base_F: Rifle_Base_F {}; + class SMG_01_Base: Rifle_Base_F {}; + class SMG_02_base_F: Rifle_Base_F {}; + /* Pistols */ class Pistol; - class Pistol_Base_F: Pistol { - class WeaponSlotsInfo; - }; + class Pistol_Base_F: Pistol {}; class hgun_P07_F: Pistol_Base_F { initSpeed = -0.9778; ACE_barrelTwist=254.0; ACE_barrelLength=101.6; - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE"; - compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; - }; - }; }; class hgun_Rook40_F: Pistol_Base_F { initSpeed = -1.0; ACE_barrelTwist=254.0; ACE_barrelLength=111.76; - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE"; - compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; - }; - }; }; class hgun_ACPC2_F: Pistol_Base_F { initSpeed = -1.0; ACE_barrelTwist=406.4; ACE_barrelLength=127.0; - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_smg_01"}; - }; - }; }; class hgun_Pistol_heavy_01_F: Pistol_Base_F { initSpeed = -0.96; ACE_barrelTwist=406.4; ACE_barrelLength=114.3; - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_smg_01"}; - }; - }; }; class hgun_Pistol_heavy_02_F: Pistol_Base_F { initSpeed = -0.92; ACE_barrelTwist=406.4; ACE_barrelLength=76.2; - /* - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot { - linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE"; - compatibleItems[] += {"ACE_muzzle_mzls_smg_01"}; - }; - }; - */ }; class hgun_PDW2000_F: pdw2000_base_F { initSpeed = -1.157; diff --git a/addons/ballistics/script_component.hpp b/addons/ballistics/script_component.hpp index 3a0f60e191..b648c74e76 100644 --- a/addons/ballistics/script_component.hpp +++ b/addons/ballistics/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT ballistics #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_BALLISTICS #define DEBUG_MODE_FULL #endif diff --git a/addons/ballistics/stringtable.xml b/addons/ballistics/stringtable.xml index 0cc8c0be6b..39bbac1726 100644 --- a/addons/ballistics/stringtable.xml +++ b/addons/ballistics/stringtable.xml @@ -33,7 +33,7 @@ Calibre: 6,5x39mm Trazadoras IR-DIM<br />Balas: 30<br />Se usa en: MX/C/M/SW/3GL Calibre: 6,5x39mm Traçantes IR-DIM<br />Cartouches: 30<br />Utilisé avec: MX/C/M/SW/3GL Kaliber: 6,5x39mm Smugacz IR-DIM<br />Pociski: 30<br />Używane w: MX/C/M/SW/3GL - Ráže: 6.5x39mm Svítící IR-DIM<br />Munice: 30<br />Použití: MX/C/M/SW/3GL + Ráže: 6.5x39mm Svítící IR-DIM<br />Nábojů: 30<br />Použití u: MX Calibre: 6,5x39mm Traçante IR-DIM<br />Projéteis: 30<br />Usado em: MX/C/M/SW/3GL Calibro: 6.5x39mm Traccianti IR-DIM <br />Munizioni: 30<br />In uso su: MX/C/M/SW/3GL Калибр: 6,5x39 мм ИК-трассирующие<br />Патронов: 30<br />Используются с: MX/C/M/SW/3GL @@ -69,7 +69,7 @@ Calibre: 6,5x39mm SD<br />Balas: 30<br />Se usa en: MX/C/M/SW/3GL Calibre: 6,5x39mm SD<br />Cartouches: 30<br />Utilisé avec: MX/C/M/SW/3GL Kaliber: 6,5x39mm SD<br />Pociski: 30<br />Używane w: MX/C/M/SW/3GL - Ráže: 6.5x39mm SD<br />Munice: 30<br />Použití: MX/C/M/SW/3GL + Ráže: 6.5x39mm SD<br />Nábojů: 30<br />Použití u: MX Calibre: 6,5x39mm SD<br />Projéteis: 30<br />Usado em: MX/C/M/SW/3GL Calibro: 6.5x39mm Sil.<br />Munizioni: 30<br />In uso su: MX/C/M/SW/3GL Калибр: 6,5x39 мм дозвуковые<br />Патронов: 30<br />Используются с: MX/C/M/SW/3GL @@ -105,7 +105,7 @@ Calibre: 6,5x39mm AP<br />Balas: 30<br />Se usa en: MX/C/M/SW/3GL Calibre: 6,5x39mm AP<br />Cartouches: 30<br />Utilisé avec: MX/C/M/SW/3GL Kaliber: 6,5x39mm AP<br />Pociski: 30<br />Używane w: MX/C/M/SW/3GL - Ráže: 6.5x39mm AP<br />Munice: 30<br />Použití: MX/C/M/SW/3GL + Ráže: 6.5x39mm AP<br />Nábojů: 30<br />Použití u: MX Calibre: 6,5x39mm AP<br />Projéteis: 30<br />Usado em: MX/C/M/SW/3GL Calibro: 6.5x39mm AP<br />Munizioni: 30<br />In uso su: MX/C/M/SW/3GL Калибр: 6,5x39 мм бронебойные<br />Патронов: 30<br />Используются с: MX/C/M/SW/3GL @@ -142,7 +142,7 @@ Calibre: 6,5x39mm Trazadoras IR-DIM<br />Balas: 30<br />Se usa en: Katiba Calibre: 6,5x39mm Traçantes IR-DIM<br />Cartouches: 30<br />Utilisé avec: Katiba Kaliber: 6,5x39mm Smugacz IR-DIM<br />Pociski: 30<br />Używane w: Katiba - Ráže: 6.5x39mm Svítící IR-DIM<br />Munice: 30<br />Použití: Katiba + Ráže: 6.5x39mm Svítící IR-DIM<br />Nábojů: 30<br />Použití u: KH 2002 Sama Calibre: 6,5x39mm Traçante IR-DIM<br />Projéteis: 30<br />Usado em: Katiba Calibro: 6.5x39mm Tracciant IR-DIM<br />Munizioni: 30<br />In uso su: Katiba Калибр: 6,5x39 мм ИК-трассирующие<br />Патронов: 30<br />Используются с: Katiba @@ -178,7 +178,7 @@ Calibre: 6,5x39mm SD<br />Balas: 30<br />Se usa en: Katiba Calibre: 6,5x39mm SD<br />Cartouches: 30<br />Utilisé avec: Katiba Kaliber: 6,5x39mm SD<br />Naboje: 30<br />Używane w: Katiba - Ráže: 6.5x39mm SD<br />Munice: 30<br />Použití: Katiba + Ráže: 6.5x39mm SD<br />Nábojů: 30<br />Použití u: KH 2002 Sama Calibre: 6,5x39mm SD<br />Projéteis: 30<br />Usado em: Katiba Calibro: 6.5x39mm Sil.<br />Munizioni: 30<br />In uso su: Katiba Калибр: 6,5x39 мм дозвуковые<br />Патронов: 30<br />Используются с: Katiba @@ -214,7 +214,7 @@ Calibre: 6,5x39mm AP<br />Balas: 30<br />Se usa en: Katiba Calibre: 6,5x39mm AP<br />Cartouches: 30<br />Utilisé avec: Katiba Kaliber: 6,5x39mm AP<br />Pociski: 30<br />Używane w: Katiba - Ráže: 6.5x39mm AP<br />Munice: 30<br />Použití: Katiba + Ráže: 6.5x39mm AP<br />Nábojů: 30<br />Použití u: KH 2002 Sama Calibre: 6,5x39mm AP<br />Projéteis: 30<br />Usado em: Katiba Calibro: 6.5x39mm AP<br />Munizioni: 30<br />In uso su: Katiba Калибр: 6,5x39 мм бронебойные<br />Патронов: 30<br />Используются с: Katiba @@ -251,7 +251,7 @@ Calibre: 5,56x45mm Trazadoras IR-DIM<br />Balas: 30<br />Se usa en: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR Calibre: 5,56x45mm Traçantes IR-DIM<br />Cartouches: 30<br />Utilisé avec: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR Kaliber: 5,56x45mm Smugacz IR-DIM<br />Pociski: 30<br />Używane w: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Ráže: 5.56x45mm Svítící IR-DIM<br />Munice: 30<br />Použití: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR + Ráže: 5.56x45mm Svítící IR-DIM<br />Nábojů: 30<br />Použití u: CTAR-21, TAR-21, F2000, RFB SDAR Calibre: 5,56x45mm Traçante IR-DIM<br />Projéteis: 30<br />Usado em: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR Calibro: 5.56x45mm Traccianti IR-DIM<br />Munizioni: 30<br />In uso su: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR Калибр: 5,56x45 мм ИК-трассирующие<br />Патронов: 30<br />Используются с: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR @@ -288,7 +288,7 @@ Calibre: 7,62x51mm Trazadora<br />Balas: 20<br />Se usa en: Mk18 ABR Calibre: 7,62x51mm Traçantes<br />Cartouches: 20<br />Utilisé avec: EBR Kaliber: 7,62x51mm Smugacz<br />Pociski: 20<br />Używane w: Mk18 ABR - Ráže: 7.62x51mm Svítící<br />Munice: 20<br />Použití: Mk18 ABR + Ráže: 7.62x51mm Svítící<br />Nábojů: 20<br />Použití u: Mk14 Mod 1 EBR Calibre: 7,62x51mm Traçante<br />Projéteis: 20<br />Usado em: Mk18 ABR Calibro: 7.62x51mm Traccianti<br />Munizioni: 20<br />In uso su: Mk18 ABR Калибр: 7,62x51 мм трассирующие<br />Патронов: 20<br />Используются с: Mk18 ABR @@ -324,7 +324,7 @@ Calibre: 7,62x51mm Trazadoras IR-DIM<br />Balas: 20<br />Se usa en: Mk18 ABR Calibre: 7,62x51mm Traçantes IR-DIM<br />Cartouches: 20<br />Utilisé avec: EBR Kaliber: 7,62x51mm Smugacz IR-DIM<br />Pociski: 20<br />Używane w: Mk18 ABR - Ráže: 7.62x51mm Svítící IR-DIM<br />Munice: 20<br />Použití: Mk18 ABR + Ráže: 7.62x51mm Svítící IR-DIM<br />Nábojů: 20<br />Použití u: Mk14 Mod 1 EBR Calibre: 7,62x51mm Traçante IR-DIM<br />Projéteis: 20<br />Usado em: Mk18 ABR Calibro: 7.62x51mm Traccianti IR-DIM<br />Munizioni: 20<br />In uso su: Mk18 ABR Калибр: 7,62x51 мм ИК-трассирующие<br />Патронов: 20<br />Используются с: Mk18 ABR @@ -360,7 +360,7 @@ Calibre: 7,62x51mm SD<br />Balas: 20<br />Se usa en: Mk18 ABR Calibre: 7,62x51mm SD<br />Cartouches: 20<br />Utilisé avec: EBR Kaliber: 7,62x51mm SD<br />Pociski: 20<br />Używane w: Mk18 ABR - Ráže: 7.62x51mm SD<br />Munice: 20<br />Použití: Mk18 ABR + Ráže: 7.62x51mm SD<br />Nábojů: 20<br />Použití u: Mk14 Mod 1 EBR Calibre: 7,62x51mm SD<br />Projéteis: 20<br />Usado em: Mk18 ABR Calibro: 7.62x51mm Sil.<br />Munizioni: 20<br />In uso su: Mk18 ABR Калибр: 7,62x51 мм дозвуковые<br />Патронов: 20<br />Используются с: Mk18 ABR @@ -398,7 +398,7 @@ Calibre: .338 Norma Magnum trazadora<br />Balas: 130<br />Se usa en: SPMG Калибр: .338 Norma Magnum трассирующие<br />Патронов: 130<br />Используются в: SPMG Calibro: .338 Norma Magnum Tracciante<br />Munizioni: 130<br />In uso su: SPMG - Ráže: .338 Noma Magnum Svítící<br />Munice: 130<br />Použití: SPMG + Ráže: .338 Noma Magnum Svítící<br />Nábojů: 130<br />Použití u: LWMMG Calibre: .338 Norma Magnum Traçante<br />Cartuchos: 130<br />Usado em: SPMG Kaliber: .338 Norma Magnum nyomkövető<br />Lövedékek: 130<br />Használható: SPMG @@ -434,7 +434,7 @@ Calibre: .338 Norma Magnum trazadora IR-DIM<br />Balas: 130<br />Se usa en: SPMG Калибр: .338 Norma Magnum ИК-трассирующие<br />Патронов: 130<br />Используются с: SPMG Calibro: .338 Norma Magnum Tracciante IR-DIM<br />Munizioni: 130<br />In uso su: SPMG - Ráže: .338 Noma Magnum Svítící IR-DIM<br />Munice: 130<br />Použití: SPMG + Ráže: .338 Noma Magnum Svítící IR-DIM<br />Nábojů: 130<br />Použití u: LWMMG Calibre: .338 Norma Magnum Traçante IR-DIM<br />Cartuchos: 130<br />Usado em: SPMG Kaliber: .338 Norma Magnum infravörös nyomkövető<br />Lövedékek: 130<br />Használható: SPMG @@ -470,7 +470,7 @@ Calibre: .338 Norma Magnum AP<br />Balas: 130<br />Se usa en: SPMG Калибр: .338 Norma Magnum бронебойные<br />Патронов: 130<br />Используются с: SPMG Calibro: .338 Norma Magnum AP<br />Munizioni: 130<br />In uso su: SPMG - Ráže: .338 Noma Magnum AP<br />Munice: 130<br />Použití: SPMG + Ráže: .338 Noma Magnum AP<br />Nábojů: 130<br />Použití u: LWMMG Calibre: .338 Norma Magnum AP<br />Cartuchos: 130<br />Usado em: SPMG Kaliber: .338 Norma Magnum páncéltörő<br />Lövedékek: 130<br />Használható: SPMG @@ -507,7 +507,7 @@ Calibre: 9.3x64mm trazadora<br />Balas: 10<br />Se usa en: Cyrus Калибр: 9,3x64 мм трассирующие<br />Патронов: 10<br />Используются с: Cyrus Calibro: 9.3x64mm Tracer<br />Munizioni: 10<br />In uso su: Cyrus - Ráže: 9.3x64mm Svítící<br />Munice: 10<br />Použití: Cyrus + Ráže: 9.3x64mm Svítící<br />Nábojů: 10<br />Použití u: Cyrus Calibre: 9.3x64mm Traçante<br />Cartuchos: 10<br />Usado em: Cyrus Kaliber: 9,3x64mm nyomkövető<br />Lövedékek: 10<br />Használható: Cyrus @@ -543,7 +543,7 @@ Calibre: 9.3x64mm trazadora IR-DIM<br />Balas: 10<br />Se usa en: Cyrus Калибр: 9,3x64 мм ИК-трассирующие<br />Патронов: 10<br />Используются с: Cyrus Calibro: 9.3x64mm Tracciante IR-DIM<br />Munizioni: 10<br />In uso su: Cyrus - Ráže: 9.3x64mm Svítící IR-DIM<br />Munice: 10<br />Použití: Cyrus + Ráže: 9.3x64mm Svítící IR-DIM<br />Nábojů: 10<br />Použití u: Cyrus Calibre: 9.3x64mm Traçante IR-DIM<br />Cartuchos: 10<br />Usado em: Cyrus Kaliber: 9,3x64mm infravörös nyomkövető<br />Lövedékek: 10<br /> Használható: Cyrus @@ -580,7 +580,7 @@ Calibre: 9.3x64mm trazadora<br />Balas: 150<br />Se usa en: Navid Калибр: 9,3x64 мм трассирующие<br />Патронов: 150<br />Используются с: Навид Calibro: 9.3x64mm Tracciante<br />Munizioni: 150<br />In uso su: Navid - Ráže: 9.3x64mm Svítící<br />Munice: 150<br />Použití: Navid + Ráže: 9.3x64mm Svítící<br />Nábojů: 150<br />Použití u: HK121 Calibre: 9.3x64mm Traçante<br />Cartuchos: 150<br />Usado em: Navid Kaliber: 9,3x64mm nyomkövető<br />Lövedékek: 150<br />Használható: Navid @@ -616,7 +616,7 @@ Calibre: 9.3x64mm trazadora IR-DIM<br />Balas: 150<br />Se usa en: Navid Калибр: 9,3x64 мм ИК-трассирующие<br />Патронов: 150<br />Используются с: Навид Calibro: 9.3x64mm Tracciante IR-DIM<br />Munizioni: 150<br />In uso su: Navid - Ráže: 9.3x64mm Svítící IR-DIM<br />Munice: 150<br />Použití: Navid + Ráže: 9.3x64mm Svítící IR-DIM<br />Nábojů: 150<br />Použití u: HK121 Calibre: 9.3x64mm Traçante IR-DIM<br />Cartuchos: 150<br />Usado em: Navid Kaliber: 9,3x64mm infravörös nyomkövető<br />Lövedékek: 150<br />Használható: Navid @@ -652,7 +652,7 @@ Calibre: 9.3x64mm AP<br />Balas: 150<br />Se usa en: Navid Калибр: 9,3x64 мм бронебойные<br />Патронов: 150<br />Используются с: Навид Calibro: 9.3x64mm AP<br />Munizioni: 150<br />In uso su: Navid - Ráže: 9.3x64mm AP<br />Munice: 150<br />Použití: Navid + Ráže: 9.3x64mm AP<br />Nábojů: 150<br />Použití u: HK121 Calibre: 9.3x64mm AP<br />Cartuchos: 150<br />Usado em: Navid Kaliber: 9,3x64mm páncéltörő<br />Lövedékek: 150<br />Használható: Navid @@ -796,7 +796,7 @@ Магазин из 100 6,5 мм ИК-трассирующих 6,5mm 100-Patronen-Magazin IR-DIM Leuchtspur<br />Patronen: 100<br />Eingesetzt von: MXLSW 6.5mm 100Rnd Tracer IR-DIM Mag<br />Munizioni: 100<br />In uso su: MX LSW - 6.5mm 100náb. Svítící IR-DIM Zásobník<br />Munice: 100<br />Použití: MX LSW + 6.5mm 100náb. Svítící IR-DIM Zásobník<br />Nábojů: 100<br />Použití u: MX LSW Carregador 6.5mm 100 Cartuchos Traçantes IR-DIM<br />Cartuchos: 100<br />Usado em: MX LSW 6.5mm 100-lövedékes infravörös nyomkövető tár<br />Lövedékek: 100<br />Használható: MX LSW @@ -832,7 +832,7 @@ Магазин из 200-т 6,5 мм ИК-трассирующих 6,5mm 200-Patronen-Gurt IR-DIM Leuchtspur<br />Patronen: 200<br />Eingesetzt von: Stoner 99 LMG 6.5mm 200Rnd Tracer IR-DIM Belt<br />Munizioni: 200<br />In uso su: Stoner 99 LMG - 6.5mm 200náb. Svítící IR-DIM Pás<br />Munice: 200<br />Použití: Stoner 99 LMG + 6.5mm 200náb. Svítící IR-DIM Pás<br />Nábojů: 200<br />Použití u: Stoner 99 LMG Cinto de munição traçante 6.5mm IR-DIM com 200 cartuchos<br />Cartuchos: 200<br />Usado em: Stoner 99 LMG 6.5mm 200-lövedékes infravörös nyomkövető heveder<br />Lövedékek: 200<br />Használható: Stoner 99 LMG @@ -868,7 +868,7 @@ Калибр: 5,56x45 мм NATO (Mk262)<br />Патронов: 30 Kaliber: 5,56x45mm NATO (Mk262)<br />Patronen: 30 Calibro: 5.56x45 mm NATO (Mk262)<br />Munizioni: 30 - Ráže: 5.56x45mm NATO (Mk262)<br />Munice: 30 + Ráže: 5.56x45mm NATO (Mk262)<br />Nábojů: 30 Calibre: 5.56x45mm NATO (Mk262)<br/>Cartuchos: 30 Kaliber: 5,56x45mm NATO (Mk262)<br />Lövedékek: 30 @@ -904,7 +904,7 @@ Калибр: 5,56x45 мм NATO (Mk318)<br />Патронов: 30 Kaliber: 5,56x45mm NATO (Mk318)<br />Patronen: 30 Calibro: 5.56x45 mm NATO (Mk318)<br />Munizioni: 30 - Ráže: 5.56x45mm NATO (Mk318)<br />Munice: 30 + Ráže: 5.56x45mm NATO (Mk318)<br />Nábojů: 30 Calibre: 5.56x45mm NATO (Mk318)<br/>Cartuchos: 30 Kaliber: 5,56x45mm NATO (Mk318)<br />Lövedékek: 30 @@ -940,7 +940,7 @@ Калибр: 5,56x45 мм NATO (M995 бронебойные)<br />Патронов: 30 Kaliber: 5,56x45mm NATO (M995 AP)<br />Patronen: 30 Calibro: 5.56x45 mm NATO (M995 AP)<br />Munizioni: 30 - Ráže: 5.56x45mm NATO (M995 AP)<br />Munice: 30 + Ráže: 5.56x45mm NATO (M995 AP)<br />Nábojů: 30 Calibre: 5.56x45mm NATO (M995 AP)<br/>Cartuchos: 30 Kaliber: 5,56x45mm NATO (M995 páncéltörő)<br />Lövedékek: 30 @@ -976,7 +976,7 @@ Калибр: 7,62x51 мм NATO (M118LR)<br />Патронов: 10 Kaliber: 7,62x51mm NATO (M118LR)<br />Patronen: 10 Calibro: 7.62x51 mm NATO (M118LR)<br />Munizioni: 10 - Ráže: 7.62x51mm NATO (M118LR)<br />Munice: 10 + Ráže: 7.62x51mm NATO (M118LR)<br />Nábojů: 10 Calibre: 7.26x51mm NATO (M118LR)<br/>Cartuchos: 10 Kaliber: 7,62x51mm NATO (M118LR)<br />Lövedékek: 10 @@ -1012,7 +1012,7 @@ Калибр: 7,62x51 мм NATO (M118LR)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (M118LR)<br />Patronen: 20 Calibro: 7.62x51 mm NATO (M118LR)<br />Munizioni: 20 - Ráže: 7.62x51mm NATO (M118LR)<br />Munice: 20 + Ráže: 7.62x51mm NATO (M118LR)<br />Nábojů: 20 Calibre: 7.26x51mm NATO (M118LR)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (M118LR)<br />Lövedékek: 20 @@ -1048,7 +1048,7 @@ Калибр: 7,62x51 мм NATO (Mk316 Mod 0)<br />Патронов: 10 Kaliber: 7,62x51mm NATO (Mk316 Mod 0)<br />Patronen: 10 Calibro: 7.62x51 mm NATO (Mk316 Mod 0)<br />Munizioni: 10 - Ráže: 7.62x51mm NATO (Mk316 Mod 0)<br />Munice: 10 + Ráže: 7.62x51mm NATO (Mk316 Mod 0)<br />Nábojů: 10 Calibre: 7.26x51mm NATO (Mk316 Mod 0)<br/>Cartuchos: 10 Kaliber: 7,62x51mm NATO (Mk316 Mod 0)<br />Lövedékek: 10 @@ -1084,7 +1084,7 @@ Калибр: 7,62x51 мм NATO (Mk316 Mod 0)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (Mk316 Mod 0)<br />Patronen: 20 Calibro: 7.62x51 mm NATO (Mk316 Mod 0)<br />Munizioni: 20 - Ráže: 7.62x51mm NATO (Mk316 Mod 0)<br />Munice: 20 + Ráže: 7.62x51mm NATO (Mk316 Mod 0)<br />Nábojů: 20 Calibre: 7.26x51mm NATO (Mk316 Mod 0)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (Mk316 Mod 0)<br />Lövedékek: 20 @@ -1120,7 +1120,7 @@ Калибр: 7,62x51 мм NATO (Mk319 Mod 0)<br />Патронов: 10 Kaliber: 7,62x51mm NATO (Mk319 Mod 0)<br />Patronen: 10 Calibro: 7.62x51 mm NATO (Mk319 Mod 0)<br />Munizioni: 10 - Ráže: 7.62x51mm NATO (Mk319 Mod 0)<br />Munice: 10 + Ráže: 7.62x51mm NATO (Mk319 Mod 0)<br />Nábojů: 10 Calibre: 7.26x51mm NATO (Mk319 Mod 0)<br/>Cartuchos: 10 Kaliber: 7,62x51mm NATO (Mk319 Mod 0)<br />Lövedékek: 10 @@ -1156,7 +1156,7 @@ Калибр: 7,62x51 мм NATO (Mk319 Mod 0)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (Mk319 Mod 0)<br />Patronen: 20 Calibro: 7.62x51 mm NATO (Mk319 Mod 0)<br />Munizioni: 20 - Ráže: 7.62x51mm NATO (Mk319 Mod 0)<br />Munice: 20 + Ráže: 7.62x51mm NATO (Mk319 Mod 0)<br />Nábojů: 20 Calibre: 7.26x51mm NATO (Mk319 Mod 0)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (Mk319 Mod 0)<br />Lövedékek: 20 @@ -1192,7 +1192,7 @@ Калибр: 7,62x51 мм NATO (M993 бронебойные)<br />Патронов: 10 Kaliber: 7,62x51mm NATO (M993 AP)<br />Patronen: 10 Calibro: 7.62x51 mm NATO (M993 AP)<br />Munizioni: 10 - Ráže: 7.62x51mm NATO (M993 AP)<br />Munice: 10 + Ráže: 7.62x51mm NATO (M993 AP)<br />Nábojů: 10 Calibre: 7.26x51mm NATO (M993 AP)<br/>Cartuchos: 10 Kaliber: 7,62x51mm NATO (M993 páncéltörő)<br />Lövedékek: 10 @@ -1228,7 +1228,7 @@ Kaliber: 7,62x51mm NATO (M993 AP)<br />Patronen: 20 Calibro: 7.62x51 mm NATO (M993 AP)<br />Munizioni: 20 Calibre: 7.62x51 mm NATO (M993 AP)<br />Balas: 20 - Ráže: 7.62x51mm NATO (M993 AP)<br />Munice: 20 + Ráže: 7.62x51mm NATO (M993 AP)<br />Nábojů: 20 Calibre: 7.26x51mm NATO (M993 AP)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (M993 páncéltörő)<br />Lövedékek: 20 @@ -1264,7 +1264,7 @@ Калибр: 7,62x67 мм NATO (Mk248 Mod 0)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (Mk248 Mod 0)<br />Patronen: 20 Calibro: 7.62x67 mm NATO (Mk248 Mod 0)<br />Munizioni: 20 - Ráže: 7.62x67mm NATO (Mk248 Mod 0)<br />Munice: 20 + Ráže: 7.62x67mm NATO (Mk248 Mod 0)<br />Nábojů: 20 Calibre: 7.26x67mm NATO (Mk248 Mod 0)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (Mk248 Mod 0)<br />Lövedékek: 20 @@ -1300,7 +1300,7 @@ Калибр: 7,62x67 мм NATO (Mk248 Mod 1)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (Mk248 Mod 1)<br />Patronen: 20 Calibro: 7.62x67 mm NATO (Mk248 Mod 1)<br />Munizioni: 20 - Ráže: 7.62x67mm NATO (Mk248 Mod 1)<br />Munice: 20 + Ráže: 7.62x67mm NATO (Mk248 Mod 1)<br />Nábojů: 20 Calibre: 7.26x67mm NATO (Mk248 Mod 1)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (Mk248 Mod 1)<br />Lövedékek: 20 @@ -1336,7 +1336,7 @@ Калибр: 7,62x67 мм NATO (Berger Hybrid OTM)<br />Патронов: 20 Kaliber: 7,62x67mm NATO (Berger Hybrid OTM)<br />Patronen: 20 Calibro: 7.62x67 mm NATO (Berger Hybrid OTM)<br />Munizioni: 20 - Ráže: 7.62x67mm NATO (Berger Hybrid OTM)<br />Munice: 20 + Ráže: 7.62x67mm NATO (Berger Hybrid OTM)<br />Nábojů: 20 Calibre: 7.26x67mm NATO (Berger Hybrid OTM)<br/>Cartuchos: 20 Kaliber: 7,62x67mm NATO (Berger Hybrid OTM)<br />Lövedékek: 20 @@ -1372,7 +1372,7 @@ Калибр: 6,5x47 мм (экспансивные Scenar)<br />Патронов: 30<br />Используются с: MXM Kaliber: 6,5x47mm (HPBT Scenar)<br />Patronen: 30<br />Eingesetzt von: MXM Calibro: 6.5x47mm (HPBT Scenar)<br />Munizioni: 30<br />In uso su: MXM - Ráže: 6.5x47mm (HPBT Scenar)<br />Munice: 30<br />Použití: MXM + Ráže: 6.5x47mm (HPBT Scenar)<br />Nábojů: 30<br />Použití u: MXM Calibre: 6.5x47mm (HPBT Scenar)<br/>Cartuchos: 30<br/>Usado em: MXM Kaliber: 6,5x47mm (HPBT Scenar)<br />Lövedékek: 30<br />Használható: MXM @@ -1408,7 +1408,7 @@ Calibro: 6.5mm Creedmor<br />Munizioni: 30<br />In uso su: MXM Calibre: 6.5mm Creedmor<br />Balas: 30<br />Se usa en: MXM Калибр: 6,5x47мм Creedmor<br />Патронов: 30<br />Используются c: MXM - Ráže: 6.5x47mm Creedmor<br />Munice: 30<br />Použití: MXM + Ráže: 6.5x47mm Creedmor<br />Nábojů: 30<br />Použití u: MXM Calibre: 6.5x47mm Creedmor<br/>Cartuchos: 30<br/>Usado em: MXM Kaliber: 6,5x47mm Creedmor<br />Lövedékek: 30<br />Használható: MXM @@ -1444,7 +1444,7 @@ Калибр: 8,6x70mm (300 гран Sierra MatchKing экспансивные)<br />Патронов: 10 Kaliber: 8,6x70mm (300gr Sierra MatchKing HPBT)<br />Patronen: 10 Calibro: 8.6x70mm (300gr Sierra MatchKing HPBT)<br />Munizioni: 10 - Ráže: 8.6x70mm (300gr Sierra MatchKing HPBT)<br />Munice: 10 + Ráže: 8.6x70mm (300gr Sierra MatchKing HPBT)<br />Nábojů: 10 Calibre: 8.6x70mm (300gr Sierra MatchKing HPBT)<br/>Cartuchos: 10 Kaliber: 8,6x70mm (300gr Sierra MatchKing HPBT)<br />Lövedékek: 10 @@ -1480,7 +1480,7 @@ Калибр: 8,6x70 мм (API526)<br />Патронов: 10 Kaliber: 8,6x70mm (API526)<br />Patronen: 10 Calibro: 8.6x70mm (API526)<br />Munizioni: 10 - Ráže: 8.6x70mm (API526)<br />Munice: 10 + Ráže: 8.6x70mm (API526)<br />Nábojů: 10 Calibre: 8.6x70mm (API526)<br/>Cartuchos: 10 Kaliber: 8,6x70mm (API526)<br />Lövedékek: 10 @@ -1516,7 +1516,7 @@ Калибр: 12,7x99 мм<br />Патронов: 5 Kaliber: 12,7x99mm<br />Patronen: 5 Calibro: 12.7x99mm<br />Munizioni: 5 - Ráže: 12.7x99mm<br />Munice: 5 + Ráže: 12.7x99mm<br />Nábojů: 5 Calibre: 12.7x99mm<br/>Cartuchos: 5 Kaliber: 12,7x99mm<br />Lövedékek: 5 @@ -1552,7 +1552,7 @@ Калибр: 12,7x99 мм бронебойно-зажигательные<br />Патронов: 5 Kaliber:12,7x99mm API<br />Patronen: 5 Calibro: 12.7x99mm API<br />Munizioni: 5 - Ráže: 12.7x99mm API<br />Munice: 5 + Ráže: 12.7x99mm API<br />Nábojů: 5 Calibre: 12.7x99mm API<br/>Cartuchos: 5 Kaliber: 12,7x99mm API<br />Lövedékek: 5 @@ -1588,7 +1588,7 @@ Калибр: 12,7x99 мм (A-MAX)<br />Патронов: 5 Calibro: 12.7x99mm (AMAX)<br />Munizioni: 5 Kaliber:12,7x99mm (AMAX)<br />Patronen: 5 - Ráže: 12.7x99mm (AMAX)<br />Munice: 5 + Ráže: 12.7x99mm (AMAX)<br />Nábojů: 5 Calibre: 12.7x99mm (AMAX)<br/>Cartuchos: 5 Kaliber: 12,7x99mm (AMAX)<br />Lövedékek: 5 @@ -1602,6 +1602,7 @@ [ACE] Caisse de munitions [ACE] Lőszeres láda [ACE] Ящик с боеприпасами + [ACE] Cassa munizioni - + \ No newline at end of file diff --git a/addons/captives/CfgEden.hpp b/addons/captives/CfgEden.hpp new file mode 100644 index 0000000000..6ee6230ee5 --- /dev/null +++ b/addons/captives/CfgEden.hpp @@ -0,0 +1,30 @@ +class Cfg3DEN { + class Object { + class AttributeCategories { + class ace_attributes { + class Attributes { + class ace_isHandcuffed { + property = QUOTE(ace_isHandcuffed); + control = "Checkbox"; + displayName = CSTRING(ModuleHandcuffed_DisplayName); + tooltip = CSTRING(ModuleHandcuffed_Description); + expression = QUOTE([ARR_2(_this,_value)]call FUNC(setHandcuffed)); + typeName = "BOOL"; + condition = "objectBrain"; + defaultValue = false; + }; + class ace_isSurrendered { + property = QUOTE(ace_isSurrendered); + control = "Checkbox"; + displayName = CSTRING(ModuleSurrender_DisplayName); + tooltip = CSTRING(ModuleSurrender_Description); + expression = QUOTE([ARR_2(_this,_value)]call FUNC(setSurrendered)); + typeName = "BOOL"; + condition = "objectBrain"; + defaultValue = false; + }; + }; + }; + }; + }; +}; diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index 4d12dc10c4..916990f1b5 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -9,6 +16,13 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_DisplayUnload_EventHandlers { + class RscDisplayCurator { + ADDON = QUOTE(call FUNC(handleZeusDisplayChanged)); + }; +}; + //release escorted captive when entering a vehicle class Extended_GetIn_EventHandlers { class All { diff --git a/addons/captives/XEH_PREP.hpp b/addons/captives/XEH_PREP.hpp new file mode 100644 index 0000000000..2722214e1b --- /dev/null +++ b/addons/captives/XEH_PREP.hpp @@ -0,0 +1,30 @@ + +PREP(canApplyHandcuffs); +PREP(canEscortCaptive); +PREP(canFriskPerson); +PREP(canLoadCaptive); +PREP(canRemoveHandcuffs); +PREP(canStopEscorting); +PREP(canSurrender); +PREP(canUnloadCaptive); +PREP(doApplyHandcuffs); +PREP(doEscortCaptive); +PREP(doFriskPerson); +PREP(doLoadCaptive); +PREP(doRemoveHandcuffs); +PREP(doUnloadCaptive); +PREP(findEmptyNonFFVCargoSeat); +PREP(handleGetIn); +PREP(handleGetOut); +PREP(handleOnUnconscious); +PREP(handlePlayerChanged); +PREP(handleRespawn); +PREP(handleUnitInitPost); +PREP(handleZeusDisplayChanged); +PREP(moduleHandcuffed); +PREP(moduleSettings); +PREP(moduleSurrender); +PREP(setHandcuffed); +PREP(setSurrendered); +PREP(vehicleCaptiveMoveIn); +PREP(vehicleCaptiveMoveOut); diff --git a/addons/captives/XEH_postInit.sqf b/addons/captives/XEH_postInit.sqf index 26f84e6bd9..144d3efb9a 100644 --- a/addons/captives/XEH_postInit.sqf +++ b/addons/captives/XEH_postInit.sqf @@ -18,7 +18,6 @@ if (isServer) then { }]; }; -["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); ["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); @@ -34,3 +33,10 @@ if (!hasInterface) exitWith {}; ["isNotEscorting", {!(GETVAR(_this select 0,GVAR(isEscorting),false))}] call EFUNC(common,addCanInteractWithCondition); ["isNotHandcuffed", {!(GETVAR(_this select 0,GVAR(isHandcuffed),false))}] call EFUNC(common,addCanInteractWithCondition); ["isNotSurrendering", {!(GETVAR(_this select 0,GVAR(isSurrendering),false))}] call EFUNC(common,addCanInteractWithCondition); + +["SettingsInitialized", { + // Hold on a little bit longer to ensure anims will work + [{ + GVAR(captivityEnabled) = true; + }, [], 0.05] call EFUNC(common,waitAndExecute); +}] call EFUNC(common,addEventHandler); diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index dcc585ef8e..81657a8960 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -2,34 +2,8 @@ ADDON = false; -PREP(canApplyHandcuffs); -PREP(canEscortCaptive); -PREP(canFriskPerson); -PREP(canLoadCaptive); -PREP(canRemoveHandcuffs); -PREP(canStopEscorting); -PREP(canSurrender); -PREP(canUnloadCaptive); -PREP(doApplyHandcuffs); -PREP(doEscortCaptive); -PREP(doFriskPerson); -PREP(doLoadCaptive); -PREP(doRemoveHandcuffs); -PREP(doUnloadCaptive); -PREP(findEmptyNonFFVCargoSeat); -PREP(handleGetIn); -PREP(handleGetOut); -PREP(handleOnUnconscious); -PREP(handlePlayerChanged); -PREP(handleRespawn); -PREP(handleUnitInitPost); -PREP(handleZeusDisplayChanged); -PREP(moduleHandcuffed); -PREP(moduleSettings); -PREP(moduleSurrender); -PREP(setHandcuffed); -PREP(setSurrendered); -PREP(vehicleCaptiveMoveIn); -PREP(vehicleCaptiveMoveOut); +#include "XEH_PREP.hpp" + +GVAR(captivityEnabled) = false; ADDON = true; diff --git a/addons/captives/XEH_preStart.sqf b/addons/captives/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/captives/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index a9ec2950ee..c87408b341 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -17,3 +17,4 @@ class CfgPatches { #include "CfgMoves.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "CfgEden.hpp" \ No newline at end of file diff --git a/addons/captives/functions/fnc_handleRespawn.sqf b/addons/captives/functions/fnc_handleRespawn.sqf index 7e97501576..bdd4915d68 100644 --- a/addons/captives/functions/fnc_handleRespawn.sqf +++ b/addons/captives/functions/fnc_handleRespawn.sqf @@ -40,12 +40,12 @@ if (_respawn > 3) then { if (_unit getVariable [QGVAR(isHandcuffed), false]) then { [_unit, false] call FUNC(setHandcuffed); }; - [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Handcuffed), false] call EFUNC(common,statusEffect_set); if (_unit getVariable [QGVAR(isSurrendering), false]) then { [_unit, false] call FUNC(setSurrendered); }; - [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Surrendered), false] call EFUNC(common,statusEffect_set); if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { _oldUnit setVariable [QGVAR(isEscorting), false, true]; diff --git a/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf b/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf index ef8aedbbe1..433c1fc259 100644 --- a/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf +++ b/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf @@ -17,15 +17,10 @@ */ #include "script_component.hpp" -params ["_unit","_zeusIsOpen"]; - -//set showHUD based on unit status: -if (!_zeusIsOpen) then { - if ((_unit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then { - TRACE_1("Player Change (showHUD false)",_unit); - ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud); - } else { - TRACE_1("Player Change (showHUD true)",_unit); - ["captive", []] call EFUNC(common,showHud); //same as showHud true; - }; +if ((ACE_player getVariable [QGVAR(isHandcuffed), false]) || {ACE_player getVariable [QGVAR(isSurrendering), false]}) then { + TRACE_1("Player Change (showHUD false)",ACE_player); + ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud); +} else { + TRACE_1("Player Change (showHUD true)",ACE_player); + ["captive", []] call EFUNC(common,showHud); //same as showHud true; }; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 1e686ea849..d4f84730e6 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -22,13 +22,25 @@ TRACE_2("params",_unit,_state); if (!local _unit) exitWith { ERROR("running setHandcuffed on remote unit"); }; + +if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith { + // It's to soon to call this function, delay it + if (EGVAR(common,settingsInitFinished)) then { + // Settings are already initialized, but the small wait isn't over + [DFUNC(setHandCuffed), _this, 0.05] call EFUNC(common,waitAndExecute); + } else { + // Settings are not initialized yet + [DFUNC(setHandCuffed), _this] call EFUNC(common,runAfterSettingsInit); + }; +}; + if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith { ERROR("setHandcuffed: current state same as new"); }; if (_state) then { _unit setVariable [QGVAR(isHandcuffed), true, true]; - [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Handcuffed), true] call EFUNC(common,statusEffect_set); if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop [_unit, false] call FUNC(setSurrendered); @@ -89,7 +101,7 @@ if (_state) then { }, [_unit], 0.01] call EFUNC(common,waitAndExecute); } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; - [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Handcuffed), false] call EFUNC(common,statusEffect_set); //remove AnimChanged EH private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1]; diff --git a/addons/captives/functions/fnc_setSurrendered.sqf b/addons/captives/functions/fnc_setSurrendered.sqf index aa65c1273d..ffc3c35081 100644 --- a/addons/captives/functions/fnc_setSurrendered.sqf +++ b/addons/captives/functions/fnc_setSurrendered.sqf @@ -23,6 +23,17 @@ if (!local _unit) exitWith { ERROR("running surrender on remote unit"); }; +if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith { + // It's to soon to call this function, delay it + if (EGVAR(common,settingsInitFinished)) then { + // Settings are already initialized, but the small wait isn't over + [DFUNC(setSurrendered), _this, 0.05] call EFUNC(common,waitAndExecute); + } else { + // Settings are not initialized yet + [DFUNC(setSurrendered), _this] call EFUNC(common,runAfterSettingsInit); + }; +}; + if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) exitWith { ERROR("Surrender: current state same as new"); }; @@ -33,7 +44,7 @@ if (_state) then { _unit setVariable [QGVAR(isSurrendering), true, true]; - [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Surrendered), true] call EFUNC(common,statusEffect_set); if (_unit == ACE_player) then { ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud); @@ -65,7 +76,7 @@ if (_state) then { }, [_unit], 0.01] call EFUNC(common,waitAndExecute); } else { _unit setVariable [QGVAR(isSurrendering), false, true]; - [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Surrendered), false] call EFUNC(common,statusEffect_set); //remove AnimChanged EH private _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1]; diff --git a/addons/captives/script_component.hpp b/addons/captives/script_component.hpp index 375c956129..95a842f15f 100644 --- a/addons/captives/script_component.hpp +++ b/addons/captives/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_CAPTIVES #define DEBUG_MODE_FULL diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 17b44bc8fe..3a1a95ce55 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -7,7 +7,7 @@ Tomar prisionero Capturer le prisonnier Aresztuj - Zajmout Osobu + Zajmout osobu Arresta il prigioniero Tomar Prisioneiro Foglyul ejtés @@ -19,7 +19,7 @@ Liberar prisionero Wypuść więźnia Libérer le prisonnier - Osvobodit Zajatce + Osvobodit zajatce Libera il prigioniero Libertar Prisioneiro Fogoly szabadon engedése @@ -31,7 +31,7 @@ Escoltar prisionero Eskortuj więźnia Escorter le prisonnier - Eskortovat Zajatce + Eskortovat zajatce Scorta il Prigioniero Escoltar Prisioneiro Fogoly kísérése @@ -43,7 +43,7 @@ Soltar prisionero Anuluj eskortowanie Relâcher le prisonnier - Uvolnit Zajatce + Uvolnit zajatce Rilascia il Prigioniero Largar Prisioneiro Fogoly elengedése @@ -91,7 +91,7 @@ Opaska zaciskowa Precinto Serflex - Stahovací Pásek + Stahovací pásek Algema Plástica Fascietta Gyorskötöző @@ -167,6 +167,7 @@ Faire capituler l'unité Egység kapitulálása Заставить юнита сдаться + Fai arrendere l'unità Sync a unit to make them surrender.<br />Source: ace_captives @@ -178,20 +179,25 @@ 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 + Sincronizza una unità per farla arrendere.<br/>Fonte: ace_captives Make Unit Handcuffed + Einheit in Handschellen legen Skuj jednostkę Fazer unidade algemada Связать юнита Spoutat jednotku + Metti manette all'unità Sync a unit to make them handcuffed.<br />Source: ace_captives + Synchronisiere eine Einheit um sie in Handschellen zu legen.<br />Quelle: ace_captives Zsynchronizuj z jednostką, aby została skuta.<br />Źródło: ace_captives Sincronizar uma unidade para deixá-la algemada.<br/>Source: ace_captives Синхронизируйте с юнитами, чтобы сделать их связанными.<br />Источник: ace_captives Synchronizovat s jednotkou, která má být v poutech.<br />Zdroj: ace_captives + Sincronizza un'unità per metterle le manette.<br/>Fonte: ace_captives Captives Settings @@ -203,6 +209,7 @@ Options de capitulation Fogoly-beállítások Настройки пленения + Impostazioni Prigionieri Controls settings for surrender and cable ties @@ -214,6 +221,7 @@ Contrôle les paramètres de la rédition et des Serflex Szabályozza a kapituláció és bilincselés beállításait Управляет настройками сдачи в плен и связывания + Controlla le impostazioni per la resa e le manette Can handcuff own side @@ -225,6 +233,7 @@ Peut libérer sa propre faction Saját oldal megbilincselhető Связать союзника + Puoi ammanettare unità alleate Can players cabletie units on their own side @@ -236,6 +245,7 @@ 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 Разрешить игрокам связывать юнитов своей стороны + I giocatori possono ammanettare unità alleate Allow surrendering @@ -247,6 +257,7 @@ Permettre la capitulation Kapituláció engedélyezése Сдаться в плен + Permetti Resa Players can surrender after holstering their weapon @@ -258,6 +269,7 @@ 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 Игроки могут сдаться в плен после того, как уберут оружие + I giocatori possono arrendersi dopo aver messo via le proprie armi Require surrendering @@ -267,6 +279,7 @@ Требовать пленения Requiere rendición Vzdávání vyžadováno + Richiedi Resa Require Players to surrender before they can be arrested @@ -276,6 +289,7 @@ Требуется, чтобы игрок сдался в плен прежде, чем его можно будет связать Requiere que los Jugadores se rindan antes de arrestarlos Vyžaduje, aby se hráč nejdříve vzdal, poté může být spoután + I giocatori devono arrendersi prima che possano essere arrestati Surrendering only @@ -285,6 +299,7 @@ Только сдавшийся в плен Solo rendición Pouze vzdávání + Solo Resa Surrendering or No weapon @@ -294,6 +309,7 @@ Сдавшийся или безоружный Rendición o desarme Vzdávání nebo beze zbraně + Resa o senza armi diff --git a/addons/cargo/CfgEventHandlers.hpp b/addons/cargo/CfgEventHandlers.hpp index 5dadfb322c..3f784e7ab4 100644 --- a/addons/cargo/CfgEventHandlers.hpp +++ b/addons/cargo/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -12,7 +19,9 @@ class Extended_PostInit_EventHandlers { class Extended_Killed_EventHandlers { class All { - init = QUOTE(call FUNC(handleDestroyed)); + class ADDON { + serverKilled = QUOTE(call FUNC(handleDestroyed)); + }; }; }; @@ -93,4 +102,9 @@ class Extended_InitPost_EventHandlers { init = QUOTE(_this call DFUNC(initObject)); }; }; + class Land_PortableLight_single_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; }; diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp index 6565b7f4c5..9104533302 100644 --- a/addons/cargo/CfgVehicles.hpp +++ b/addons/cargo/CfgVehicles.hpp @@ -1,5 +1,9 @@ class CfgVehicles { - class ACE_Module; + class Logic; + class Module_F: Logic { + class ModuleDescription; + }; + class ACE_Module: Module_F {}; class ACE_moduleCargoSettings: ACE_Module { scope = 2; displayName = CSTRING(SettingsModule_DisplayName); @@ -26,6 +30,33 @@ class CfgVehicles { sync[] = {}; }; }; + class GVAR(makeLoadable): ACE_Module { + scope = 2; + displayName = CSTRING(makeLoadable_displayName); + icon = QUOTE(PATHTOF(UI\Icon_Module_makeLoadable_ca.paa)); + category = "ACE_Logistics"; + function = QFUNC(moduleMakeLoadable); + isGlobal = 1; + isTriggerActivated = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class canLoad { + displayName = CSTRING(makeLoadable_displayName); + description = CSTRING(MakeLoadable_description); + typeName = "BOOL"; + defaultValue = 1; + }; + class setSize { + displayName = CSTRING(makeLoadable_setSize_displayName); + typeName = "NUMBER"; + defaultValue = 1; + }; + }; + class ModuleDescription: ModuleDescription { + description = CSTRING(makeLoadable_description); + sync[] = {"AnyStaticObject"}; + }; + }; class LandVehicle; class Car: LandVehicle { @@ -178,7 +209,7 @@ class CfgVehicles { GVAR(space) = 0; GVAR(hasCargo) = 0; }; - + // boats class Ship; class Ship_F: Ship { @@ -237,6 +268,13 @@ class CfgVehicles { GVAR(size) = 6; }; + class Slingload_base_F: ReammoBox_F {}; + class CargoNet_01_base_F: Slingload_base_F { //Slingload pallets + GVAR(size) = 6; + }; + class Slingload_01_Base_F: Slingload_base_F { //Huron 20ft containers + GVAR(canLoad) = 0; + }; // objects class RoadCone_F: ThingX { GVAR(size) = 1; @@ -245,7 +283,7 @@ class CfgVehicles { class RoadBarrier_F: RoadCone_F { GVAR(size) = 2; }; - + class Scrapyard_base_F; class Land_PaperBox_closed_F: Scrapyard_base_F { @@ -454,4 +492,10 @@ class CfgVehicles { }; }; }; + + class Lamps_base_F; + class Land_PortableLight_single_F: Lamps_base_F { + GVAR(size) = 1; + GVAR(canLoad) = 1; + }; }; diff --git a/addons/cargo/UI/Icon_Module_makeLoadable_ca.paa b/addons/cargo/UI/Icon_Module_makeLoadable_ca.paa new file mode 100644 index 0000000000..1577116a66 Binary files /dev/null and b/addons/cargo/UI/Icon_Module_makeLoadable_ca.paa differ diff --git a/addons/cargo/XEH_PREP.hpp b/addons/cargo/XEH_PREP.hpp new file mode 100644 index 0000000000..9ccd0d587d --- /dev/null +++ b/addons/cargo/XEH_PREP.hpp @@ -0,0 +1,20 @@ + +PREP(addCargoItem); +PREP(canLoad); +PREP(canLoadItemIn); +PREP(canUnloadItem); +PREP(findNearestVehicle); +PREP(getCargoSpaceLeft); +PREP(getSizeItem); +PREP(handleDestroyed); +PREP(initObject); +PREP(initVehicle); +PREP(loadItem); +PREP(makeLoadable); +PREP(moduleMakeLoadable); +PREP(moduleSettings); +PREP(onMenuOpen); +PREP(startLoadIn); +PREP(startUnload); +PREP(unloadItem); +PREP(validateCargoSpace); diff --git a/addons/cargo/XEH_postInit.sqf b/addons/cargo/XEH_postInit.sqf index 064c941d37..c51090f8ad 100644 --- a/addons/cargo/XEH_postInit.sqf +++ b/addons/cargo/XEH_postInit.sqf @@ -4,14 +4,14 @@ ["LoadCargo", { (_this select 0) params ["_item","_vehicle"]; - private ["_loaded", "_hint", "_itemName", "_vehicleName"]; + TRACE_2("LoadCargo EH",_item,_vehicle); - _loaded = [_item, _vehicle] call FUNC(loadItem); + private _loaded = [_item, _vehicle] call FUNC(loadItem); // Show hint as feedback - _hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded; - _itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName"); - _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); + private _hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded; + private _itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName"); + private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); ["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent); @@ -22,17 +22,17 @@ }] call EFUNC(common,addEventHandler); ["UnloadCargo", { - (_this select 0) params ["_item","_vehicle"]; - private ["_unloaded", "_itemClass", "_hint", "_itemName", "_vehicleName"]; + (_this select 0) params ["_item","_vehicle", ["_unloader", objNull]]; + TRACE_3("UnloadCargo EH",_item,_vehicle,_unloader); + + private _unloaded = [_item, _vehicle, _unloader] call FUNC(unloadItem); //returns true if sucessful - _unloaded = [_item, _vehicle] call FUNC(unloadItem); - - _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; + private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; // Show hint as feedback - _hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded; - _itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); - _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); + private _hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded; + private _itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); + private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); ["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent); diff --git a/addons/cargo/XEH_preInit.sqf b/addons/cargo/XEH_preInit.sqf index 8924cacfd5..a24ce048b5 100644 --- a/addons/cargo/XEH_preInit.sqf +++ b/addons/cargo/XEH_preInit.sqf @@ -2,24 +2,9 @@ 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); +#include "XEH_PREP.hpp" GVAR(initializedItemClasses) = []; +GVAR(initializedVehicleClasses) = []; ADDON = true; diff --git a/addons/cargo/XEH_preStart.sqf b/addons/cargo/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/cargo/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/cargo/functions/fnc_addCargoItem.sqf b/addons/cargo/functions/fnc_addCargoItem.sqf index a44cd0ebcf..5e01214934 100644 --- a/addons/cargo/functions/fnc_addCargoItem.sqf +++ b/addons/cargo/functions/fnc_addCargoItem.sqf @@ -18,7 +18,7 @@ */ #include "script_component.hpp" -params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ]; +params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]]]; TRACE_3("params",_itemClass,_vehicle,_amount); for "_i" from 1 to _amount do { diff --git a/addons/cargo/functions/fnc_canLoad.sqf b/addons/cargo/functions/fnc_canLoad.sqf index f18ceb5835..bf1098dbf1 100644 --- a/addons/cargo/functions/fnc_canLoad.sqf +++ b/addons/cargo/functions/fnc_canLoad.sqf @@ -17,11 +17,11 @@ #include "script_component.hpp" params ["_player", "_object"]; +TRACE_2("params",_player,_object); if (!([_player, _object, []] call EFUNC(common,canInteractWith))) exitWith {false}; -private ["_nearestVehicle"]; -_nearestVehicle = [_player] call FUNC(findNearestVehicle); +private _nearestVehicle = [_player] call FUNC(findNearestVehicle); if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then { { diff --git a/addons/cargo/functions/fnc_canLoadItemIn.sqf b/addons/cargo/functions/fnc_canLoadItemIn.sqf index b446c4b589..d6092c2a2d 100644 --- a/addons/cargo/functions/fnc_canLoadItemIn.sqf +++ b/addons/cargo/functions/fnc_canLoadItemIn.sqf @@ -18,11 +18,10 @@ params [["_item", "", [objNull,""]], "_vehicle"]; -if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false}; - -private ["_itemSize", "_validItem"]; -_itemSize = [_item] call FUNC(getSizeItem); +if (speed _vehicle > 1 || {((getPos _vehicle) select 2) > 3}) exitWith {TRACE_1("vehicle not stable",_vehicle); false}; +private _itemSize = [_item] call FUNC(getSizeItem); +private _validItem = false; if (_item isEqualType "") then { _validItem = isClass (configFile >> "CfgVehicles" >> _item) && diff --git a/addons/cargo/functions/fnc_canUnloadItem.sqf b/addons/cargo/functions/fnc_canUnloadItem.sqf index 5c6acc44cc..ea6cb7a6eb 100644 --- a/addons/cargo/functions/fnc_canUnloadItem.sqf +++ b/addons/cargo/functions/fnc_canUnloadItem.sqf @@ -5,6 +5,7 @@ * Arguments: * 0: loaded Object * 1: Object + * 2: Unloader (player) * * Return value: * Can be unloaded @@ -16,30 +17,14 @@ */ #include "script_component.hpp" -params ["_item", "_vehicle"]; -private ["_loaded", "_itemClass", "_validVehiclestate", "_emptyPos"]; +params ["_item", "_vehicle", ["_unloader", objNull]]; +TRACE_2("params",_item,_vehicle); -_loaded = _vehicle getVariable [QGVAR(loaded), []]; +private _loaded = _vehicle getVariable [QGVAR(loaded), []]; if !(_item in _loaded) exitWith {false}; -_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; +private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; -_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, _itemClass]); // 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, _itemClass]); - }; -}; +private _emptyPos = [_vehicle, _itemClass, _unloader] call EFUNC(common,findUnloadPosition); -if (!_validVehiclestate) exitWith {false}; - -(count _emptyPos != 0) +(count _emptyPos) == 3 diff --git a/addons/cargo/functions/fnc_findNearestVehicle.sqf b/addons/cargo/functions/fnc_findNearestVehicle.sqf index c0ec154d47..b5b441df92 100644 --- a/addons/cargo/functions/fnc_findNearestVehicle.sqf +++ b/addons/cargo/functions/fnc_findNearestVehicle.sqf @@ -15,23 +15,21 @@ */ #include "script_component.hpp" -private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip", "_loadContainer"]; - params ["_unit"]; -_loadCar = nearestObject [_unit, "car"]; +private _loadCar = nearestObject [_unit, "car"]; if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitWith {_loadCar}; -_loadHelicopter = nearestObject [_unit, "air"]; +private _loadHelicopter = nearestObject [_unit, "air"]; if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitWith {_loadHelicopter}; -_loadTank = nearestObject [_unit, "tank"]; +private _loadTank = nearestObject [_unit, "tank"]; if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitWith {_loadTank}; -_loadShip = nearestObject [_unit, "ship"]; +private _loadShip = nearestObject [_unit, "ship"]; if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitWith {_loadShip}; -_loadContainer = nearestObject [_unit,"Cargo_base_F"]; +private _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 index b858ebfddc..7d94570749 100644 --- a/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf +++ b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf @@ -16,5 +16,6 @@ #include "script_component.hpp" params ["_object"]; +// TRACE_1("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 index bf5e76dcdb..775bdefd10 100644 --- a/addons/cargo/functions/fnc_getSizeItem.sqf +++ b/addons/cargo/functions/fnc_getSizeItem.sqf @@ -16,22 +16,23 @@ #include "script_component.hpp" params ["_item"]; -private ["_isVirtual","_itemClass","_config"]; + scopeName "return"; -_isVirtual = (_item isEqualType ""); -_itemClass = if (_isVirtual) then {_item} else {typeOf _item}; -_config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size)); +private _isVirtual = (_item isEqualType ""); +private _itemClass = if (_isVirtual) then {_item} else {typeOf _item}; +private _config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size)); if (_isVirtual) then { if (isNumber _config) then { (getNumber _config) breakOut "return"; }; } else { - _config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size)); - + if (!isNil {_item getVariable QGVAR(size)}) then { + (_item getVariable QGVAR(size)) breakOut "return"; + }; if (isNumber _config) then { - (_item getVariable [QGVAR(size), getNumber _config]) breakOut "return"; + (getNumber _config) breakOut "return"; }; }; diff --git a/addons/cargo/functions/fnc_handleDestroyed.sqf b/addons/cargo/functions/fnc_handleDestroyed.sqf index 8ddf59b21b..d50ea488d6 100644 --- a/addons/cargo/functions/fnc_handleDestroyed.sqf +++ b/addons/cargo/functions/fnc_handleDestroyed.sqf @@ -1,6 +1,6 @@ /* * Author: Glowbal - * Handle object being destroyed. + * Handle object being destroyed. Only runs on server. * * Arguments: * 0: Object @@ -16,10 +16,9 @@ #include "script_component.hpp" params ["_vehicle"]; +TRACE_1("params",_vehicle); -private["_loaded"]; - -_loaded = _vehicle getVariable [QGVAR(loaded), []]; +private _loaded = _vehicle getVariable [QGVAR(loaded), []]; if (_loaded isEqualTo []) exitWith {}; { @@ -27,6 +26,7 @@ if (_loaded isEqualTo []) exitWith {}; if (_x isEqualType objNull) then { deleteVehicle _x; }; + nil } count _loaded; [_vehicle] call FUNC(validateCargoSpace); diff --git a/addons/cargo/functions/fnc_initObject.sqf b/addons/cargo/functions/fnc_initObject.sqf index f9b48b19e1..dc8db802e5 100644 --- a/addons/cargo/functions/fnc_initObject.sqf +++ b/addons/cargo/functions/fnc_initObject.sqf @@ -16,15 +16,31 @@ #include "script_component.hpp" params ["_object"]; +private _type = typeOf _object; +TRACE_2("params",_object,_type); -if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(canLoad)) != 1) exitWith {}; - -private ["_type", "_action"]; -_type = typeOf _object; +if ((_object getVariable [QGVAR(canLoad), getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canLoad))]) != 1) exitWith {}; // 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); +TRACE_1("Adding load cargo action to class", _type); + +private _condition = { + GVAR(enable) && + {(_target getVariable [QGVAR(canLoad), getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(canLoad))]) == 1} && + {locked _target < 2} && + {alive _target} && + {[_player, _target, []] call EFUNC(common,canInteractWith)} +}; +private _statement = { + params ["_target", "_player"]; + [_player, _target] call FUNC(startLoadIn); +}; +private _text = localize LSTRING(loadObject); +private _icon = QUOTE(PATHTOF(UI\Icon_load.paa)); + +private _action = [QGVAR(load), _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_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf index 8857030cb7..c0b312146b 100644 --- a/addons/cargo/functions/fnc_initVehicle.sqf +++ b/addons/cargo/functions/fnc_initVehicle.sqf @@ -18,9 +18,7 @@ params ["_vehicle"]; TRACE_1("params", _vehicle); -private ["_type", "_initializedClasses"]; -_type = typeOf _vehicle; -_initializedClasses = GETMVAR(GVAR(initializedClasses),[]); +private _type = typeOf _vehicle; if (isServer) then { { @@ -35,21 +33,24 @@ if (isServer) then { }; // do nothing if the class is already initialized -if (_type in _initializedClasses) exitWith {}; +if (_type in GVAR(initializedVehicleClasses)) exitWith {}; // set class as initialized -_initializedClasses pushBack _type; -SETMVAR(GVAR(initializedClasses),_initializedClasses); +GVAR(initializedVehicleClasses) pushBack _type; +if (!hasInterface) exitWith {}; 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 = ""; +TRACE_1("Adding unload cargo action to class", _type); -_action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction); +private _condition = { + GVAR(enable) && {locked _target < 2} && {alive _target} && {[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} +}; +private _statement = { + GVAR(interactionVehicle) = _target; + createDialog QGVAR(menu); +}; +private _text = localize LSTRING(openMenu); +private _icon = ""; + +private _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 index 22c78c4304..443143ece0 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -6,7 +6,6 @@ * Arguments: * 0: Item * 1: Vehicle - * 2: Show Hint (default: true) * * Return value: * Object loaded @@ -19,18 +18,18 @@ #include "script_component.hpp" params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]]]; -private ["_loaded", "_space", "_itemSize"]; +TRACE_2("params",_item,_vehicle); -if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false}; +if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {TRACE_2("cannot load",_item,_vehicle); false}; -_loaded = _vehicle getVariable [QGVAR(loaded), []]; +private _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); +private _space = [_vehicle] call FUNC(getCargoSpaceLeft); +private _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), _space - _itemSize, true]; if (_item isEqualType objNull) then { diff --git a/addons/cargo/functions/fnc_makeLoadable.sqf b/addons/cargo/functions/fnc_makeLoadable.sqf new file mode 100644 index 0000000000..ceb1dc1acd --- /dev/null +++ b/addons/cargo/functions/fnc_makeLoadable.sqf @@ -0,0 +1,47 @@ +/* + * Author: PabstMirror + * Makes any object loadable. Needs to be called on all machines. + * + * Arguments: + * 0: Object + * 1: Set as loadable (default: true) + * 2: Size. (default: 1) + * + * Return value: + * None + * + * Example: + * [cursorTarget, true, 1] call ace_cargo_fnc_makeLoadable + * + * Public: Yes + */ +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_canLoad", true, [false, 0]], ["_setSize", 1, [0]]]; +TRACE_3("params",_object,_canLoad,_setSize); + +if (isNull _object) exitWith {TRACE_1("null",_object);}; +private _type = typeOf _object; +private _cfgCanLoad = getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canLoad)); +private _curSize = [_object] call FUNC(getSizeItem); + +_canLoad = [0, 1] select _canLoad; //convert true/false to scalar + +if ((_canLoad == 1) && {_setSize <= 0}) exitWith { + ACE_LOGERROR("ace_cargo_fnc_makeLoadable (size <= 0) when making loadable"); +}; + +TRACE_2("setVar if different from config",_canLoad,_cfgCanLoad); +if (_canLoad != _cfgCanLoad) then { + _object setVariable [QGVAR(canLoad), _canLoad]; +}; + +TRACE_2("setVar if different from config",_setSize,_curSize); +if (_setSize != _curSize) then { + _object setVariable [QGVAR(size), _setSize]; +}; + +//Add the load actions to the object class if not already added +[_object] call FUNC(initObject); + +nil diff --git a/addons/cargo/functions/fnc_moduleMakeLoadable.sqf b/addons/cargo/functions/fnc_moduleMakeLoadable.sqf new file mode 100644 index 0000000000..bcc6307863 --- /dev/null +++ b/addons/cargo/functions/fnc_moduleMakeLoadable.sqf @@ -0,0 +1,34 @@ +/* + * Author: PabstMirror + * Module to make an object loadable. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * [logic, [box], true] call ace_cargo_fnc_moduleMakeLoadable + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic", "_objects", "_activated"]; +TRACE_3("params",_logic,_objects,_activated); + +if ((isNull _logic) || {!_activated}) exitWith {}; +if (_objects isEqualTo []) exitWith { + ACE_LOGWARNING_1("ace_cargo_fnc_moduleMakeLoadable has no synced objects [%1]", _logic); +}; + +private _canLoad = _logic getVariable ["canLoad", true]; +private _setSize = _logic getVariable ["setSize", 1]; +TRACE_2("settings",_canLoad,_setSize); + +{ + [_x, _canLoad, _setSize] call FUNC(makeLoadable); +} forEach _objects; diff --git a/addons/cargo/functions/fnc_moduleSettings.sqf b/addons/cargo/functions/fnc_moduleSettings.sqf index 2027fb4bbb..c4b6baea3d 100644 --- a/addons/cargo/functions/fnc_moduleSettings.sqf +++ b/addons/cargo/functions/fnc_moduleSettings.sqf @@ -19,7 +19,7 @@ if (!isServer) exitWith {}; -params ["_logic", "_units", "_activated"]; +params ["_logic", "", "_activated"]; if (!_activated) exitWith {}; diff --git a/addons/cargo/functions/fnc_onMenuOpen.sqf b/addons/cargo/functions/fnc_onMenuOpen.sqf index f2abf79100..a045862e36 100644 --- a/addons/cargo/functions/fnc_onMenuOpen.sqf +++ b/addons/cargo/functions/fnc_onMenuOpen.sqf @@ -22,25 +22,24 @@ params ["_display"]; uiNamespace setVariable [QGVAR(menuDisplay), _display]; [{ - private ["_display","_loaded", "_ctrl", "_class", "_label"]; disableSerialization; - _display = uiNamespace getVariable QGVAR(menuDisplay); + private _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 { + 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; + private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; + private _ctrl = _display displayCtrl 100; + private _label = _display displayCtrl 2; lbClear _ctrl; { - _class = if (_x isEqualType "") then {_x} else {typeOf _x}; + private _class = if (_x isEqualType "") then {_x} else {typeOf _x}; _ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName")); true } count _loaded; diff --git a/addons/cargo/functions/fnc_startLoadIn.sqf b/addons/cargo/functions/fnc_startLoadIn.sqf index 091c817f1e..4e1785a6d7 100644 --- a/addons/cargo/functions/fnc_startLoadIn.sqf +++ b/addons/cargo/functions/fnc_startLoadIn.sqf @@ -3,38 +3,46 @@ * Start load item. * * Arguments: - * 0: Object + * 0: Player + * 1: Object * * Return value: - * Object loaded + * Load ProgressBar Started * * Example: - * [object] call ace_cargo_fnc_starLoadIn + * [player, cursorTarget] call ace_cargo_fnc_startLoadIn * * Public: No */ #include "script_component.hpp" params ["_player", "_object"]; -private ["_vehicle", "_size", "_displayName"]; +TRACE_2("params",_player,_object); -_vehicle = [_player] call FUNC(findNearestVehicle); +private _vehicle = [_player] call FUNC(findNearestVehicle); -if (isNull _vehicle || _vehicle isKindOf "Cargo_Base_F") then { +if ((isNull _vehicle) || {_vehicle isKindOf "Cargo_Base_F"}) then { { if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_vehicle = _x}; } forEach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]); }; -if (isNull _vehicle) exitWith {false}; +if (isNull _vehicle) exitWith { + TRACE_3("Could not find vehicle",_player,_object,_vehicle); + false +}; +private _return = false; // Start progress bar if ([_object, _vehicle] call FUNC(canLoadItemIn)) then { - _size = [_object] call FUNC(getSizeItem); + private _size = [_object] call FUNC(getSizeItem); [5 * _size, [_object,_vehicle], "LoadCargo", {}, localize LSTRING(LoadingItem)] call EFUNC(common,progressBar); + _return = true; } else { - _displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName"); + private _displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName"); ["displayTextStructured", [[LSTRING(LoadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent); }; + +_return diff --git a/addons/cargo/functions/fnc_startUnload.sqf b/addons/cargo/functions/fnc_startUnload.sqf index dc49e9d34b..dc97ed2157 100644 --- a/addons/cargo/functions/fnc_startUnload.sqf +++ b/addons/cargo/functions/fnc_startUnload.sqf @@ -15,34 +15,29 @@ */ #include "script_component.hpp" -private ["_display", "_loaded", "_ctrl", "_selected", "_item"]; - disableSerialization; -_display = uiNamespace getVariable QGVAR(menuDisplay); +private _display = uiNamespace getVariable QGVAR(menuDisplay); if (isNil "_display") exitWith {}; -_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; -if (count _loaded == 0) exitWith {}; +private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; +if (_loaded isEqualTo []) exitWith {}; -_ctrl = _display displayCtrl 100; +private _ctrl = _display displayCtrl 100; -_selected = (lbCurSel _ctrl) max 0; +private _selected = (lbCurSel _ctrl) max 0; if (count _loaded <= _selected) exitWith {}; -_item = _loaded select _selected; - +private _item = _loaded select _selected; //This can be an object or a classname string // Start progress bar -private ["_size", "_itemClass", "_displayName"]; +if ([_item, GVAR(interactionVehicle), ACE_player] call FUNC(canUnloadItem)) then { + private _size = [_item] call FUNC(getSizeItem); -if ([_item, GVAR(interactionVehicle)] call FUNC(canUnloadItem)) then { - _size = [_item] call FUNC(getSizeItem); - - [5 * _size, [_item, GVAR(interactionVehicle)], "UnloadCargo", {}, localize LSTRING(UnloadingItem)] call EFUNC(common,progressBar); + [5 * _size, [_item, GVAR(interactionVehicle), ACE_player], "UnloadCargo", {}, localize LSTRING(UnloadingItem), {true}, ["isNotSwimming"]] call EFUNC(common,progressBar); } else { - _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; - _displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); + private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; + private _displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); ["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent); }; diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf index d9e8bf34be..ac125b2dce 100644 --- a/addons/cargo/functions/fnc_unloadItem.sqf +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -16,53 +16,45 @@ */ #include "script_component.hpp" -params ["_item", "_vehicle"]; -private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"]; +params ["_item", "_vehicle", ["_unloader", objNull]]; +TRACE_3("params",_item,_vehicle,_unloader); -if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith { +private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; + +//This covers testing vehicle stability and finding a safe position +private _emptyPosAGL = [_vehicle, _itemClass, _unloader] call EFUNC(common,findUnloadPosition); +TRACE_1("findUnloadPosition",_emptyPosAGL); + +if ((count _emptyPosAGL) != 3) exitWith { + TRACE_4("Could not find unload pos",_vehicle,getPosASL _vehicle,isTouchingGround _vehicle,speed _vehicle); + if ((!isNull _unloader) && {_unloader == ACE_player}) then { + //display text saying there are no safe places to exit the vehicle + ["displayTextStructured", [localize ELSTRING(common,NoRoomToUnload)]] call EFUNC(common,localEvent); + }; false }; -_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; +private _loaded = _vehicle getVariable [QGVAR(loaded), []]; -_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, _itemClass]); // 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, _itemClass]); - }; +if !(_item in _loaded) exitWith { + ACE_LOGERROR_3("Tried to unload item [%1] not in vehicle[%2] cargo[%3]", _item, _vehicle, _loaded); + false }; -TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle); -if (!_validVehiclestate) exitWith {false}; - -if (count _emptyPos == 0) exitWith {false}; - -_loaded = _vehicle getVariable [QGVAR(loaded), []]; _loaded deleteAt (_loaded find _item); _vehicle setVariable [QGVAR(loaded), _loaded, true]; -_space = [_vehicle] call FUNC(getCargoSpaceLeft); -_itemSize = [_item] call FUNC(getSizeItem); +private _space = [_vehicle] call FUNC(getCargoSpaceLeft); +private _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), (_space + _itemSize), true]; if (_item isEqualType objNull) then { detach _item; - _item setPosASL (_emptyPos call EFUNC(common,PositiontoASL)); + _item setPosASL (AGLtoASL _emptyPosAGL); ["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent); } else { - createVehicle [_item, _emptyPos, [], 0, ""]; + private _newItem = createVehicle [_item, _emptyPosAGL, [], 0, ""]; + _newItem setPosASL (AGLtoASL _emptyPosAGL); }; true diff --git a/addons/cargo/functions/fnc_validateCargoSpace.sqf b/addons/cargo/functions/fnc_validateCargoSpace.sqf index d5781067d1..ecb011aed3 100644 --- a/addons/cargo/functions/fnc_validateCargoSpace.sqf +++ b/addons/cargo/functions/fnc_validateCargoSpace.sqf @@ -15,14 +15,13 @@ */ #include "script_component.hpp" -private ["_loaded", "_newLoaded", "_totalSpaceOccupied"]; - params ["_vehicle"]; +TRACE_1("params",_vehicle); -_loaded = _vehicle getVariable [QGVAR(loaded), []]; +private _loaded = _vehicle getVariable [QGVAR(loaded), []]; -_newLoaded = []; -_totalSpaceOccupied = 0; +private _newLoaded = []; +private _totalSpaceOccupied = 0; { if ((_x isEqualType "") || {!isNull _x}) then { _newLoaded pushback _x; diff --git a/addons/cargo/script_component.hpp b/addons/cargo/script_component.hpp index 3f4d6c5d51..55079a16c2 100644 --- a/addons/cargo/script_component.hpp +++ b/addons/cargo/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_CARGO #define DEBUG_MODE_FULL diff --git a/addons/cargo/stringtable.xml b/addons/cargo/stringtable.xml index 65c0ceb433..a7ac525a7b 100644 --- a/addons/cargo/stringtable.xml +++ b/addons/cargo/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -9,6 +9,7 @@ Загрузить Naložit Cargar + Carica Unload @@ -18,6 +19,7 @@ Выгрузить Vyložit Descargar + Scarica Cargo @@ -27,6 +29,7 @@ Грузовой отсек Náklad Carga + Cargo Cargo Menu @@ -36,6 +39,7 @@ Грузовой отсек Menu nákladu Menu de carga + Menù Cargo Cargo space left: %1 @@ -43,8 +47,9 @@ Pozostałe miejsce: %1 Espaço de carga restante: %1 Осталось мест: %1 - Volný prostor: %1 + Zbývající prostor: %1 Espacio de carga restante: %1 + Spazio cargo rimanente: %1 Enable Cargo @@ -54,6 +59,7 @@ Включить модуль перевозки грузов Povolit náklad Habilitar carga + Abilita Cargo Enable the load in cargo module @@ -62,6 +68,8 @@ Ativar o módulo de carregamento de carga Включает модуль погрузки и перевозки грузов Habilitar la carga en el módulo de carga + Umožňuje naložit předměty do nákladového prostoru vozidla + Abilita il modulo di caricamento in cargo Cargo Settings @@ -71,6 +79,7 @@ Перевозка грузов Nastavení nákladu Ajustes de carga + Impostazioni Cargo Configure the cargo module settings @@ -80,6 +89,7 @@ Конфигурирует настройки модуля перевозки грузов Configure los ajustes del módulo de carga Konfigurace nákladního modulu + Configura le impostazioni del modulo cargo %1<br/>loaded into<br/>%2 @@ -107,31 +117,57 @@ Loading Cargo + Belade Carregando carga Ładowanie cargo Nakládám Погрузка + Caricando Unloading Cargo + Entlade Descarregando carga Rozładowywanie cargo Vykládám Выгрузка + Scaricando %1<br/>could not be loaded + %1<br/>konnte nicht eingeladen werden %1<br/>não pode ser carregado %1<br/>nie mógł zostać załadowany %1<br/>nemůže být naloženo %1<br/>не может быть погружен + %1<br/>non può essere caricato %1<br/>could not be unloaded + %1<br/>konnte nicht entladen werden %1<br/>não pode ser descarregado %1<br/>nie mógł zostać rozładowany %1<br/>nemůže být vyloženo %1<br/>не может быть выгружен + %1<br/>non può essere scaricato + + + Make Object Loadable + Füge Objekt zum Frachtsystem hinzu + Ustaw jako ładowalny + Rendi oggetto caricabile + + + Sets the synced object as loadable by the cargo system. + Das synchronisierte Objekt wird dem Frachtsystem hinzugefügt und ist be- und entladbar. + Ustawia zsynchronizowany obiekt jako możliwy do załadowania poprzez system cargo + Imposta l'oggetto sincronizzato come caricabile dal sistema cargo + + + Object's Size + Objektgröße + Rozmiar obiektu + Dimensioni dell'oggetto - \ No newline at end of file + diff --git a/addons/common/CfgEden.hpp b/addons/common/CfgEden.hpp new file mode 100644 index 0000000000..1b833b0342 --- /dev/null +++ b/addons/common/CfgEden.hpp @@ -0,0 +1,11 @@ +class Cfg3DEN { + class Object { + class AttributeCategories { + class ace_attributes { + displayName = CSTRING(Options); + collapsed = 1; + class Attributes {}; + }; + }; + }; +}; diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index bea7b6e7bc..bdfeccd4fa 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -13,6 +19,12 @@ class Extended_PostInit_EventHandlers { }; }; +class Extended_DisplayLoad_EventHandlers { + class RscDisplayMission { + ADDON = QUOTE(_this call COMPILE_FILE(XEH_mainDislayLoad)); + }; +}; + class Extended_InitPost_EventHandlers { class All { class GVAR(executePersistent) { @@ -23,9 +35,6 @@ class Extended_InitPost_EventHandlers { class GVAR(setName) { init = QUOTE(if (local (_this select 0)) then {_this call FUNC(setName)};); }; - class GVAR(forceWalk) { - init = QUOTE(_this call FUNC(applyForceWalkStatus)); - }; class GVAR(muteUnit) { init = QUOTE(_this call FUNC(muteUnitHandleInitPost)); }; @@ -43,6 +52,9 @@ class Extended_Respawn_EventHandlers { class GVAR(RESETDefaults) { respawn = QUOTE(_this call FUNC(resetAllDefaults)); }; + class GVAR(statusEffect) { + respawn = QUOTE(_this call FUNC(statusEffect_respawnEH)); + }; }; class CAManBase { class GVAR(muteUnit) { @@ -50,3 +62,17 @@ class Extended_Respawn_EventHandlers { }; }; }; + +class Extended_Local_EventHandlers { + class All { + class GVAR(statusEffect) { + local = QUOTE(_this call FUNC(statusEffect_localEH)); + }; + }; +}; + +class Extended_FiredBIS_EventHandlers { + class All { + ADDON = QUOTE(_this call FUNC(firedEH)); + }; +}; diff --git a/addons/common/CfgLocationTypes.hpp b/addons/common/CfgLocationTypes.hpp new file mode 100644 index 0000000000..8ff7ba8674 --- /dev/null +++ b/addons/common/CfgLocationTypes.hpp @@ -0,0 +1,16 @@ +//Create a location type that won't be drawn on the map +//Ref: https://community.bistudio.com/wiki/Location + +class CfgLocationTypes { + class ACE_HashLocation { + color[] = {0,0,0,0}; + drawStyle = "bananas"; + font = "PuristaMedium"; + importance = 5; + name = "HashLocation"; + shadow = 0; + size = 0; + textSize = 0.0; + texture = ""; + }; +}; diff --git a/addons/common/CfgWeapons.hpp b/addons/common/CfgWeapons.hpp index aa905bb3e6..22075e2903 100644 --- a/addons/common/CfgWeapons.hpp +++ b/addons/common/CfgWeapons.hpp @@ -13,7 +13,7 @@ class CfgWeapons { }; class ACE_FakePrimaryWeapon: Rifle_Base_F { - scope = 2; + scope = 1; scopeCurator = 1; scopeArsenal = 1; displayName = ""; diff --git a/addons/common/RscInfoType.hpp b/addons/common/RscInfoType.hpp index 4d94f8ae2c..327a9814d1 100644 --- a/addons/common/RscInfoType.hpp +++ b/addons/common/RscInfoType.hpp @@ -1,7 +1,7 @@ class RscInGameUI { class RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); }; class RscUnitInfoNoHUD { @@ -9,19 +9,19 @@ class RscInGameUI { }; class RscUnitInfoSoldier: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgSoldier', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Soldier')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgSoldier', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Soldier')])] call FUNC(localEvent);); }; class RscUnitInfoTank: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgVehicle', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Vehicle')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgVehicle', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Vehicle')])] call FUNC(localEvent);); }; class RscUnitInfoAirNoWeapon: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); }; class RscUnitInfoAir: RscUnitInfoAirNoWeapon { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); }; class RscUnitInfo_AH64D_gunner { @@ -33,11 +33,11 @@ class RscInGameUI { }; class RscUnitInfoSubmarine: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgSubmarine', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Submarine')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgSubmarine', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Submarine')])] call FUNC(localEvent);); }; class RscUnitInfoShip: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgShip', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Ship')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgShip', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Ship')])] call FUNC(localEvent);); }; class RscWeaponEmpty { @@ -97,7 +97,7 @@ class RscInGameUI { }; class RscUnitInfoParachute: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable [ARR_2('ACE_dlgParachute', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Parachute')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgParachute', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Parachute')])] call FUNC(localEvent);); }; class RscUnitVehicle { @@ -112,25 +112,3 @@ class RscInGameUI { onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscStaminaBar"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2(QUOTE(QGVAR(dlgStaminaBar)),_this select 0)]); }; }; - -class RscDisplayInventory { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDisplayInventory"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; [ARR_2('inventoryDisplayLoaded', _this)] call FUNC(localEvent);); -}; - -// map -class RscDisplayMainMap { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Ingame')])] call FUNC(localEvent);); -}; - -class RscDisplayGetReady: RscDisplayMainMap { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Briefing')])] call FUNC(localEvent);); -}; - -class RscDisplayServerGetReady: RscDisplayGetReady { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ServerBriefing')])] call FUNC(localEvent);); -}; - - -class RscDisplayClientGetReady: RscDisplayGetReady { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ClientBriefing')])] call FUNC(localEvent);); -}; diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp new file mode 100644 index 0000000000..dbc7e39f48 --- /dev/null +++ b/addons/common/XEH_PREP.hpp @@ -0,0 +1,284 @@ + +PREP(addCanInteractWithCondition); +PREP(addLineToDebugDraw); +PREP(addSetting); +PREP(addToInventory); +PREP(assignedItemFix); +PREP(assignObjectsInList); +PREP(ambientBrightness); +PREP(ASLToPosition); +PREP(binarizeNumber); +PREP(blurScreen); +PREP(cachedCall); +PREP(canGetInPosition); +PREP(canInteractWith); +PREP(changeProjectileDirection); +PREP(checkFiles); +PREP(checkPBOs); +PREP(claim); +PREP(codeToString); +PREP(createOrthonormalReference); +PREP(currentChannel); +PREP(debug); +PREP(debugModule); +PREP(defineVariable); +PREP(deviceKeyFindValidIndex); +PREP(deviceKeyRegisterNew); +PREP(disableAI); +PREP(disableUserInput); +PREP(displayIcon); +PREP(displayText); +PREP(displayTextPicture); +PREP(displayTextStructured); +PREP(doAnimation); +PREP(dropBackpack); +PREP(endRadioTransmission); +PREP(eraseCache); +PREP(errorMessage); +PREP(execNextFrame); +PREP(execPersistentFnc); +PREP(execRemoteFnc); +PREP(executePersistent); +PREP(filter); +PREP(findUnloadPosition); +PREP(firedEH); +PREP(fixCollision); +PREP(fixFloating); +PREP(fixLoweredRifleAnimation); +PREP(fixPosition); +PREP(getAllDefinedSetVariables); +PREP(getAllGear); +PREP(getDeathAnim); +PREP(getCaptivityStatus); +PREP(getDefaultAnim); +PREP(getDefinedVariable); +PREP(getDefinedVariableDefault); +PREP(getDefinedVariableInfo); +PREP(getFirstObjectIntersection); +PREP(getFirstTerrainIntersection); +PREP(getForceWalkStatus); +PREP(getGunner); +PREP(getInPosition); +PREP(getMapGridData); +PREP(getMapGridFromPos); +PREP(getMapPosFromGrid); +PREP(getMarkerType); +PREP(getMGRSdata); +PREP(getName); +PREP(getNumberFromMissionSQM); +PREP(getNumberMagazinesIn); +PREP(getPitchBankYaw); +PREP(getSettingData); +PREP(getStaminaBarControl); +PREP(getStringFromMissionSQM); +PREP(getTargetAzimuthAndInclination); +PREP(getTargetDistance); +PREP(getTargetObject); +PREP(getTurnedOnLights); +PREP(getTurretDirection); +PREP(getUavControlPosition); +PREP(getVehicleCargo); +PREP(getVehicleCodriver); +PREP(getVersion); +PREP(getWeaponAzimuthAndInclination); +PREP(getWeaponIndex); +PREP(getWeaponState); +PREP(getWindDirection); +PREP(getZoom); +PREP(goKneeling); +PREP(hadamardProduct); +PREP(handleModifierKey); +PREP(handleModifierKeyUp); +PREP(handleScrollWheel); +PREP(hasItem); +PREP(hasMagazine); +PREP(headBugFix); +PREP(hideUnit); +PREP(insertionSort); +PREP(interpolateFromArray); +PREP(inTransitionAnim); +PREP(isAutoWind); +PREP(isAwake); +PREP(isEngineer); +PREP(isEOD); +PREP(isFeatureCameraActive); +PREP(isInBuilding); +PREP(isModLoaded); +PREP(isPlayer); +PREP(isUnderwater); +PREP(lightIntensityFromObject); +PREP(loadPerson); +PREP(loadPersonLocal); +PREP(loadSettingsFromProfile); +PREP(loadSettingsOnServer); +PREP(loadSettingsLocalizedText); +PREP(map); +PREP(moduleCheckPBOs); +PREP(moduleLSDVehicles); +PREP(muteUnit); +PREP(muteUnitHandleInitPost); +PREP(muteUnitHandleRespawn); +PREP(numberToDigits); +PREP(numberToDigitsString); +PREP(numberToString); +PREP(onAnswerRequest); +PREP(owned); +PREP(parseList); +PREP(player); +PREP(playerSide); +PREP(positionToASL); +PREP(progressBar); +PREP(readSettingFromModule); +PREP(readSettingsFromParamsArray); +PREP(receiveRequest); +PREP(removeCanInteractWithCondition); +PREP(removeSpecificMagazine); +PREP(requestCallback); +PREP(resetAllDefaults); +PREP(restoreVariablesJIP); +PREP(runAfterSettingsInit); +PREP(sanitizeString); +PREP(sendRequest); +PREP(serverLog); +PREP(setAllGear); +PREP(setApproximateVariablePublic); +PREP(setCaptivityStatus); +PREP(setDefinedVariable); +PREP(setDisableUserInputStatus); +PREP(setForceWalkStatus); +PREP(setHearingCapability); +PREP(setName); +PREP(setParameter); +PREP(setPitchBankYaw); +PREP(setProne); +PREP(setSetting); +PREP(setSettingFromConfig); +PREP(setVariableJIP); +PREP(setVariablePublic); +PREP(setVolume); +PREP(showHud); +PREP(statusEffect_addType); +PREP(statusEffect_get); +PREP(statusEffect_localEH); +PREP(statusEffect_resetVariables); +PREP(statusEffect_respawnEH); +PREP(statusEffect_sendEffects); +PREP(statusEffect_set); +PREP(stringCompare); +PREP(stringToColoredText); +PREP(stringRemoveWhiteSpace); +PREP(switchToGroupSide); +PREP(throttledPublicVariable); +PREP(toBin); +PREP(toBitmask); +PREP(toHex); +PREP(toNumber); +PREP(unhideUnit); +PREP(uniqueElements); +PREP(unloadPerson); +PREP(unloadPersonLocal); +PREP(unmuteUnit); +PREP(useItem); +PREP(useMagazine); +PREP(waitAndExecute); +PREP(waitUntilAndExecute); +PREP(waveHeightAt); + +PREP(translateToWeaponSpace); +PREP(translateToModelSpace); + +// Model and drawing helpers +PREP(worldToScreenBounds); + +// config items +PREP(getConfigType); +PREP(getItemType); +PREP(getWeaponType); +PREP(getWeaponModes); +PREP(getWeaponMuzzles); + +// config objects +PREP(getConfigTypeObject); +PREP(getConfigGunner); +PREP(getConfigCommander); +PREP(getSelectionsWithoutHitPoints); +PREP(getReflectorsWithSelections); +PREP(getLightProperties); +PREP(getLightPropertiesWeapon); +PREP(getVehicleCrew); +PREP(getVehicleUAVCrew); + +// turrets +PREP(getTurrets); +PREP(getTurretIndex); +PREP(getTurretConfigPath); +PREP(getTurretGunner); +PREP(getTurretCommander); +PREP(getTurretCopilot); +PREP(getDoorTurrets); +PREP(getTurretsFFV); +PREP(getTurretsOther); +PREP(hasHatch); + +// missing inventory commands +PREP(binocularMagazine); +PREP(removeBinocularMagazine); + +// ACE_Debug +PREP(exportConfig); +PREP(getChildren); +PREP(getDisplayConfigName); +PREP(monitor); +PREP(showUser); + +PREP(dumpPerformanceCounters); +PREP(dumpArray); + +// ACE_CuratorFix +PREP(addCuratorUnloadEventhandler); +PREP(fixCrateContent); + +PREP(globalEvent); +PREP(_handleNetEvent); +PREP(addEventHandler); +PREP(targetEvent); +PREP(serverEvent); +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); +PREP(addScrollWheelEventHandler); +PREP(addMapMarkerCreatedEventHandler); + +PREP(removeActionEventHandler); +PREP(removeActionMenuEventHandler); +PREP(removeScrollWheelEventHandler); +PREP(removeMapMarkerCreatedEventHandler); + +// hashes +PREP(hashCreate); +PREP(hashSet); +PREP(hashGet); +PREP(hashHasKey); +PREP(hashRem); +PREP(hashListCreateList); +PREP(hashListCreateHash); +PREP(hashListSelect); +PREP(hashListSet); +PREP(hashListPush); + +PREP(timePFH); diff --git a/addons/common/XEH_mainDislayLoad.sqf b/addons/common/XEH_mainDislayLoad.sqf new file mode 100644 index 0000000000..57ace32f94 --- /dev/null +++ b/addons/common/XEH_mainDislayLoad.sqf @@ -0,0 +1,6 @@ +#include "script_component.hpp" + +GVAR(ScrollWheelFrame) = diag_frameno; + +call COMPILE_FILE(init_handleScrollWheel); +call COMPILE_FILE(init_handleModifierKey); diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 05302869f2..8bda027d1f 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -1,5 +1,6 @@ // ACE - Common // #define ENABLE_PERFORMANCE_COUNTERS +// #define DEBUG_MODE_FULL #include "script_component.hpp" @@ -57,6 +58,39 @@ // Eventhandlers ////////////////////////////////////////////////// +//Status Effect EHs: +["setStatusEffect", {_this call FUNC(statusEffect_set)}] call FUNC(addEventHandler); +["forceWalk", false, ["ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_dragging"]] call FUNC(statusEffect_addType); +["blockSprint", false, []] call FUNC(statusEffect_addType); +["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), QEGVAR(medical,unconscious)]] call FUNC(statusEffect_addType); +["blockDamage", false, ["fixCollision"]] call FUNC(statusEffect_addType); + +["forceWalk", { + params ["_object", "_set"]; + TRACE_2("forceWalk EH",_object,_set); + _object forceWalk (_set > 0); +}] call FUNC(addEventHandler); +["blockSprint", { //Name reversed from `allowSprint` because we want NOR logic + params ["_object", "_set"]; + TRACE_2("blockSprint EH",_object,_set); + _object allowSprint (_set == 0); +}] call FUNC(addEventHandler); +["setCaptive", { + params ["_object", "_set"]; + TRACE_2("setCaptive EH",_object,_set); + _object setCaptive (_set > 0); +}] call FUNC(addEventHandler); +["blockDamage", { //Name reversed from `allowDamage` because we want NOR logic + params ["_object", "_set"]; + if ((_object isKindOf "CAManBase") && {(["ace_medical"] call FUNC(isModLoaded))}) then { + TRACE_2("blockDamage EH (using medical)",_object,_set); + _object setvariable [QEGVAR(medical,allowDamage), (_set == 0), true]; + } else { + TRACE_2("blockDamage EH (using allowDamage)",_object,_set); + _object allowDamage (_set == 0); + }; +}] call FUNC(addEventHandler); + //Add a fix for BIS's zeus remoteControl module not reseting variables on DC when RC a unit //This variable is used for isPlayer checks if (isServer) then { @@ -80,8 +114,7 @@ if (isServer) then { params ["_name", "_value", "_force"]; if (_force) then { - private "_settingData"; - _settingData = [_name] call FUNC(getSettingData); + private _settingData = [_name] call FUNC(getSettingData); if (_settingData isEqualTo []) exitWith {}; @@ -162,10 +195,8 @@ QGVAR(remoteFnc) addPublicVariableEventHandler { // Check files, previous installed version etc. ////////////////////////////////////////////////// -private ["_currentVersion", "_previousVersion"]; - -_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version"); -_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""]; +private _currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version"); +private _previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""]; // check previous version number from profile if (_currentVersion != _previousVersion) then { @@ -220,7 +251,7 @@ call FUNC(checkFiles); // Publish all settings data after all configs and modules are read publicVariable QGVAR(settings); }; - + // Load user settings from profile if (hasInterface) then { call FUNC(loadSettingsFromProfile); @@ -259,32 +290,6 @@ if (!hasInterface) exitWith {}; call FUNC(assignedItemFix); -GVAR(ScrollWheelFrame) = diag_frameno; - -["mainDisplayLoaded", { - [{ - 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; @@ -311,17 +316,6 @@ enableCamShake true; // Set up numerous eventhanders for player controlled units ////////////////////////////////////////////////// -//CBA has events for zeus's display onLoad and onUnload (Need to delay a frame for display to be ready) -private _zeusDisplayChangedFNC = { - [{ - private _data = !(isNull findDisplay 312); - ["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent); - }, []] call FUNC(execNextFrame); -}; -["CBA_curatorOpened", _zeusDisplayChangedFNC] call CBA_fnc_addEventHandler; -["CBA_curatorClosed", _zeusDisplayChangedFNC] call CBA_fnc_addEventHandler; - - // default variables GVAR(OldPlayerVehicle) = vehicle objNull; GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex); @@ -344,7 +338,7 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { BEGIN_COUNTER(stateChecker); // "playerChanged" event - private _data = call FUNC(player); // reuse one variable to reduce number of variables that have to be set to private each frame + private _data = call FUNC(player); if !(_data isEqualTo ACE_player) then { private _oldPlayer = ACE_player; @@ -411,14 +405,6 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { ["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); - }; - // "activeCameraChanged" event _data = call FUNC(isfeatureCameraActive); if !(_data isEqualTo GVAR(OldIsCamera)) then { @@ -435,9 +421,6 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { // 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); @@ -449,6 +432,8 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { }; }] call FUNC(addEventhandler); +["useItem", DFUNC(useItem)] call FUNC(addEventHandler); + ////////////////////////////////////////////////// // Add various canInteractWith conditions diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 8073b9345b..20b3692b9f 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -3,295 +3,22 @@ ADDON = false; -PREP(addCanInteractWithCondition); -PREP(addLineToDebugDraw); -PREP(addSetting); -PREP(addToInventory); -PREP(assignedItemFix); -PREP(assignObjectsInList); -PREP(ambientBrightness); -PREP(applyForceWalkStatus); -PREP(ASLToPosition); -PREP(binarizeNumber); -PREP(blurScreen); -PREP(cachedCall); -PREP(canGetInPosition); -PREP(canInteractWith); -PREP(canUseWeapon); -PREP(changeProjectileDirection); -PREP(checkFiles); -PREP(checkPBOs); -PREP(claim); -PREP(codeToLetter); -PREP(codeToString); -PREP(createOrthonormalReference); -PREP(currentChannel); -PREP(debug); -PREP(debugModule); -PREP(defineVariable); -PREP(deviceKeyFindValidIndex); -PREP(deviceKeyRegisterNew); -PREP(disableAI); -PREP(disableUserInput); -PREP(displayIcon); -PREP(displayText); -PREP(displayTextPicture); -PREP(displayTextStructured); -PREP(doAnimation); -PREP(dropBackpack); -PREP(endRadioTransmission); -PREP(eraseCache); -PREP(errorMessage); -PREP(execNextFrame); -PREP(execPersistentFnc); -PREP(execRemoteFnc); -PREP(executePersistent); -PREP(filter); -PREP(fixCollision); -PREP(fixFloating); -PREP(fixLoweredRifleAnimation); -PREP(fixPosition); -PREP(getAllDefinedSetVariables); -PREP(getAllGear); -PREP(getCaptivityStatus); -PREP(getDeathAnim); -PREP(getDefaultAnim); -PREP(getDefinedVariable); -PREP(getDefinedVariableDefault); -PREP(getDefinedVariableInfo); -PREP(getFirstObjectIntersection); -PREP(getFirstTerrainIntersection); -PREP(getForceWalkStatus); -PREP(getGunner); -PREP(getInPosition); -PREP(getMapGridData); -PREP(getMapGridFromPos); -PREP(getMapPosFromGrid); -PREP(getMarkerType); -PREP(getMGRSdata); -PREP(getName); -PREP(getNumberFromMissionSQM); -PREP(getNumberMagazinesIn); -PREP(getPitchBankYaw); -PREP(getSettingData); -PREP(getStaminaBarControl); -PREP(getStringFromMissionSQM); -PREP(getTargetAzimuthAndInclination); -PREP(getTargetDistance); -PREP(getTargetObject); -PREP(getTurnedOnLights); -PREP(getTurretDirection); -PREP(getUavControlPosition); -PREP(getVehicleCargo); -PREP(getVehicleCodriver); -PREP(getVersion); -PREP(getWeaponAzimuthAndInclination); -PREP(getWeaponIndex); -PREP(getWeaponState); -PREP(getWindDirection); -PREP(getZoom); -PREP(goKneeling); -PREP(hadamardProduct); -PREP(handleModifierKey); -PREP(handleModifierKeyUp); -PREP(handleModifierKeyInit); -PREP(handleScrollWheel); -PREP(handleScrollWheelInit); -PREP(hasItem); -PREP(hasMagazine); -PREP(headBugFix); -PREP(hideUnit); -PREP(inheritsFrom); -PREP(insertionSort); -PREP(interpolateFromArray); -PREP(inTransitionAnim); -PREP(inWater); -PREP(isAlive); -PREP(isAutoWind); -PREP(isAwake); -PREP(isEngineer); -PREP(isEOD); -PREP(isFeatureCameraActive); -PREP(isInBuilding); -PREP(isModLoaded); -PREP(isPlayer); -PREP(isTurnedOut); -PREP(isUnderwater); -PREP(letterToCode); -PREP(lightIntensityFromObject); -PREP(loadPerson); -PREP(loadPersonLocal); -PREP(loadSettingsFromProfile); -PREP(loadSettingsOnServer); -PREP(loadSettingsLocalizedText); -PREP(map); -PREP(moduleCheckPBOs); -PREP(moduleLSDVehicles); -PREP(muteUnit); -PREP(muteUnitHandleInitPost); -PREP(muteUnitHandleRespawn); -PREP(numberToDigits); -PREP(numberToDigitsString); -PREP(numberToString); -PREP(onAnswerRequest); -PREP(owned); -PREP(parseList); -PREP(player); -PREP(playerSide); -PREP(positionToASL); -PREP(progressBar); -PREP(readSettingFromModule); -PREP(readSettingsFromParamsArray); -PREP(receiveRequest); -PREP(removeCanInteractWithCondition); -PREP(removeSpecificMagazine); -PREP(requestCallback); -PREP(resetAllDefaults); -PREP(restoreVariablesJIP); -PREP(runAfterSettingsInit); -PREP(sanitizeString); -PREP(selectWeaponMode); -PREP(sendRequest); -PREP(serverLog); -PREP(setAllGear); -PREP(setCaptivityStatus); -PREP(setDefinedVariable); -PREP(setDisableUserInputStatus); -PREP(setForceWalkStatus); -PREP(setHearingCapability); -PREP(setName); -PREP(setParameter); -PREP(setPitchBankYaw); -PREP(setProne); -PREP(setSetting); -PREP(setSettingFromConfig); -PREP(setVariableJIP); -PREP(setVariablePublic); -PREP(setVolume); -PREP(sortAlphabeticallyBy); -PREP(showHud); -PREP(stringCompare); -PREP(stringToColoredText); -PREP(stringRemoveWhiteSpace); -PREP(switchToGroupSide); -PREP(throttledPublicVariable); -PREP(toBin); -PREP(toBitmask); -PREP(toHex); -PREP(toNumber); -PREP(unhideUnit); -PREP(uniqueElements); -PREP(uniqueElementsOnly); -PREP(unloadPerson); -PREP(unloadPersonLocal); -PREP(unmuteUnit); -PREP(useItem); -PREP(useMagazine); -PREP(waitAndExecute); -PREP(waitUntilAndExecute); -PREP(waveHeightAt); - -PREP(translateToWeaponSpace); -PREP(translateToModelSpace); - -// Model and drawing helpers -PREP(worldToScreenBounds); - -// config items -PREP(getConfigType); -PREP(getItemType); -PREP(getWeaponType); -PREP(getWeaponModes); -PREP(getWeaponMuzzles); - -// config objects -PREP(getConfigTypeObject); -PREP(getConfigGunner); -PREP(getConfigCommander); -PREP(getHitPoints); -PREP(getHitPointsWithSelections); -PREP(getSelectionsWithoutHitPoints); -PREP(getReflectorsWithSelections); -PREP(getLightProperties); -PREP(getLightPropertiesWeapon); -PREP(getVehicleCrew); -PREP(getVehicleUAVCrew); - -// turrets -PREP(getTurrets); -PREP(getTurretIndex); -PREP(getTurretConfigPath); -PREP(getTurretGunner); -PREP(getTurretCommander); -PREP(getTurretCopilot); -PREP(getDoorTurrets); -PREP(getTurretsFFV); -PREP(getTurretsOther); -PREP(hasHatch); - -// missing inventory commands -PREP(binocularMagazine); -PREP(removeBinocularMagazine); - -// ACE_Debug -PREP(exportConfig); -PREP(getChildren); -PREP(getDisplayConfigName); -PREP(monitor); -PREP(showUser); - -PREP(dumpPerformanceCounters); -PREP(dumpArray); - -// ACE_CuratorFix -PREP(addCuratorUnloadEventhandler); -PREP(fixCrateContent); +#include "XEH_PREP.hpp" //ACE events global variables -GVAR(events) = [[],[]]; +GVAR(eventsLocation) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; +GVAR(eventsLocation) setText QGVAR(eventsLocation); -PREP(globalEvent); -PREP(_handleNetEvent); -PREP(addEventHandler); -PREP(targetEvent); -PREP(serverEvent); -PREP(localEvent); -PREP(removeEventHandler); -PREP(removeAlLEventHandlers); +// backwards comp +DFUNC(canUseWeapon) = { + ACE_DEPRECATED("ace_common_fnc_canUseWeapon","3.7.0","CBA_fnc_canUseWeapon"); + _this call CBA_fnc_canUseWeapon; +}; -// Synchronized Events -PREP(syncedEventPFH); -PREP(addSyncedEventHandler); -PREP(removeSyncedEventHandler); -PREP(requestSyncedEvent); -PREP(syncedEvent); - -PREP(_handleSyncedEvent); -PREP(_handleRequestSyncedEvent); -PREP(_handleRequestAllSyncedEvents); - -// other eventhandlers -PREP(addActionEventHandler); -PREP(addActionMenuEventHandler); -PREP(addScrollWheelEventHandler); -PREP(addMapMarkerCreatedEventHandler); - -PREP(removeActionEventHandler); -PREP(removeActionMenuEventHandler); -PREP(removeScrollWheelEventHandler); -PREP(removeMapMarkerCreatedEventHandler); - -// hashes -PREP(hashCreate); -PREP(hashSet); -PREP(hashGet); -PREP(hashHasKey); -PREP(hashRem); -PREP(hashListCreateList); -PREP(hashListCreateHash); -PREP(hashListSelect); -PREP(hashListSet); -PREP(hashListPush); +DFUNC(selectWeaponMode) = { + ACE_DEPRECATED("ace_common_fnc_selectWeaponMode","3.7.0","CBA_fnc_selectWeapon"); + _this call CBA_fnc_selectWeapon; +}; GVAR(syncedEvents) = HASH_CREATE; GVAR(showHudHash) = [] call FUNC(hashCreate); @@ -316,6 +43,8 @@ if (isServer) then { call FUNC(loadSettingsOnServer); }; +GVAR(statusEffect_Names) = []; +GVAR(statusEffect_isGlobal) = []; ////////////////////////////////////////////////// // Set up PlayerChanged eventhandler for pre init @@ -329,8 +58,7 @@ 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; + private _oldPlayer = ACE_player; ACE_player = call FUNC(player); uiNamespace setVariable ["ACE_player", ACE_player]; @@ -354,7 +82,6 @@ ACE_gameTime = time; ACE_pausedTime = 0; ACE_virtualPausedTime = 0; -PREP(timePFH); [FUNC(timePFH), 0, []] call CBA_fnc_addPerFrameHandler; // Init toHex diff --git a/addons/common/XEH_preStart.sqf b/addons/common/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/common/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/common/config.cpp b/addons/common/config.cpp index c38c3fd3e7..cbe5c5df6a 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -8,12 +8,13 @@ class CfgPatches { requiredAddons[] = {"ace_main","ace_modules"}; author[] = {"KoffeinFlummi"}; authorUrl = "https://github.com/KoffeinFlummi/"; - VERSION_CONFIG; + VERSION_CONFIG_COMMON; }; }; #include "CfgEventHandlers.hpp" +#include "CfgLocationTypes.hpp" #include "CfgSounds.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" @@ -23,6 +24,7 @@ class CfgPatches { #include "CfgMoves.hpp" #include "CfgVoice.hpp" #include "CfgUnitInsignia.hpp" +#include "CfgEden.hpp" class ACE_Rsc_Display_Base { idd = -1; @@ -78,20 +80,12 @@ class CfgUIGrids { displayName = "ACE Hint"; description = "Textual in game feedback to the player."; preview = "\a3\Ui_f\data\GUI\Cfg\UIGrids\grid_hint_ca.paa"; - saveToProfile[] = {0,1}; + saveToProfile[] = {0,1}; }; }; }; }; -/* -// check dll -class RscStandardDisplay; -class RscDisplayMain: RscStandardDisplay { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDisplayMain"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); [ARR_5('header','tail',{0},{},_this select 0)] call COMPILE_FILE(functions\fnc_errorMessage)); -}; -*/ - class ACE_Extensions { extensions[] = {}; }; diff --git a/addons/common/functions/fnc__handleNetEvent.sqf b/addons/common/functions/fnc__handleNetEvent.sqf index e409afe6a3..54cef66228 100644 --- a/addons/common/functions/fnc__handleNetEvent.sqf +++ b/addons/common/functions/fnc__handleNetEvent.sqf @@ -17,14 +17,8 @@ params ["_eventType", "_event"]; if (_eventType == "ACEg") then { _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; + private _eventFunctions = GVAR(eventsLocation) getVariable _eventName; + if (!isNil "_eventFunctions") then { #ifdef DEBUG_EVENTS ACE_LOGINFO_1("* Net Event %1",_eventName); @@ -38,7 +32,7 @@ if (_eventType == "ACEg") then { ACE_LOGINFO_1(" ID: %1",_forEachIndex); #endif }; - } forEach _events; + } forEach _eventFunctions; }; }; @@ -46,9 +40,8 @@ if (_eventType == "ACEc") then { if (isServer) then { _event params ["_eventName", "_eventTargets", "_eventArgs"]; - private ["_sentEvents", "_owner", "_serverFlagged"]; + private _sentEvents = []; - _sentEvents = []; if (!IS_ARRAY(_eventTargets)) then { _eventTargets = [_eventTargets]; }; @@ -59,9 +52,11 @@ if (_eventType == "ACEc") then { ["ACEg", ACEg] call FUNC(_handleNetEvent); }; - _serverFlagged = false; + private _serverFlagged = false; + { - _owner = _x; + private _owner = _x; + if (IS_OBJECT(_x)) then { _owner = owner _x; }; diff --git a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf index 4e755562b5..8c8cbd1486 100644 --- a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf +++ b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf @@ -15,10 +15,8 @@ params ["_client"]; { - private ["_eventEntry", "_eventLog"]; - - _eventEntry = HASH_GET(GVAR(syncedEvents),_x); - _eventLog = _eventEntry select 1; + private _eventEntry = HASH_GET(GVAR(syncedEvents),_x); + _eventEntry params ["", "_eventLog"]; ["SEH_s", _client, [_x, _eventLog]] call FUNC(targetEvent); false diff --git a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf index d4d9b2cf76..605af2fa85 100644 --- a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf @@ -27,10 +27,8 @@ if (isServer) then { false }; - private ["_eventEntry", "_eventLog"]; - - _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); - _eventLog = _eventEntry select 1; + private _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); + _eventEntry params ["", "_eventLog"]; ["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent); } else { diff --git a/addons/common/functions/fnc__handleSyncedEvent.sqf b/addons/common/functions/fnc__handleSyncedEvent.sqf index a14ee2680e..f8fe21d760 100644 --- a/addons/common/functions/fnc__handleSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleSyncedEvent.sqf @@ -5,7 +5,7 @@ * Arguments [Client] : * 0: eventName * 1: arguments - * 2: ttl + * 2: ttl * * Return Value: * Boolean of success @@ -21,20 +21,17 @@ if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { false }; -private ["_internalData", "_eventCode"]; - -_internalData = HASH_GET(GVAR(syncedEvents),_name); +private _internalData = HASH_GET(GVAR(syncedEvents),_name); if (isServer) then { // Server needs to internally log it for synchronization if (_ttl > -1) then { _internalData = HASH_GET(GVAR(syncedEvents),_name); - private "_eventLog"; - _eventLog = _internalData select 1; + _internalData params ["", "_eventLog"]; _eventLog pushBack [ACE_diagTime, _args, _ttl]; }; }; -_eventCode = _internalData select 0; +_internalData params ["_eventCode"]; _args call _eventCode; diff --git a/addons/common/functions/fnc_addActionEventHandler.sqf b/addons/common/functions/fnc_addActionEventHandler.sqf index ae04933cdd..fe641010e4 100644 --- a/addons/common/functions/fnc_addActionEventHandler.sqf +++ b/addons/common/functions/fnc_addActionEventHandler.sqf @@ -25,10 +25,8 @@ if (_statement isEqualType "") then { _statement = compile _statement; }; -private ["_name", "_actionsVar"]; - -_name = format ["ACE_Action_%1", _action]; -_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; +private _name = format ["ACE_Action_%1", _action]; +private _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]; @@ -44,8 +42,7 @@ _actions pushBack [_condition, _statement]; // first action to add, unit needs addAction command if (_actionID == -1) then { - private "_addAction"; - _addAction = call compile format [ + private _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)}, diff --git a/addons/common/functions/fnc_addActionMenuEventHandler.sqf b/addons/common/functions/fnc_addActionMenuEventHandler.sqf index d9beb977f7..e68507ae7b 100644 --- a/addons/common/functions/fnc_addActionMenuEventHandler.sqf +++ b/addons/common/functions/fnc_addActionMenuEventHandler.sqf @@ -37,23 +37,19 @@ if (_statement2 isEqualType "") then { _statement2 = compile _statement2; }; -private ["_name", "_actionsVar"]; - -_name = format ["ACE_ActionMenu_%1", _action]; -_actionsVar = _unit getVariable [_name, [-1, [], []]]; +private _name = format ["ACE_ActionMenu_%1", _action]; +private _actionsVar = _unit getVariable [_name, [-1, [], []]]; _actionsVar params ["_id", "_actionIDs", "_actions"]; _id = _id + 1; -private ["_nameVar", "_addAction", "_actionID"]; - -_nameVar = format ["%1_ID%2", _name, _id]; +private _nameVar = format ["%1_ID%2", _name, _id]; missionNamespace setVariable [_nameVar, [_condition, _statement, _condition2, _statement2]]; _actionIDs pushBack _id; -_addAction = call compile format [ +private _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)}}, @@ -70,7 +66,7 @@ _addAction = call compile format [ _priority ]; -_actionID = _unit addAction _addAction; +private _actionID = _unit addAction _addAction; _actions pushBack [_actionID, _nameVar]; diff --git a/addons/common/functions/fnc_addCanInteractWithCondition.sqf b/addons/common/functions/fnc_addCanInteractWithCondition.sqf index 740fa9bb9f..294dac1c72 100644 --- a/addons/common/functions/fnc_addCanInteractWithCondition.sqf +++ b/addons/common/functions/fnc_addCanInteractWithCondition.sqf @@ -17,12 +17,10 @@ params ["_conditionName", "_conditionFunc"]; _conditionName = toLower _conditionName; -private ["_conditions", "_index"]; - -_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; +private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; _conditions params ["_conditionNames", "_conditionFuncs"]; -_index = _conditionNames find _conditionName; +private _index = _conditionNames find _conditionName; if (_index == -1) then { _index = count _conditionNames; diff --git a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf index c739177288..1bb92130bc 100644 --- a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf +++ b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf @@ -13,8 +13,7 @@ disableSerialization; -private "_dlg"; -_dlg = ctrlParent _this; +private _dlg = ctrlParent _this; _dlg displayAddEventHandler ["unload", { if (_this select 1 == 1) then { diff --git a/addons/common/functions/fnc_addEventHandler.sqf b/addons/common/functions/fnc_addEventHandler.sqf index 599e937918..e7df00f5ff 100644 --- a/addons/common/functions/fnc_addEventHandler.sqf +++ b/addons/common/functions/fnc_addEventHandler.sqf @@ -15,20 +15,11 @@ params ["_eventName", "_eventCode"]; -private ["_eventNames", "_eventFunctions", "_eventIndex"]; +private _eventFunctions = GVAR(eventsLocation) getVariable _eventName; -_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]; +if (isNil "_eventFunctions") then { + _eventFunctions = []; + GVAR(eventsLocation) setVariable [_eventName, _eventFunctions]; }; _eventFunctions pushBack _eventCode // Return event function count diff --git a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf index 05e23cf099..2201426e48 100644 --- a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf +++ b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf @@ -18,8 +18,7 @@ if (_statement isEqualType "") then { _statement = compile _statement; }; -private "_actionsVar"; -_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; +private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; _actionsVar params ["_id", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf index 45f935812f..aef88543be 100644 --- a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf +++ b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf @@ -19,8 +19,7 @@ if (_statement isEqualType "") then { _statement = compile _statement; }; -private "_actionsVar"; -_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; +private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; _actionsVar params ["_id", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_addSetting.sqf b/addons/common/functions/fnc_addSetting.sqf index 06162de6b1..0cf25b860a 100644 --- a/addons/common/functions/fnc_addSetting.sqf +++ b/addons/common/functions/fnc_addSetting.sqf @@ -22,8 +22,7 @@ params ["_name", "", "", "", "", "", "", "_value"]; //["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_isForced", "_value"]; -private "_settingData"; -_settingData = [_name] call FUNC(getSettingData); +private _settingData = [_name] call FUNC(getSettingData); // Exit if the setting already exists if (count _settingData > 0) exitWith {}; diff --git a/addons/common/functions/fnc_addSyncedEventHandler.sqf b/addons/common/functions/fnc_addSyncedEventHandler.sqf index 801a915dc5..0964e419bc 100644 --- a/addons/common/functions/fnc_addSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_addSyncedEventHandler.sqf @@ -21,9 +21,7 @@ if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { false }; -private ["_eventId", "_data"]; - -_eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); -_data = [_handler, [], _ttl, _eventId]; +private _eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); +private _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 4019de93ac..9d796d6018 100644 --- a/addons/common/functions/fnc_addToInventory.sqf +++ b/addons/common/functions/fnc_addToInventory.sqf @@ -18,9 +18,9 @@ params ["_unit", "_classname", ["_container", ""], ["_ammoCount", -1]]; -private ["_type", "_canAdd", "_addedToUnit"]; +private _type = _classname call FUNC(getItemType); -_type = [_classname] call FUNC(getItemType); +private ["_canAdd", "_addedToUnit"]; switch (_container) do { case "vest": { @@ -59,8 +59,7 @@ switch (_type select 0) do { } else { _addedToUnit = false; - private "_pos"; - _pos = _unit modelToWorldVisual [0,1,0.05]; + private _pos = _unit modelToWorldVisual [0,1,0.05]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; _unit addWeaponCargoGlobal [_classname, 1]; @@ -93,8 +92,7 @@ switch (_type select 0) do { } else { _addedToUnit = false; - private "_pos"; - _pos = _unit modelToWorldVisual [0,1,0.05]; + private _pos = _unit modelToWorldVisual [0,1,0.05]; _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. @@ -123,8 +121,7 @@ switch (_type select 0) do { } else { _addedToUnit = false; - private "_pos"; - _pos = _unit modelToWorldVisual [0,1,0.05]; + private _pos = _unit modelToWorldVisual [0,1,0.05]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; _unit addItemCargoGlobal [_classname, 1]; diff --git a/addons/common/functions/fnc_applyForceWalkStatus.sqf b/addons/common/functions/fnc_applyForceWalkStatus.sqf deleted file mode 100644 index d3b58a25a4..0000000000 --- a/addons/common/functions/fnc_applyForceWalkStatus.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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" - -params ["_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 index edfeb1b709..5724521a7b 100644 --- a/addons/common/functions/fnc_assignObjectsInList.sqf +++ b/addons/common/functions/fnc_assignObjectsInList.sqf @@ -41,4 +41,5 @@ if (_list isEqualType "") then { }; }; }; + false } count _list; diff --git a/addons/common/functions/fnc_assignedItemFix.sqf b/addons/common/functions/fnc_assignedItemFix.sqf index 9f804eaa4d..d93409ce7c 100644 --- a/addons/common/functions/fnc_assignedItemFix.sqf +++ b/addons/common/functions/fnc_assignedItemFix.sqf @@ -12,13 +12,11 @@ */ #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}}; +ACE_isMapEnabled = call {private _config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first +ACE_isCompassEnabled = call {private _config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}}; +ACE_isWatchEnabled = call {private _config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}}; +ACE_isRadioEnabled = call {private _config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}}; +ACE_isGPSEnabled = call {private _config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}}; GVAR(AssignedItems) = []; GVAR(AssignedItemsInfo) = []; diff --git a/addons/common/functions/fnc_binarizeNumber.sqf b/addons/common/functions/fnc_binarizeNumber.sqf index aff2f9dc17..0945afa770 100644 --- a/addons/common/functions/fnc_binarizeNumber.sqf +++ b/addons/common/functions/fnc_binarizeNumber.sqf @@ -17,19 +17,17 @@ params ["_number", ["_minLength", 8]]; _number = round _number; -private ["_array", "_index", "_rest"]; - -_array = []; +private _array = []; _array resize _minLength; for "_index" from 0 to (_minLength - 1) do { _array set [_index, false]; }; -_index = 0; +private _index = 0; while {_number > 0} do { - _rest = _number mod 2; + private _rest = _number mod 2; _number = floor (_number / 2); _array set [_index, _rest == 1]; diff --git a/addons/common/functions/fnc_cachedCall.sqf b/addons/common/functions/fnc_cachedCall.sqf index 59350d0483..2c7cdd4b27 100644 --- a/addons/common/functions/fnc_cachedCall.sqf +++ b/addons/common/functions/fnc_cachedCall.sqf @@ -24,10 +24,8 @@ if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then { // Does the cache needs to be cleared on an event? if (!isNil "_event") then { - private ["_varName", "_cacheList"]; - - _varName = format [QGVAR(clearCache_%1), _event]; - _cacheList = missionNamespace getVariable _varName; + private _varName = format [QGVAR(clearCache_%1), _event]; + private _cacheList = missionNamespace getVariable _varName; // If there was no EH to clear these caches, add one if (isNil "_cacheList") then { @@ -35,14 +33,13 @@ if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then { missionNamespace setVariable [_varName, _cacheList]; [_event, { - private ["_varName", "_cacheList"]; // _eventName is defined on the function that calls the event #ifdef DEBUG_MODE_FULL ACE_LOGINFO_1("Clear cached variables on event: %1",_eventName); #endif // Get the list of caches to clear - _varName = format [QGVAR(clearCache_%1), _eventName]; - _cacheList = missionNamespace getVariable [_varName, []]; + private _varName = format [QGVAR(clearCache_%1), _eventName]; + private _cacheList = missionNamespace getVariable [_varName, []]; // Erase all the cached results { _x call FUNC(eraseCache); diff --git a/addons/common/functions/fnc_canGetInPosition.sqf b/addons/common/functions/fnc_canGetInPosition.sqf index 45a2642655..c470337d6a 100644 --- a/addons/common/functions/fnc_canGetInPosition.sqf +++ b/addons/common/functions/fnc_canGetInPosition.sqf @@ -27,19 +27,19 @@ _position = toLower _position; // general if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false}; -private ["_config", "_turret", "_radius", "_selectionPosition", "_selectionPosition2", "_enemiesInVehicle", "_return"]; +private ["_selectionPosition", "_selectionPosition2"]; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_turret = []; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _turret = []; -_radius = 0; +private _radius = 0; -_enemiesInVehicle = false; //Possible Side Restriction +private _enemiesInVehicle = false; //Possible Side Restriction { if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true}; } forEach crew _vehicle; -_return = false; +private _return = false; switch (_position) do { case "driver" : { _radius = getNumber (_config >> "getInRadius"); @@ -60,11 +60,10 @@ switch (_position) do { }; case "gunner" : { - private "_turretConfig"; _turret = [_vehicle] call FUNC(getTurretGunner); if (_turret isEqualTo []) exitWith {false}; - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -73,11 +72,10 @@ switch (_position) do { }; case "commander" : { - private "_turretConfig"; _turret = [_vehicle] call FUNC(getTurretCommander); if (_turret isEqualTo []) exitWith {false}; - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -86,11 +84,10 @@ switch (_position) do { }; case "copilot" : { - private "_turretConfig"; _turret = [_vehicle] call FUNC(getTurretCopilot); if (_turret isEqualTo []) exitWith {false}; - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -99,13 +96,12 @@ switch (_position) do { }; case "turret" : { - private ["_turrets", "_turretConfig"]; - _turrets = [_vehicle] call FUNC(getTurretsOther); + private _turrets = [_vehicle] call FUNC(getTurretsOther); if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX }) then { - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -115,7 +111,7 @@ switch (_position) do { for "_index" from 0 to (count _turrets - 1) do { _turret = _turrets select _index; if (CANGETINTURRETINDEX) exitWith { - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -127,13 +123,12 @@ switch (_position) do { }; case "ffv" : { - private ["_turrets", "_turretConfig"]; - _turrets = [_vehicle] call FUNC(getTurretsFFV); + private _turrets = [_vehicle] call FUNC(getTurretsFFV); if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX }) then { - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -143,7 +138,7 @@ switch (_position) do { for "_index" from 0 to (count _turrets - 1) do { _turret = _turrets select _index; if (CANGETINTURRETINDEX) exitWith { - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -155,8 +150,7 @@ switch (_position) do { }; case "codriver" : { - private "_positions"; - _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver); + private _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver); { if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))}; @@ -189,8 +183,7 @@ switch (_position) do { }; case "cargo" : { - private "_positions"; - _positions = [typeOf _vehicle] call FUNC(getVehicleCargo); + private _positions = [typeOf _vehicle] call FUNC(getVehicleCargo); { if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))}; @@ -226,14 +219,11 @@ switch (_position) do { default {}; }; -private "_fnc_isInRange"; -_fnc_isInRange = { +private _fnc_isInRange = { if (_radius == 0) exitWith {true}; - private ["_unitPosition", "_distance"]; - _unitPosition = getPos _unit; - - _distance = _unitPosition distance (_vehicle modelToWorldVisual _selectionPosition); + private _unitPosition = getPos _unit; + private _distance = _unitPosition distance (_vehicle modelToWorldVisual _selectionPosition); if (!isNil "_selectionPosition2") then { _distance = _distance min (_unitPosition distance (_vehicle modelToWorldVisual _selectionPosition2)); diff --git a/addons/common/functions/fnc_canInteractWith.sqf b/addons/common/functions/fnc_canInteractWith.sqf index 31ebf6b89f..7603452965 100644 --- a/addons/common/functions/fnc_canInteractWith.sqf +++ b/addons/common/functions/fnc_canInteractWith.sqf @@ -16,22 +16,19 @@ params ["_unit", "_target", ["_exceptions", []]]; -_exceptions = [_exceptions, {toLower _this}] call FUNC(map); +_exceptions = _exceptions apply {toLower _x}; -private "_owner"; -_owner = _target getVariable [QGVAR(owner), objNull]; +private _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", "_canInteract"]; - -_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; - +private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; _conditions params ["_conditionNames", "_conditionFuncs"]; -_canInteract = true; +private _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 deleted file mode 100644 index 31aaba17a2..0000000000 --- a/addons/common/functions/fnc_canUseWeapon.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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" - -params ["_unit"]; - -if (_unit == vehicle _unit) exitWith {true}; - -private "_config"; -_config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit; - -isClass _config -&& {getNumber (_config >> "canPullTrigger") == 1} diff --git a/addons/common/functions/fnc_changeProjectileDirection.sqf b/addons/common/functions/fnc_changeProjectileDirection.sqf index 79b8c8aeea..89a8988306 100644 --- a/addons/common/functions/fnc_changeProjectileDirection.sqf +++ b/addons/common/functions/fnc_changeProjectileDirection.sqf @@ -17,14 +17,12 @@ params ["_projectile", "_adjustDir", "_adjustUp", ["_adjustSpeed",0]]; -private ["_vdir", "_dir", "_up", "_vlat", "_vup", "_vel"]; - // get old direction vector -_vdir = vectorNormalized velocity _projectile; +private _vdir = vectorNormalized velocity _projectile; // get azimuth and inclination and apply corrections -_dir = (_vdir select 0) atan2 (_vdir select 1) + _adjustDir; -_up = asin (_vdir select 2) + _adjustUp; +private _dir = (_vdir select 0) atan2 (_vdir select 1) + _adjustDir; +private _up = asin (_vdir select 2) + _adjustUp; // get new direction vector (this is a unit vector) _vdir = [ @@ -34,11 +32,11 @@ _vdir = [ ]; // get best up vector -_vlat = vectorNormalized (_vdir vectorCrossProduct [0,0,1]); -_vup = _vlat vectorCrossProduct _vdir; +private _vlat = vectorNormalized (_vdir vectorCrossProduct [0,0,1]); +private _vup = _vlat vectorCrossProduct _vdir; // get new speed vector. Keep total speed, but change to new direction. Yay for vector commands. -_vel = _vdir vectorMultiply (_adjustSpeed + vectorMagnitude velocity _projectile); +private _vel = _vdir vectorMultiply (_adjustSpeed + vectorMagnitude velocity _projectile); // set projectile direction dir and up. Projectiles are long objects, especially with tracers, so it would look dumb otherwise. _projectile setVectorDirAndUp [_vdir, _vup]; diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index 2c8976f042..19a4c6f72a 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -15,21 +15,18 @@ /////////////// // check addons /////////////// -private "_version"; -_version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); +private _version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); ACE_LOGINFO_1("ACE is version %1.",_version); -private "_addons"; -//_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); +//private _addons = activatedAddons; // broken with High-Command module, see #2134 +private _addons = "true" configClasses (configFile >> "CfgPatches");// +_addons = _addons apply {toLower configName _x};// +_addons = _addons select {_x find "ace_" == 0}; { if (getText (configFile >> "CfgPatches" >> _x >> "versionStr") != _version) then { - private "_errorMsg"; - _errorMsg = format ["File %1.pbo is outdated.", _x]; + private _errorMsg = format ["File %1.pbo is outdated.", _x]; ACE_LOGERROR(_errorMsg); @@ -44,12 +41,10 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); // check dlls /////////////// { - private "_versionEx"; - _versionEx = _x callExtension "version"; + private _versionEx = _x callExtension "version"; if (_versionEx == "") then { - private "_errorMsg"; - _errorMsg = format ["Extension %1.dll not installed.", _x]; + private _errorMsg = format ["Extension %1.dll not installed.", _x]; ACE_LOGERROR(_errorMsg); @@ -68,7 +63,7 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); /////////////// if (isMultiplayer) then { // don't check optional addons - _addons = [_addons, {getNumber (configFile >> "CfgPatches" >> _this >> "ACE_isOptional") != 1}] call FUNC(filter); + _addons = _addons select {getNumber (configFile >> "CfgPatches" >> _x >> "ACE_isOptional") != 1}; if (isServer) then { // send servers version of ACE to all clients @@ -84,8 +79,7 @@ if (isMultiplayer) then { (_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]; + private _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version]; ACE_LOGERROR(_errorMsg); diff --git a/addons/common/functions/fnc_checkPBOs.sqf b/addons/common/functions/fnc_checkPBOs.sqf index a196e8d4ca..f447d126af 100644 --- a/addons/common/functions/fnc_checkPBOs.sqf +++ b/addons/common/functions/fnc_checkPBOs.sqf @@ -41,10 +41,8 @@ if (!isServer) then { // Display error message. if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then { - private ["_text", "_error"]; - - _text = "[ACE] Version mismatch:

"; - _error = format ["ACE version mismatch: %1: ", profileName]; + private _text = "[ACE] Version mismatch:

"; + private _error = format ["ACE version mismatch: %1: ", profileName]; if (_missingAddon) then { _text = _text + "Detected missing addon on client
"; @@ -69,13 +67,11 @@ if (!isServer) then { if (_mode < 2) then { _text = composeText [lineBreak, parseText format ["%1", _text]]; - private ["_rscLayer", "_ctrlHint"]; - - _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer; + private _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer; _rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true]; disableSerialization; - _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint"; + private _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint"; _ctrlHint ctrlSetStructuredText _text; if (_mode == 0) then { diff --git a/addons/common/functions/fnc_claim.sqf b/addons/common/functions/fnc_claim.sqf index ac89a80172..cc514a2a6f 100644 --- a/addons/common/functions/fnc_claim.sqf +++ b/addons/common/functions/fnc_claim.sqf @@ -16,8 +16,7 @@ params ["_unit", "_target", ["_lockTarget", false]]; -private "_owner"; -_owner = _target getVariable [QGVAR(owner), objNull]; +private _owner = _target getVariable [QGVAR(owner), objNull]; if (!isNull _owner && {!isNull _unit} && {_unit != _owner}) then { ACE_LOGERROR("Claiming already owned object."); diff --git a/addons/common/functions/fnc_codeToLetter.sqf b/addons/common/functions/fnc_codeToLetter.sqf deleted file mode 100644 index 80f6291d0f..0000000000 --- a/addons/common/functions/fnc_codeToLetter.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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_createOrthonormalReference.sqf b/addons/common/functions/fnc_createOrthonormalReference.sqf index 4a8db8bba1..e45bf269aa 100644 --- a/addons/common/functions/fnc_createOrthonormalReference.sqf +++ b/addons/common/functions/fnc_createOrthonormalReference.sqf @@ -14,10 +14,10 @@ */ #include "script_component.hpp" -private ["_v1", "_v2", "_v3"]; +[_this] params [["_vector", [0,0,1], [[]], 3]]; -_v1 = vectorNormalized _this; -_v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]); -_v3 = _v2 vectorCrossProduct _v1; +private _v1 = vectorNormalized _this; +private _v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]); +private _v3 = _v2 vectorCrossProduct _v1; -[_v1,_v2,_v3] +[_v1, _v2, _v3] diff --git a/addons/common/functions/fnc_currentChannel.sqf b/addons/common/functions/fnc_currentChannel.sqf index 82dd66b485..a78e2b0204 100644 --- a/addons/common/functions/fnc_currentChannel.sqf +++ b/addons/common/functions/fnc_currentChannel.sqf @@ -15,8 +15,7 @@ #define CHANNELS ["global", "side", "command", "group", "vehicle", "direct"] #define CHANNELS_LOCALIZED [localize "str_channel_global", localize "str_channel_side", localize "str_channel_command", localize "str_channel_group", localize "str_channel_vehicle", localize "str_channel_direct"] -private "_currentChannel"; -_currentChannel = currentChannel; +private _currentChannel = currentChannel; if (_currentChannel < count CHANNELS) then { _currentChannel = CHANNELS select _currentChannel; diff --git a/addons/common/functions/fnc_debug.sqf b/addons/common/functions/fnc_debug.sqf index 6dd1f04163..019ce2abff 100644 --- a/addons/common/functions/fnc_debug.sqf +++ b/addons/common/functions/fnc_debug.sqf @@ -18,20 +18,15 @@ params ["_msg", ["_level", 2, [0]]]; -private ["_defaultLoglevel", "_defaultLogDisplayLevel"]; - -_defaultLoglevel = [GVAR(LOGLEVEL), DEFAULT_LOGGING_LEVEL] select isNil QGVAR(LOGLEVEL); +private _defaultLoglevel = missionNamespace getVariable [QGVAR(LOGLEVEL), DEFAULT_LOGGING_LEVEL]; if (_defaultLoglevel < 0) exitWith {false}; -_defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select isNil QGVAR(LOGDISPLAY_LEVEL); +private _defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select isNil QGVAR(LOGDISPLAY_LEVEL); if (_level <= _defaultLoglevel) then { - private ["_prefix", "_message"]; - - _prefix = ["Unknown", "Error", "Warn", "Debug", "Info"] select ([0, 1, 2, 3] find _level + 1); - - _message = format ["[ACE %1] %2", _prefix, _msg]; + private _prefix = ["Unknown", "Error", "Warn", "Debug", "Info"] select ([0, 1, 2, 3] find _level + 1); + private _message = format ["[ACE %1] %2", _prefix, _msg]; if (_level <= _defaultLogDisplayLevel) then { systemChat _message; diff --git a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf index 16a80d6e3f..02135e59db 100644 --- a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf +++ b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf @@ -18,9 +18,7 @@ params [["_searchOffsetOrName", 0]]; -private ["_validIndex", "_realIndex"]; - -_validIndex = -1; +private _validIndex = -1; if (_searchOffsetOrName isEqualType "") then { { @@ -33,7 +31,7 @@ if (_searchOffsetOrName isEqualType "") 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)); + private _realIndex = _offset % (count GVAR(deviceKeyHandlingArray)); if ([] call ((GVAR(deviceKeyHandlingArray) select _realIndex) select 2)) exitWith { _validIndex = _realIndex; diff --git a/addons/common/functions/fnc_disableAI.sqf b/addons/common/functions/fnc_disableAI.sqf index 1a66628ffb..75c59d1a9a 100644 --- a/addons/common/functions/fnc_disableAI.sqf +++ b/addons/common/functions/fnc_disableAI.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_disable"]; +params [["_unit", objNull, [objNull]], ["_disable", true, [false]]]; if (!local _unit) exitWith {}; diff --git a/addons/common/functions/fnc_disableUserInput.sqf b/addons/common/functions/fnc_disableUserInput.sqf index 8b00cedeac..8e28edc5f0 100644 --- a/addons/common/functions/fnc_disableUserInput.sqf +++ b/addons/common/functions/fnc_disableUserInput.sqf @@ -31,8 +31,7 @@ if (_state) then { closeDialog 0; createDialog QGVAR(DisableMouse_Dialog); - private "_dlg"; - _dlg = uiNamespace getVariable QGVAR(dlgDisableMouse); + private _dlg = uiNamespace getVariable QGVAR(dlgDisableMouse); _dlg displayAddEventHandler ["KeyDown", { params ["", "_key"]; @@ -42,15 +41,13 @@ if (_state) then { disableSerialization; - private ["_dlg", "_ctrl"]; - - _dlg = findDisplay 49; + private _dlg = findDisplay 49; for "_index" from 100 to 2000 do { (_dlg displayCtrl _index) ctrlEnable false; }; - _ctrl = _dlg displayctrl 103; + private _ctrl = _dlg displayctrl 103; _ctrl ctrlSetEventHandler ["buttonClick", QUOTE(while {!isNull (uiNamespace getVariable [ARR_2(QUOTE(QGVAR(dlgDisableMouse)),displayNull)])} do {closeDialog 0}; failMission 'LOSER'; [false] call DFUNC(disableUserInput);)]; _ctrl ctrlEnable true; _ctrl ctrlSetText "ABORT"; @@ -58,7 +55,7 @@ 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 {private "_config"; _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}}); + _ctrl ctrlEnable (call {private _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}}); _ctrl ctrlSetText "RESPAWN"; _ctrl ctrlSetTooltip "Respawn."; }; @@ -66,8 +63,7 @@ if (_state) then { if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then { (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0; - private "_acc"; - _acc = accTime; + private _acc = accTime; teamSwitch; setAccTime _acc; }; diff --git a/addons/common/functions/fnc_displayIcon.sqf b/addons/common/functions/fnc_displayIcon.sqf index 23c5631fa6..c51b3bd454 100644 --- a/addons/common/functions/fnc_displayIcon.sqf +++ b/addons/common/functions/fnc_displayIcon.sqf @@ -45,14 +45,11 @@ disableSerialization; params ["_iconId", "_show", "_icon", "_color", ["_timeAlive", DEFAULT_TIME]]; -private ["_list", "_refresh"]; +private _list = missionNamespace getVariable [QGVAR(displayIconList), []]; -_list = missionNamespace getVariable [QGVAR(displayIconList), []]; - -_refresh = { +private _refresh = { // Refreshing of all icons.. - private "_allControls"; - _allControls = missionNamespace getVariable [QGVAR(displayIconListControls), []]; + private _allControls = missionNamespace getVariable [QGVAR(displayIconListControls), []]; { ctrlDelete _x; @@ -61,18 +58,16 @@ _refresh = { _allControls = []; - private ["_setting", "_ctrl", "_position"]; - - _setting = missionNamespace getVariable [QGVAR(settingFeedbackIcons), 0]; + private _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]; + private _ctrl = (findDisplay 46) ctrlCreate ["RscPicture", _forEachIndex + 19000]; - _position = switch (_setting) do { + private _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]}; case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; @@ -115,8 +110,7 @@ if (_show) then { } else { if ({_x select 0 == _iconId} count _list == 1) then { - private "_newList"; - _newList = []; + private _newList = []; { if (_x select 0 != _iconId) then { diff --git a/addons/common/functions/fnc_displayText.sqf b/addons/common/functions/fnc_displayText.sqf index fce8fdd832..3c68327535 100644 --- a/addons/common/functions/fnc_displayText.sqf +++ b/addons/common/functions/fnc_displayText.sqf @@ -23,12 +23,9 @@ if (isNil QGVAR(lastHint)) then { if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text}; -private ["_lastHintTime", "_lastHintPriority", "_time"]; +GVAR(lastHint) params ["_lastHintTime", "_lastHintPriority"]; -_lastHintTime = GVAR(lastHint) select 0; -_lastHintPriority = GVAR(lastHint) select 1; - -_time = ACE_time; +private _time = ACE_time; if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then { hintSilent _text; diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index ce088163a6..9fff7bb056 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -35,36 +35,34 @@ 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]); +private _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); ("ACE_RscHint" call BIS_fnc_rscLayer) cutRsc ["ACE_RscHint", "PLAIN", 0, true]; disableSerialization; -_ctrlHint = uiNamespace getVariable "ACE_ctrlHint"; +private _ctrlHint = uiNamespace getVariable "ACE_ctrlHint"; _ctrlHint ctrlSetBackgroundColor GVAR(displayTextColor); _ctrlHint ctrlSetTextColor GVAR(displayTextFontColor); /* // This does not function at the moment. Has been disabled until it fixed. -_xPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_X", ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40))]; -_yPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH]; -_wPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))]; -_hPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_H", (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))]; +private _xPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_X", ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40))]; +private _yPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH]; +private _wPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))]; +private _hPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_H", (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))]; */ -_xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40)); -_yPos = safeZoneY + 0.175 * safezoneH; -_wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40)); -_hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)); +private _xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40)); +private _yPos = safeZoneY + 0.175 * safezoneH; +private _wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40)); +private _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 { _xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos); }; -_position = [_xPos, _yPos, _wPos, _size * _hPos]; +private _position = [_xPos, _yPos, _wPos, _size * _hPos]; _ctrlHint ctrlSetPosition _position; _ctrlHint ctrlCommit 0; diff --git a/addons/common/functions/fnc_dropBackpack.sqf b/addons/common/functions/fnc_dropBackpack.sqf index 26c902a057..7b7ee5765e 100644 --- a/addons/common/functions/fnc_dropBackpack.sqf +++ b/addons/common/functions/fnc_dropBackpack.sqf @@ -12,11 +12,9 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private ["_backpackObject", "_holder"]; - -_backpackObject = backpackContainer _unit; +private _backpackObject = backpackContainer _unit; _unit addBackpack "ACE_FakeBackpack"; removeBackpack _unit; diff --git a/addons/common/functions/fnc_dumpPerformanceCounters.sqf b/addons/common/functions/fnc_dumpPerformanceCounters.sqf index e076831c6f..bdc4588b05 100644 --- a/addons/common/functions/fnc_dumpPerformanceCounters.sqf +++ b/addons/common/functions/fnc_dumpPerformanceCounters.sqf @@ -19,8 +19,7 @@ if (!isNil "ACE_PFH_COUNTER") then { { _x params ["_pfh", "_parameters"]; - private "_isActive"; - _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)}; + private _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 @@ -31,20 +30,18 @@ diag_log text format ["ACE COUNTER RESULTS"]; diag_log text format ["-------------------------------------------"]; { - private ["_counterEntry", "_iter", "_total", "_count", "_averageResult", "_delta"]; - - _counterEntry = _x; - _iter = 0; - _total = 0; - _count = 0; - _averageResult = 0; + private _counterEntry = _x; + private _iter = 0; + private _total = 0; + private _count = 0; + private _averageResult = 0; if (count _counterEntry > 3) then { // calc { if (_iter > 2) then { _count = _count + 1; - _delta = (_x select 1) - (_x select 0); + private _delta = (_x select 1) - (_x select 0); _total = _total + _delta; }; @@ -69,8 +66,7 @@ diag_log text format ["-------------------------------------------"]; diag_log text format["ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER"]; diag_log text format["-------------------------------------------"]; { - private["_delay"]; - _delay = _x select 2; + private _delay = _x select 2; //if(_delay > 0) then { _delay = _delay / 1000; }; diag_log text format["%1: %2s, delay=%3, handle=%4",(_x select 0), _delay, (_x select 3), (_x select 4)]; @@ -80,8 +76,7 @@ diag_log text format["-------------------------------------------"]; diag_log text format["ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER"]; diag_log text format["-------------------------------------------"]; { - private["_delta"]; - _delta = _x select 1; + private _delta = _x select 1; //if(_delta > 0) then { _delta = _delta / 1000; }; diag_log text format[" DELTA: %1s", _delta]; } forEach ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER; diff --git a/addons/common/functions/fnc_errorMessage.sqf b/addons/common/functions/fnc_errorMessage.sqf index aa2b872d47..88e0a3b90f 100644 --- a/addons/common/functions/fnc_errorMessage.sqf +++ b/addons/common/functions/fnc_errorMessage.sqf @@ -37,35 +37,29 @@ if (_textMessage isEqualType "") then { (ARR_SELECT(_this,4,call BIS_fnc_displayMission)) createDisplay "RscDisplayCommonMessagePause"; -private ["_display", "_ctrlRscMessageBox", "_ctrlBcgCommonTop", "_ctrlBcgCommon", "_ctrlText", "_ctrlBackgroundButtonOK", "_ctrlBackgroundButtonMiddle", "_ctrlBackgroundButtonCancel", "_ctrlButtonOK", "_ctrlButtonCancel"]; - -_display = uiNamespace getVariable "RscDisplayCommonMessage_display"; -_ctrlRscMessageBox = _display displayCtrl 2351; -_ctrlBcgCommonTop = _display displayCtrl 235100; -_ctrlBcgCommon = _display displayCtrl 235101; -_ctrlText = _display displayCtrl 235102; -_ctrlBackgroundButtonOK = _display displayCtrl 235103; -_ctrlBackgroundButtonMiddle = _display displayCtrl 235104; -_ctrlBackgroundButtonCancel = _display displayCtrl 235105; -_ctrlButtonOK = _display displayCtrl 235106; -_ctrlButtonCancel = _display displayCtrl 235107; +private _display = uiNamespace getVariable "RscDisplayCommonMessage_display"; +private _ctrlRscMessageBox = _display displayCtrl 2351; +private _ctrlBcgCommonTop = _display displayCtrl 235100; +private _ctrlBcgCommon = _display displayCtrl 235101; +private _ctrlText = _display displayCtrl 235102; +private _ctrlBackgroundButtonOK = _display displayCtrl 235103; +private _ctrlBackgroundButtonMiddle = _display displayCtrl 235104; +private _ctrlBackgroundButtonCancel = _display displayCtrl 235105; +private _ctrlButtonOK = _display displayCtrl 235106; +private _ctrlButtonCancel = _display displayCtrl 235107; _ctrlBcgCommonTop ctrlSetText _textHeader; -private ["_ctrlButtonOKPos", "_ctrlBcgCommonPos", "_bottomSpaceY", "_ctrlTextPos", "_marginX", "_marginY"]; +private _ctrlButtonOKPos = ctrlPosition _ctrlButtonOK; +private _ctrlBcgCommonPos = ctrlPosition _ctrlBcgCommon; +private _bottomSpaceY = (_ctrlButtonOKPos select 1) - ((_ctrlBcgCommonPos select 1) + (_ctrlBcgCommonPos select 3)); -_ctrlButtonOKPos = ctrlPosition _ctrlButtonOK; -_ctrlBcgCommonPos = ctrlPosition _ctrlBcgCommon; -_bottomSpaceY = (_ctrlButtonOKPos select 1) - ((_ctrlBcgCommonPos select 1) + (_ctrlBcgCommonPos select 3)); - -_ctrlTextPos = ctrlPosition _ctrlText; -_marginX = (_ctrlTextPos select 0) - (_ctrlBcgCommonPos select 0); -_marginY = (_ctrlTextPos select 1) - (_ctrlBcgCommonPos select 1); - -private ["_ctrlTextPosH", "_bottomPosY"]; +private _ctrlTextPos = ctrlPosition _ctrlText; +private _marginX = (_ctrlTextPos select 0) - (_ctrlBcgCommonPos select 0); +private _marginY = (_ctrlTextPos select 1) - (_ctrlBcgCommonPos select 1); _ctrlText ctrlSetStructuredText _textMessage; -_ctrlTextPosH = ctrlTextHeight _ctrlText; +private _ctrlTextPosH = ctrlTextHeight _ctrlText; _ctrlBcgCommon ctrlSetPosition [ _ctrlBcgCommonPos select 0, @@ -83,11 +77,10 @@ _ctrlText ctrlSetPosition [ ]; _ctrlText ctrlCommit 0; -_bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _bottomSpaceY; +private _bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _bottomSpaceY; { - private "_xPos"; - _xPos = ctrlPosition _x; + private _xPos = ctrlPosition _x; _xPos set [1, _bottomPosY]; _x ctrlSetPosition _xPos; @@ -100,10 +93,8 @@ _bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _b _ctrlButtonCancel ]; -private ["_ctrlRscMessageBoxPos", "_ctrlRscMessageBoxPosH"]; - -_ctrlRscMessageBoxPos = ctrlPosition _ctrlRscMessageBox; -_ctrlRscMessageBoxPosH = _bottomPosY + (_ctrlButtonOKPos select 3); +private _ctrlRscMessageBoxPos = ctrlPosition _ctrlRscMessageBox; +private _ctrlRscMessageBoxPosH = _bottomPosY + (_ctrlButtonOKPos select 3); _ctrlRscMessageBox ctrlSetPosition [ 0.5 - (_ctrlBcgCommonPos select 2) / 2, diff --git a/addons/common/functions/fnc_execPersistentFnc.sqf b/addons/common/functions/fnc_execPersistentFnc.sqf index 0b7bccb69a..af015cf55d 100644 --- a/addons/common/functions/fnc_execPersistentFnc.sqf +++ b/addons/common/functions/fnc_execPersistentFnc.sqf @@ -17,6 +17,8 @@ */ #include "script_component.hpp" +ACE_DEPRECATED("ace_common_fnc_execPersistentFnc","3.7.0","ace_common_fnc_globalEvent"); + GVAR(remoteFnc) = _this; params ["_arguments", "_function", "_unit", "_name"]; @@ -28,12 +30,11 @@ _function = call compile _function; [[_arguments, _unit], _this select 1, 2] call FUNC(execRemoteFnc); // save persistent function for JIP -private ["_persistentFunctions", "_index"]; - -_persistentFunctions = _unit getVariable ["ACE_PersistentFunctions", []]; +private _persistentFunctions = _unit getVariable ["ACE_PersistentFunctions", []]; // find index to overwrite function with the same name, add to end otherwise -_index = count _persistentFunctions; +private _index = count _persistentFunctions; + { if (_x select 2 == _name) exitWith { _index = _forEachIndex; diff --git a/addons/common/functions/fnc_execRemoteFnc.sqf b/addons/common/functions/fnc_execRemoteFnc.sqf index 02f957b501..945d181e4e 100644 --- a/addons/common/functions/fnc_execRemoteFnc.sqf +++ b/addons/common/functions/fnc_execRemoteFnc.sqf @@ -20,6 +20,8 @@ */ #include "script_component.hpp" +ACE_DEPRECATED("ace_common_fnc_execRemoteFnc","3.7.0","ace_common_fnc_globalEvent"); + GVAR(remoteFnc) = _this; params ["_arguments", "_function", ["_unit", 2]]; diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf index 2a4890c49c..c175254e5a 100644 --- a/addons/common/functions/fnc_exportConfig.sqf +++ b/addons/common/functions/fnc_exportConfig.sqf @@ -15,26 +15,22 @@ */ #include "script_component.hpp" -private "_fnc_logEntries"; -_fnc_logEntries = { +private _fnc_logEntries = { params ["_c", "_d"]; - private ["_p", "_t", "_e", "_a", "_i"]; + private _p = inheritsFrom _c; - _p = inheritsFrom _c; - - _t = format [["class %1: %2 {", "class %1 {"] select (configName _p == ""), configName _c, configName _p]; + private _t = format [["class %1: %2 {", "class %1 {"] select (configName _p == ""), configName _c, configName _p]; for "_a" from 1 to _d do { _t = " " + _t; }; diag_log text _t; - _e = []; + private _e = []; for "_i" from 0 to (count _c - 1) do { - private ["_e1, _e2"]; - _e1 = _c select _i; + private _e1 = _c select _i; - _e2 = switch (true) do { + private _e2 = switch (true) do { case (isNumber _e1): {getNumber _e1}; case (isText _e1): {getText _e1}; case (isArray _e1): {getArray _e1}; diff --git a/addons/common/functions/fnc_filter.sqf b/addons/common/functions/fnc_filter.sqf index 0b30e59cf9..acee28eaa2 100644 --- a/addons/common/functions/fnc_filter.sqf +++ b/addons/common/functions/fnc_filter.sqf @@ -9,17 +9,17 @@ * Return Value: * Final array * - * Usage: - * [[0,1,2,3,4], {_this > 2}] call FUNC(filter) ==> [3,4] - * * Public: Yes + * + * Deprecated */ #include "script_component.hpp" -params ["_array", "_code"]; +params [["_array", [], [[]]], ["_code", {}, [{}]]]; -private "_result"; -_result = []; +ACE_DEPRECATED("ace_common_fnc_filter","3.7.0","select CODE"); + +private _result = []; { if (_x call _code) then { diff --git a/addons/common/functions/fnc_findUnloadPosition.sqf b/addons/common/functions/fnc_findUnloadPosition.sqf new file mode 100644 index 0000000000..f7155fd87b --- /dev/null +++ b/addons/common/functions/fnc_findUnloadPosition.sqf @@ -0,0 +1,117 @@ +/* + * Author: PabstMirror, ViperMaul + * Find a safe place near a vehicle to unload something + * Handles Normal Terrain, In Water or On Buildings (Pier, StaticShip) + * + * Arguments: + * 0: Source Vehicle + * 1: Cargo Classname + * 2: Unloader (player) + * 3: Max Distance (meters) + * 4: Check Vehicle is Stable + * + * Return Value: + * Unload PositionAGL (Can Be [] if no valid pos found) + * + * Example: + * [theCar, "CAManBase", player, 10, true] call ace_common_fnc_findUnloadPosition; + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +//Number of tests run (effects performance in worst case scenarior where nothing is found VERSUES reliably finding a pos): +#define MAX_TESTS 75 + +//Manual collision tests (count and radius): +#define COL_TEST_COUNT 12 + +params ["_vehicle", "_typeOfCargo", ["_theUnloader", objNull], ["_maxDistance", 10], ["_checkVehicleIsStable", true]]; +TRACE_5("params",_vehicle,_typeOfCargo,_theUnloader,_maxDistance,_checkVehicleIsStable); + +scopeName "main"; + +if (_checkVehicleIsStable) then { + if (((vectorMagnitude (velocity _vehicle)) > 1.5) || {(!(_vehicle isKindOf "Ship")) && {(!isTouchingGround _vehicle) && {((getPos _vehicle) select 2) > 1.5}}}) then { + TRACE_4("bad vehicle state",_vehicle,velocity _vehicle,isTouchingGround _vehicle,getPos _vehicle); + [] breakOut "main"; + }; +}; + +private _radiusOfItem = 1; +if (_typeOfCargo isKindOf "CAManBase") then { + _radiusOfItem = 1.1; +} else { + //`sizeOf` is unreliable, and does not work with object types that don't exist on map, so estimate size based on cargo size + if (isNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size))) then { + _radiusOfItem = (((getNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size))) ^ 0.35) max 0.75); + }; +}; + +if (isNull _theUnloader) then {_theUnloader = _vehicle;}; + +//Ideal unload pos is halfway between unloader and vehicle (at the unloader's height) +private _originASL = ((getPosASL _theUnloader) vectorAdd (getPosASL _vehicle)) vectorMultiply 0.5; +_originASL set [2, (getPosASL _theUnloader) select 2]; +private _originAGL = ASLtoAGL _originASL; + +//Do a manual search for empty pos (handles underwater, buildings or piers) +TRACE_2("Checking for unload",_originAGL,_radiusOfItem); +private _rangeToCheck = 0; +while {_rangeToCheck < _maxDistance} do { + private _roundDistance = random _rangeToCheck; + private _roundAngle = random 360; + private _roundAGL = _originAGL vectorAdd [(cos _roundAngle) * _roundDistance, (sin _roundAngle) * _roundDistance, 0]; + + private _roundPointIsValid = false; + if (((AGLtoASL _roundAGL) select 2) > 0) then { + //Shoot a ray down, and make sure we hit something solid like a building or the ground: + private _belowRoundArray = lineIntersectsSurfaces [(AGLtoASL _roundAGL) vectorAdd [0,0,0.5], (AGLtoASL _roundAGL) vectorAdd [0,0,-1]]; + TRACE_4("Testing for solid",_roundDistance,_roundAngle,_roundAGL,_belowRoundArray); + if (!(_belowRoundArray isEqualTo [])) then { + private _aboveBuilding = (_belowRoundArray select 0) select 2; + //Point is above something: Terrain(null) or Building + if ((isNull _aboveBuilding) || {_aboveBuilding isKindOf "Building"}) then { + //Get the real intersection point: + _roundAGL = ASLtoAGL ((_belowRoundArray select 0) select 0); + _roundPointIsValid = true; + }; + }; + } else { + //Underwater, just unload anywhere + TRACE_3("Under the sea",_roundDistance,_roundAngle,_roundAGL); + _roundPointIsValid = true; + }; + + //Make sure point is valid and do a fast check for people in the way (which sometimes aren't caught by line scaning) + if (_roundPointIsValid && {(_roundAGL nearEntities ["Man", _radiusOfItem]) isEqualTo []}) then { + for "_index" from 0 to (COL_TEST_COUNT -1) do { + //Scan for colisions with objects with lineIntersectsSurfaces + private _angle = _index * (360 / COL_TEST_COUNT); + private _point1ASL = (AGLtoASL _roundAGL) vectorAdd [_radiusOfItem * cos _angle, _radiusOfItem * sin _angle, 0.1]; + private _point2ASL = (AGLtoASL _roundAGL) vectorAdd [-_radiusOfItem * cos _angle, -_radiusOfItem * sin _angle, (_radiusOfItem + 0.5)]; + private _testIntersections = lineIntersectsSurfaces [_point1ASL, _point2ASL]; + if (!(_testIntersections isEqualTo [])) exitWith { + TRACE_2("collision low/high",_roundAGL,_testIntersections); + _roundPointIsValid = false; + }; + _point1ASL = (AGLtoASL _roundAGL) vectorAdd [_radiusOfItem * cos _angle, _radiusOfItem * sin _angle, 0.5]; + _point2ASL = (AGLtoASL _roundAGL) vectorAdd [-_radiusOfItem * cos _angle, -_radiusOfItem * sin _angle, 1]; + _testIntersections = lineIntersectsSurfaces [_point1ASL, _point2ASL]; + if (!(_testIntersections isEqualTo [])) exitWith { + TRACE_2("collision mid",_roundAGL,_testIntersections); + _roundPointIsValid = false; + }; + }; + if (_roundPointIsValid) then { + TRACE_3("Valid point found", _rangeToCheck,_roundAGL, (_originAGL distance _roundAGL)); + //Raise it slightly so we don't sink through the floor: + (_roundAGL vectorAdd [0,0,0.05]) breakOut "main"; + }; + }; + _rangeToCheck = _rangeToCheck + (_maxDistance / MAX_TESTS); +}; + +TRACE_1("no valid spots found",_rangeToCheck); +[] //return empty array diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf new file mode 100644 index 0000000000..d70f0a8650 --- /dev/null +++ b/addons/common/functions/fnc_firedEH.sqf @@ -0,0 +1,68 @@ +/* + * Author: esteldunedain + * Unfied handling of weapon fire + * + * Argument: + * 0: unit - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +BEGIN_COUNTER(firedEH); + +params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; +TRACE_7("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile); + +if (_unit isKindOf "CAManBase") then { + // The unit it on foot + if (_unit == ACE_player) then { + ["firedPlayer", _this] call FUNC(localEvent); + } else { + if ([_unit] call EFUNC(common,isPlayer)) then { + ["firedPlayerNonLocal", _this] call FUNC(localEvent); + } else { + ["firedNonPlayer", _this] call FUNC(localEvent); + }; + }; +} else { + // The unit is a vehicle + private _vehicle = _unit; + + // Get the gunner and turret path. + // Code based on FUNC(getGunner), extracted for efficency. + private _gunner = objNull; + private _turret = []; + { + if (_weapon in (_unit weaponsTurret _x)) exitWith { + _gunner = _unit turretUnit _x; + _turret = _x; + }; + false + } count allTurrets [_unit, true]; + // Ensure that at least the pilot is returned if there is no gunner + if (isManualFire _unit && {isNull _gunner}) then { + _gunner = effectiveCommander _unit; + }; + + if (_gunner == ACE_player) then { + ["firedPlayerVehicle", _this] call FUNC(localEvent); + } else { + if ([_gunner] call EFUNC(common,isPlayer)) then { + ["firedPlayerVehicleNonLocal", _this] call FUNC(localEvent); + } else { + ["firedNonPlayerVehicle", _this] call FUNC(localEvent); + }; + }; +}; + +END_COUNTER(firedEH); diff --git a/addons/common/functions/fnc_fixCollision.sqf b/addons/common/functions/fnc_fixCollision.sqf index 1d55eb1454..c0cf7b93e7 100644 --- a/addons/common/functions/fnc_fixCollision.sqf +++ b/addons/common/functions/fnc_fixCollision.sqf @@ -15,8 +15,8 @@ // allowDamage requires local object if (!local _this) exitWith {}; -// prevent collision damage, @todo allowDamage API -_this allowDamage false; +// prevent collision damage +[_this, "blockDamage", "fixCollision", true] call FUNC(statusEffect_set); // re-allow damage after 2 seconds -[{_this allowDamage true}, _this, 2, 0] call EFUNC(common,waitAndExecute); +[{[_this, "blockDamage", "fixCollision", false] call FUNC(statusEffect_set);}, _this, 2] call EFUNC(common,waitAndExecute); diff --git a/addons/common/functions/fnc_fixCrateContent.sqf b/addons/common/functions/fnc_fixCrateContent.sqf index a067c29c63..06d73c39b1 100644 --- a/addons/common/functions/fnc_fixCrateContent.sqf +++ b/addons/common/functions/fnc_fixCrateContent.sqf @@ -14,11 +14,9 @@ params ["_crate"]; -private ["_weapons", "_items"]; - // get all weapons inside the crate -_weapons = weaponCargo _crate; -_items = []; +private _weapons = weaponCargo _crate; +private _items = []; // if the "weapon" is supposed to be an item, move those from the weapon array to the item array { diff --git a/addons/common/functions/fnc_fixFloating.sqf b/addons/common/functions/fnc_fixFloating.sqf index 2eb6f2b4e4..1d8da1c8a4 100644 --- a/addons/common/functions/fnc_fixFloating.sqf +++ b/addons/common/functions/fnc_fixFloating.sqf @@ -1,6 +1,7 @@ /* * Author: commy2 * Attempt to fix floating physx with disabled damage after setPosXXX commands. + * Handles the "fixFloating" event * * Arguments: * PhysX object @@ -12,15 +13,18 @@ */ #include "script_component.hpp" -private "_object"; -_object = _this; +params ["_object"]; // setHitPointDamage requires local object if (!local _object) exitWith {}; +//Ignore mans +if (_object isKindOf "CAManBase") exitWith {}; + +//We need to manually set allowDamage to true for setHitIndex to function +["blockDamage", [_object, 0]] call FUNC(localEvent); // save and restore hitpoints, see below why -private "_hitPointDamages"; -_hitPointDamages = getAllHitPointsDamage _object; +private _hitPointDamages = getAllHitPointsDamage _object; // get correct format for objects without hitpoints if (_hitPointDamages isEqualTo []) then { @@ -33,3 +37,8 @@ _object setDamage damage _object; { _object setHitIndex [_forEachIndex, _x]; } forEach (_hitPointDamages select 2); + +//manually re-enable allowDamage to previous setting (ref statusEffect_funcs) +private _effectVarName = format [QGVAR(effect_%1), "blockDamage"]; +private _effectNumber = _object getVariable [_effectVarName, 0]; +["blockDamage", [_object, _effectNumber]] call FUNC(localEvent); diff --git a/addons/common/functions/fnc_fixPosition.sqf b/addons/common/functions/fnc_fixPosition.sqf index 54d0cdfbf6..e2e2d71059 100644 --- a/addons/common/functions/fnc_fixPosition.sqf +++ b/addons/common/functions/fnc_fixPosition.sqf @@ -16,8 +16,7 @@ // setVectorUp requires local object if (!local _this) exitWith {}; -private "_position"; -_position = getPos _this; +private _position = getPos _this; // don't place the object below the ground if (_position select 2 < -0.1) then { diff --git a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf index 7205a943d9..a5d973767f 100644 --- a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf +++ b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf @@ -22,12 +22,10 @@ params ["_object", ["_category", ""]]; if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) exitWith {[]}; -private ["_return", "_val"]; - -_return = []; +private _return = []; { - _val = _object getVariable (_x select 0); + private _val = _object getVariable (_x select 0); if (!isNil "_val") then { if (_category == "" || _category == _x select 3) then { diff --git a/addons/common/functions/fnc_getCaptivityStatus.sqf b/addons/common/functions/fnc_getCaptivityStatus.sqf index 36bf0ff183..ab4c27956e 100644 --- a/addons/common/functions/fnc_getCaptivityStatus.sqf +++ b/addons/common/functions/fnc_getCaptivityStatus.sqf @@ -14,18 +14,7 @@ params ["_unit"]; -private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"]; +//Now just a wrapper for FUNC(statusEffect_get) [No longer used in ace as of 3.5] +ACE_DEPRECATED("ace_common_fnc_getCaptivityStatus","3.7.0","ace_common_fnc_statusEffect_get"); -_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; - -_unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber); - -_unitCaptivityReasons = []; - -{ - if (_unitCaptivityStatus select _forEachIndex) then { - _unitCaptivityReasons pushBack _x; - }; -} forEach _captivityReasons; - -_unitCaptivityReasons +([_unit, "setCaptive"] call FUNC(statusEffect_get)) select 1 diff --git a/addons/common/functions/fnc_getChildren.sqf b/addons/common/functions/fnc_getChildren.sqf index d5212dd9a5..f2930b015d 100644 --- a/addons/common/functions/fnc_getChildren.sqf +++ b/addons/common/functions/fnc_getChildren.sqf @@ -14,7 +14,6 @@ params ["_name", "_cfgClass"]; -private "_classes"; -_classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass); +private _classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass); -[_classes, {configName _this}] call FUNC(map) // return +_classes apply {configName _x} // return diff --git a/addons/common/functions/fnc_getConfigCommander.sqf b/addons/common/functions/fnc_getConfigCommander.sqf index bfa5fbc379..d4a53905b8 100644 --- a/addons/common/functions/fnc_getConfigCommander.sqf +++ b/addons/common/functions/fnc_getConfigCommander.sqf @@ -14,9 +14,7 @@ params ["_vehicle"]; -private ["_config", "_turret"]; - -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_turret = [_vehicle] call FUNC(getTurretCommander); +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _turret = _vehicle call FUNC(getTurretCommander); [_config, _turret] call FUNC(getTurretConfigPath) // return diff --git a/addons/common/functions/fnc_getConfigGunner.sqf b/addons/common/functions/fnc_getConfigGunner.sqf index bc3131d798..abbbd5f014 100644 --- a/addons/common/functions/fnc_getConfigGunner.sqf +++ b/addons/common/functions/fnc_getConfigGunner.sqf @@ -14,9 +14,7 @@ params ["_vehicle"]; -private ["_config", "_turret"]; - -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_turret = [_vehicle] call FUNC(getTurretGunner); +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _turret = _vehicle call FUNC(getTurretGunner); [_config, _turret] call FUNC(getTurretConfigPath) // return diff --git a/addons/common/functions/fnc_getDeathAnim.sqf b/addons/common/functions/fnc_getDeathAnim.sqf index 590418bf25..60aaf3bc0c 100644 --- a/addons/common/functions/fnc_getDeathAnim.sqf +++ b/addons/common/functions/fnc_getDeathAnim.sqf @@ -17,25 +17,23 @@ params ["_unit"]; -private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation"]; +private _returnAnimation = ""; -_returnAnimation = ""; - -_animationState = animationState _unit; -_unitAnimationCfg = configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState; +private _animationState = animationState _unit; +private _unitAnimationCfg = configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState; //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"); +private _unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText (_unitAnimationCfg >> "actions"); TRACE_2("Animation/Action", configName _unitAnimationCfg, configName _unitActionsCfg); if (vehicle _unit != _unit) then { - _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo"); + private _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo"); for "_index" from 0 to (count _interpolateArray - 1) step 2 do { - _indexAnimation = _interpolateArray select _index; + private _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}; diff --git a/addons/common/functions/fnc_getDefaultAnim.sqf b/addons/common/functions/fnc_getDefaultAnim.sqf index 372a2424eb..c2c0e1e7c4 100644 --- a/addons/common/functions/fnc_getDefaultAnim.sqf +++ b/addons/common/functions/fnc_getDefaultAnim.sqf @@ -17,12 +17,10 @@ params ["_unit"]; -private ["_anim", "_stance"]; - -_anim = toLower animationState _unit; +private _anim = toLower animationState _unit; // stance is broken for some animations. -_stance = stance _unit; +private _stance = stance _unit; if (_anim find "ppne" == 4) then { _stance = "PRONE"; diff --git a/addons/common/functions/fnc_getDefinedVariable.sqf b/addons/common/functions/fnc_getDefinedVariable.sqf index ea22163622..32a75edb5e 100644 --- a/addons/common/functions/fnc_getDefinedVariable.sqf +++ b/addons/common/functions/fnc_getDefinedVariable.sqf @@ -15,15 +15,13 @@ params ["_unit", "_variable", "_defaultValue"]; -private "_value"; -_value = _unit getVariable _variable; +private _value = _unit getVariable _variable; if (isNil "_value") then { if (!isNil "_defaultValue") then { _value = _defaultValue; } else { - private "_definedVariable"; - _definedVariable = [_variable] call FUNC(getDefinedVariableInfo); + private _definedVariable = _variable call FUNC(getDefinedVariableInfo); if (count _definedVariable > 1) then { _value = _definedVariable select 1; diff --git a/addons/common/functions/fnc_getDefinedVariableDefault.sqf b/addons/common/functions/fnc_getDefinedVariableDefault.sqf index ba9ff20e23..c6f4f7711c 100644 --- a/addons/common/functions/fnc_getDefinedVariableDefault.sqf +++ b/addons/common/functions/fnc_getDefinedVariableDefault.sqf @@ -14,8 +14,7 @@ params ["_varName"]; -private "_variableDefinition"; -_variableDefinition = [_varName] call FUNC(getDefinedVariableInfo); +private _variableDefinition = _varName call FUNC(getDefinedVariableInfo); if !(_variableDefinition isEqualTo []) exitWith { _variableDefinition select 1; diff --git a/addons/common/functions/fnc_getDisplayConfigName.sqf b/addons/common/functions/fnc_getDisplayConfigName.sqf index 7a0d9ffa95..1660bbf804 100644 --- a/addons/common/functions/fnc_getDisplayConfigName.sqf +++ b/addons/common/functions/fnc_getDisplayConfigName.sqf @@ -16,12 +16,10 @@ params ["_idd"]; -private ["_configNames", "_config"]; - -_configNames = []; +private _configNames = []; for "_index" from 0 to (count configFile - 1) do { - _config = configFile select _index; + private _config = configFile select _index; if (isClass _config && {isNumber (_config >> "idd")} && {getNumber (_config >> "idd") == _idd}) then { _configNames pushBack configName _config; diff --git a/addons/common/functions/fnc_getDoorTurrets.sqf b/addons/common/functions/fnc_getDoorTurrets.sqf index cab259a214..533e2a7489 100644 --- a/addons/common/functions/fnc_getDoorTurrets.sqf +++ b/addons/common/functions/fnc_getDoorTurrets.sqf @@ -14,14 +14,12 @@ params ["_vehicle"]; -private ["_turrets", "_doorTurrets", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_doorTurrets = []; +private _doorTurrets = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getFirstObjectIntersection.sqf b/addons/common/functions/fnc_getFirstObjectIntersection.sqf index 1111094ed0..c4cc46ab9b 100644 --- a/addons/common/functions/fnc_getFirstObjectIntersection.sqf +++ b/addons/common/functions/fnc_getFirstObjectIntersection.sqf @@ -17,20 +17,16 @@ params ["_source", "_destination", "_accuracy"]; -private ["_result", "_distance"]; +private _result = [false, [0, 0, 0]]; -_result = [false, [0, 0, 0]]; - -_distance = _source vectorDistance _destination; +private _distance = _source vectorDistance _destination; if !(lineIntersectsWith [_source, _destination] isEqualTo []) then { - private ["_lower", "_upper", "_mid", "_dir"]; + private _lower = 0; + private _upper = 1; + private _mid = 0.5; - _lower = 0; - _upper = 1; - _mid = 0.5; - - _dir = _source vectorFromTo _destination; + private _dir = _source vectorFromTo _destination; while {(_upper - _lower) * _distance > _accuracy} do { _mid = _lower + (_upper - _lower) / 2; diff --git a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf index a5065413d9..27a6f3c613 100644 --- a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf +++ b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf @@ -17,20 +17,16 @@ params ["_source", "_destination", "_accuracy"]; -private ["_result", "_distance"]; +private _result = [false, [0, 0, 0]]; -_result = [false, [0, 0, 0]]; - -_distance = _source vectorDistance _destination; +private _distance = _source vectorDistance _destination; if (terrainIntersectASL [_source, _destination]) then { - private ["_lower", "_upper", "_mid", "_dir"]; + private _lower = 0; + private _upper = 1; + private _mid = 0.5; - _lower = 0; - _upper = 1; - _mid = 0.5; - - _dir = _source vectorFromTo _destination; + private _dir = _source vectorFromTo _destination; while {(_upper - _lower) * _distance > _accuracy} do { _mid = _lower + (_upper - _lower) / 2; diff --git a/addons/common/functions/fnc_getForceWalkStatus.sqf b/addons/common/functions/fnc_getForceWalkStatus.sqf index acdc2f1a05..89042b19dd 100644 --- a/addons/common/functions/fnc_getForceWalkStatus.sqf +++ b/addons/common/functions/fnc_getForceWalkStatus.sqf @@ -17,20 +17,7 @@ params ["_unit"]; -private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"]; +//Now just a wrapper for FUNC(statusEffect_get) [No longer used in ace as of 3.5] +ACE_DEPRECATED("ace_common_fnc_getForceWalkStatus","3.7.0","ace_common_fnc_statusEffect_get"); -_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []]; - -_unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; - -_unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber); - -_unitForceWalkReasons = []; - -{ - if (_unitForceWalkStatus select _forEachIndex) then { - _unitForceWalkReasons pushBack _x; - }; -} forEach _forceWalkReasons; - -_unitForceWalkReasons +([_unit, "forceWalk"] call FUNC(statusEffect_get)) select 1 diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf index dac42ce535..c11f2882ca 100644 --- a/addons/common/functions/fnc_getGunner.sqf +++ b/addons/common/functions/fnc_getGunner.sqf @@ -13,14 +13,13 @@ */ #include "script_component.hpp" -params ["_vehicle", "_weapon"]; +params [["_vehicle", objNull, [objNull]], ["_weapon", "", [""]]]; // on foot if (gunner _vehicle == _vehicle && {_weapon in weapons _vehicle || {toLower _weapon in ["throw", "put"]}}) exitWith {gunner _vehicle}; // inside vehicle -private "_gunner"; -_gunner = objNull; +private _gunner = objNull; { if (_weapon in (_vehicle weaponsTurret _x)) exitWith { @@ -31,7 +30,7 @@ _gunner = objNull; // ensure that at least the pilot is returned if there is no gunner if (isManualFire _vehicle && {isNull _gunner}) then { - _gunner = driver _vehicle; + _gunner = effectiveCommander _vehicle; }; _gunner diff --git a/addons/common/functions/fnc_getHitPoints.sqf b/addons/common/functions/fnc_getHitPoints.sqf deleted file mode 100644 index 84099b659a..0000000000 --- a/addons/common/functions/fnc_getHitPoints.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - * - * Arguments: - * 0: Vehicle - * - * Return Value: - * Hitpoints - * - * Public: Yes - * - * Deprecated - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_getHitPoints","3.5.0","getAllHitPointsDamage"); - -params ["_vehicle"]; - -private "_hitPointsWithSelections"; -_hitPointsWithSelections = getAllHitPointsDamage _vehicle; - -// get correct format on vehicles without any hitpoints -if (_hitPointsWithSelections isEqualTo []) then { - _hitPointsWithSelections = [[],[],[]]; -}; - -(_hitPointsWithSelections select 0) - [""] diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf deleted file mode 100644 index aef415a54f..0000000000 --- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author: commy2 - * Returns all hitpoints and their respective selections of any vehicle. Might contain duplicates for non unique hitpoints in turrets. - * - * Arguments: - * 0: Vehicle - * - * Return Value: - * 0: Hitpoints - * 1: Selections - * - * Public: Yes - * - * Deprecated - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_getHitPointsWithSelections","3.5.0","getAllHitPointsDamage"); - -params ["_vehicle"]; - -private "_hitPointsWithSelections"; -_hitPointsWithSelections = getAllHitPointsDamage _vehicle; - -// get correct format on vehicles without any hitpoints -if (_hitPointsWithSelections isEqualTo []) then { - _hitPointsWithSelections = [[],[],[]]; -}; - -_hitPointsWithSelections resize 2; - -_hitPointsWithSelections diff --git a/addons/common/functions/fnc_getInPosition.sqf b/addons/common/functions/fnc_getInPosition.sqf index dc3ad38cde..9ab15bacd5 100644 --- a/addons/common/functions/fnc_getInPosition.sqf +++ b/addons/common/functions/fnc_getInPosition.sqf @@ -25,15 +25,13 @@ _position = toLower _position; // general if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false}; -private ["_config", "_turret", "_isInside", "_script", "_enemiesInVehicle"]; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _turret = []; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_turret = []; +private _isInside = vehicle _unit == _vehicle; -_isInside = vehicle _unit == _vehicle; - -_script = {}; -_enemiesInVehicle = false; //Possible Side Restriction +private _script = {}; +private _enemiesInVehicle = false; //Possible Side Restriction { if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true}; @@ -96,8 +94,7 @@ switch (_position) do { }; case "turret" : { - private "_turrets"; - _turrets = [_vehicle] call FUNC(getTurretsOther); + private _turrets = [_vehicle] call FUNC(getTurretsOther); if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then { _script = [ @@ -122,8 +119,7 @@ switch (_position) do { }; case "ffv" : { - private "_turrets"; - _turrets = [_vehicle] call FUNC(getTurretsFFV); + private _turrets = [_vehicle] call FUNC(getTurretsFFV); if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then { _script = [ @@ -148,8 +144,7 @@ switch (_position) do { }; case "codriver" : { - private "_positions"; - _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver); + private _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver); { if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))}; @@ -207,11 +202,9 @@ switch (_position) do { }; // this will execute all config based event handlers. Not script based ones unfortunately, but atleast we don't use any. -private "_fnc_getInEH"; -_fnc_getInEH = { - private "_config"; +private _fnc_getInEH = { // config based getIn EHs are assigned to the soldier, not the vehicle. Why Bis? Why? - _config = configFile >> "CfgVehicles" >> typeOf _unit >> "EventHandlers"; + private _config = configFile >> "CfgVehicles" >> typeOf _unit >> "EventHandlers"; if (isClass _config) then { //getIn is local effects with global arguments. It doesn't trigger if the unit was already inside and only switched seats diff --git a/addons/common/functions/fnc_getItemType.sqf b/addons/common/functions/fnc_getItemType.sqf index ec20b46f74..d3eb511949 100644 --- a/addons/common/functions/fnc_getItemType.sqf +++ b/addons/common/functions/fnc_getItemType.sqf @@ -15,23 +15,21 @@ params ["_item"]; -private ["_cfgType", "_config", "_type", "_simulation", "_default"]; - -_cfgType = [_item] call FUNC(getConfigType); +private _cfgType = [_item] call FUNC(getConfigType); if (_cfgType == "") exitWith {["", ""]}; if (_cfgType == "CfgGlasses") exitWith {["item", "glasses"]}; -_config = configFile >> _cfgType >> _item; -_type = getNumber (_config >> "type"); -_simulation = getText (_config >> "simulation"); +private _config = configFile >> _cfgType >> _item; +private _type = getNumber (_config >> "type"); +private _simulation = getText (_config >> "simulation"); if (isNumber (_config >> "ItemInfo" >> "type")) then { _type = getNumber (_config >> "ItemInfo" >> "type"); }; -_default = ["item", "magazine"] select (_cfgType == "CfgMagazines"); +private _default = ["item", "magazine"] select (_cfgType == "CfgMagazines"); switch (true) do { case (_type == 0): {[_default, "unknown"]}; diff --git a/addons/common/functions/fnc_getLightProperties.sqf b/addons/common/functions/fnc_getLightProperties.sqf index bbaf955a8b..a376dff841 100644 --- a/addons/common/functions/fnc_getLightProperties.sqf +++ b/addons/common/functions/fnc_getLightProperties.sqf @@ -19,14 +19,12 @@ params ["_vehicle", "_light"]; -private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"]; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light; - -_intensity = getNumber (_config >> "intensity"); -_position = getText (_config >> "position"); -_direction = getText (_config >> "direction"); -_innerAngle = getNumber (_config >> "innerAngle"); -_outerAngle = getNumber (_config >> "outerAngle"); +private _intensity = getNumber (_config >> "intensity"); +private _position = getText (_config >> "position"); +private _direction = getText (_config >> "direction"); +private _innerAngle = getNumber (_config >> "innerAngle"); +private _outerAngle = getNumber (_config >> "outerAngle"); [_intensity, _position, _direction, _innerAngle, _outerAngle] diff --git a/addons/common/functions/fnc_getLightPropertiesWeapon.sqf b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf index 01567fee58..44c866e67f 100644 --- a/addons/common/functions/fnc_getLightPropertiesWeapon.sqf +++ b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf @@ -18,16 +18,12 @@ params ["_weapon"]; -// @todo: Can weapons themselves still have flashlights (no attachment)? +private _config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight"; -private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"]; - -_config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight"; - -_intensity = getNumber (_config >> "intensity"); -_position = getText (_config >> "position"); -_direction = getText (_config >> "direction"); -_innerAngle = getNumber (_config >> "innerAngle"); -_outerAngle = getNumber (_config >> "outerAngle"); +private _intensity = getNumber (_config >> "intensity"); +private _position = getText (_config >> "position"); +private _direction = getText (_config >> "direction"); +private _innerAngle = getNumber (_config >> "innerAngle"); +private _outerAngle = getNumber (_config >> "outerAngle"); [_intensity, _position, _direction, _innerAngle, _outerAngle] diff --git a/addons/common/functions/fnc_getMGRSdata.sqf b/addons/common/functions/fnc_getMGRSdata.sqf index b4f10db8a4..ee6d1e11dc 100644 --- a/addons/common/functions/fnc_getMGRSdata.sqf +++ b/addons/common/functions/fnc_getMGRSdata.sqf @@ -18,11 +18,9 @@ params [["_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"); +private _long = getNumber (configFile >> "CfgWorlds" >> _map >> "longitude"); +private _lat = getNumber (configFile >> "CfgWorlds" >> _map >> "latitude"); +private _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,14 +44,14 @@ 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; +private _UTM = [_long,_lat] call BIS_fnc_posDegToUTM; +private _easting = _UTM select 0; +private _northing = _UTM select 1; +//private _zone = _UTM select 2; TRACE_4("",_UTM,_easting,_northing,_zone); /* -_band = switch (true) do { +private _band = switch (true) do { case (_lat<-72): {"C"}; case (_lat<-64): {"D"}; case (_lat<-56): {"E"}; @@ -77,8 +75,8 @@ _band = switch (true) do { }; */ -_zone = 1 + (floor ((_long + 180) / 6)); -_band = "Z"; +private _zone = 1 + (floor ((_long + 180) / 6)); +private _band = "Z"; if (_lat <= -80) then { _band = "A"; @@ -90,17 +88,17 @@ if (_lat <= -80) then { if (_map == "VR") then {_zone = 0; _band = "RV";}; -_GZD = format ["%1%2",_zone,_band]; +private _GZD = format ["%1%2",_zone,_band]; TRACE_3("",_zone,_band,_GZD); -private ["_set1", "_set2", "_set3", "_set4", "_set5", "_set6", "_metaE", "_metaN", "_letterE", "_letterN", "_grid100km"]; +private ["_metaE", "_metaN", "_letterE", "_letterN"]; -_set1 = [1,7,13,19,25,31,37,43,49,55]; -_set2 = [2,8,14,20,26,32,38,44,50,56]; -_set3 = [3,9,15,21,27,33,39,45,51,57]; -_set4 = [4,10,16,22,28,34,40,46,52,58]; -_set5 = [5,11,17,23,29,35,41,47,53,59]; -_set6 = [6,12,18,24,30,36,42,48,54,60]; +private _set1 = [1,7,13,19,25,31,37,43,49,55]; +private _set2 = [2,8,14,20,26,32,38,44,50,56]; +private _set3 = [3,9,15,21,27,33,39,45,51,57]; +private _set4 = [4,10,16,22,28,34,40,46,52,58]; +private _set5 = [5,11,17,23,29,35,41,47,53,59]; +private _set6 = [6,12,18,24,30,36,42,48,54,60]; switch (true) do { case (_zone in _set1): {_metaE = 1; _metaN = 1;}; @@ -154,7 +152,7 @@ switch (true) do { }; TRACE_1("",_letterN); -_grid100km = _letterE + _letterN; +private _grid100km = _letterE + _letterN; TRACE_1("",_grid100km); if (_map == worldName) then { diff --git a/addons/common/functions/fnc_getMapGridData.sqf b/addons/common/functions/fnc_getMapGridData.sqf index c74f378d75..be87a8585b 100644 --- a/addons/common/functions/fnc_getMapGridData.sqf +++ b/addons/common/functions/fnc_getMapGridData.sqf @@ -19,20 +19,18 @@ 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"); -_offsetY = getNumber (_cfgGrid >> "offsetY"); -_zoomMax = 1e99; -_formatX = ""; -_formatY = ""; -_stepX = 1e10; -_stepY = 1e10; +private _cfgGrid = configFile >> "CfgWorlds" >> worldName >> "Grid"; +private _offsetX = getNumber (_cfgGrid >> "offsetX"); +private _offsetY = getNumber (_cfgGrid >> "offsetY"); +private _zoomMax = 1e99; +private _formatX = ""; +private _formatY = ""; +private _stepX = 1e10; +private _stepY = 1e10; { - _zoom = getnumber (_x >> "zoomMax"); + private _zoom = getnumber (_x >> "zoomMax"); if (_zoom < _zoomMax) then { _zoomMax = _zoom; _formatX = getText (_x >> "formatX"); @@ -43,7 +41,7 @@ _stepY = 1e10; false } count configProperties [_cfgGrid, "isClass _x", false]; -_letterGrid = false; +private _letterGrid = false; if (toLower _formatX find "a" != -1) then {_letterGrid = true}; if (toLower _formatY find "a" != -1) then {_letterGrid = true}; @@ -53,9 +51,9 @@ if (_letterGrid) exitWith { }; //Start at [0, 500] and move north until we get a change in grid -_heightOffset = 500; -_startGrid = mapGridPosition [0, _heightOffset]; -_originGrid = _startGrid; +private _heightOffset = 500; +private _startGrid = mapGridPosition [0, _heightOffset]; +private _originGrid = _startGrid; while {_startGrid == _originGrid} do { _heightOffset = _heightOffset + 1; @@ -63,7 +61,7 @@ while {_startGrid == _originGrid} do { }; //Calculate the real y offset -_realOffsetY = (parseNumber (_originGrid select [count _formatX, count _formatY])) * _stepY + _heightOffset - 1; +private _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); diff --git a/addons/common/functions/fnc_getMapGridFromPos.sqf b/addons/common/functions/fnc_getMapGridFromPos.sqf index 1f946a6e80..8604d68fa6 100644 --- a/addons/common/functions/fnc_getMapGridFromPos.sqf +++ b/addons/common/functions/fnc_getMapGridFromPos.sqf @@ -19,24 +19,22 @@ params ["_pos", ["_returnSingleString", false]]; -private ["_nativeGrid", "_count", "_easting", "_northing"]; - //Fallback, when map data is weird (letters) if (GVAR(mapGridData) isEqualTo []) exitWith { - _nativeGrid = mapGridPosition _pos; + private _nativeGrid = mapGridPosition _pos; if (_returnSingleString) then { _nativeGrid } else { - _count = floor ((count _nativeGrid) / 2); + private _count = floor ((count _nativeGrid) / 2); [_nativeGrid select [0, _count], _nativeGrid select [_count, _count]] }; }; GVAR(mapGridData) params ["_offsetX", "_realOffsetY", "_stepXat5", "_stepYat5"]; -_easting = floor (((_pos select 0) - _offsetX) / _stepXat5); -_northing = floor (((_pos select 1) - _realOffsetY) / _stepYat5); +private _easting = floor (((_pos select 0) - _offsetX) / _stepXat5); +private _northing = floor (((_pos select 1) - _realOffsetY) / _stepYat5); //Attempt to handle negative east/north (e.g.: moving west of map bounds) if (_easting > 0) then { diff --git a/addons/common/functions/fnc_getMapPosFromGrid.sqf b/addons/common/functions/fnc_getMapPosFromGrid.sqf index 5ba67a40bf..a148679fa9 100644 --- a/addons/common/functions/fnc_getMapPosFromGrid.sqf +++ b/addons/common/functions/fnc_getMapPosFromGrid.sqf @@ -25,17 +25,15 @@ if (count GVAR(mapGridData) == 0) exitWith { GVAR(mapGridData) params ["_offsetX", "_realOffsetY", "_stepXat5", "_stepYat5"]; -private ["_countInput", "_countInputHalf", "_xPart", "_yPart", "_xPos", "_yPos"]; - -_countInput = count _inputString; -_countInputHalf = floor (_countInput / 2); +private _countInput = count _inputString; +private _countInputHalf = floor (_countInput / 2); //Split string, ignoring middle -_xPart = _inputString select [0, _countInputHalf]; -_yPart = _inputString select [ceil (_countInput / 2), _countInputHalf]; +private _xPart = _inputString select [0, _countInputHalf]; +private _yPart = _inputString select [ceil (_countInput / 2), _countInputHalf]; -_xPos = ((parseNumber _xPart) * _stepXat5 * 10 ^ (5 - _countInputHalf)) + _offsetX; -_yPos = ((parseNumber _yPart) * _stepYat5 * 10 ^ (5 - _countInputHalf)) + _realOffsetY; +private _xPos = ((parseNumber _xPart) * _stepXat5 * 10 ^ (5 - _countInputHalf)) + _offsetX; +private _yPos = ((parseNumber _yPart) * _stepYat5 * 10 ^ (5 - _countInputHalf)) + _realOffsetY; if (_getCenterOfGrid) then { _xPos = _xPos + 0.5 * _stepXat5 * 10 ^ (5 - _countInputHalf); diff --git a/addons/common/functions/fnc_getMarkerType.sqf b/addons/common/functions/fnc_getMarkerType.sqf index 7c99302d8f..0da7f1a46e 100644 --- a/addons/common/functions/fnc_getMarkerType.sqf +++ b/addons/common/functions/fnc_getMarkerType.sqf @@ -14,11 +14,9 @@ params ["_group"]; -private ["_leader", "_vehicle", "_side"]; - -_leader = leader _group; -_vehicle = vehicle _leader; -_side = side _leader; +private _leader = leader _group; +private _vehicle = vehicle _leader; +private _side = side _leader; if (_vehicle == _leader) exitWith { if ( diff --git a/addons/common/functions/fnc_getNumberMagazinesIn.sqf b/addons/common/functions/fnc_getNumberMagazinesIn.sqf index df1f7ed64b..87f92979eb 100644 --- a/addons/common/functions/fnc_getNumberMagazinesIn.sqf +++ b/addons/common/functions/fnc_getNumberMagazinesIn.sqf @@ -15,8 +15,7 @@ params ["_unit", "_magazine"]; -private "_return"; -_return = 0; +private _return = 0; if (_unit isKindOf "CAManBase") then { _return = {_x == _magazine} count magazines _unit; diff --git a/addons/common/functions/fnc_getReflectorsWithSelections.sqf b/addons/common/functions/fnc_getReflectorsWithSelections.sqf index ef2b908bde..248050486c 100644 --- a/addons/common/functions/fnc_getReflectorsWithSelections.sqf +++ b/addons/common/functions/fnc_getReflectorsWithSelections.sqf @@ -18,23 +18,18 @@ params ["_vehicle"]; -private ["_config", "_hitpoints", "_selections"]; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; - -_hitpoints = []; -_selections = []; +private _hitpoints = []; +private _selections = []; // iterate through all parents while {isClass _config} do { - private "_class"; - _class = _config >> "Reflectors"; + private _class = _config >> "Reflectors"; for "_i" from 0 to (count _class - 1) do { - private ["_entry", "_selection"]; - - _entry = _class select _i; - _selection = getText (_entry >> "hitpoint"); + private _entry = _class select _i; + private _selection = getText (_entry >> "hitpoint"); if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { _hitpoints pushBack configName _entry; diff --git a/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf b/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf index 277155108a..b46ec308ec 100644 --- a/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf +++ b/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf @@ -13,11 +13,9 @@ params ["_vehicle"]; -private ["_hitPointsFull", "_allSelectionsWithoutHitpoints"]; +private _hitPointsFull = getAllHitPointsDamage _vehicle; -_hitPointsFull = getAllHitPointsDamage _vehicle; - -_allSelectionsWithoutHitpoints = []; +private _allSelectionsWithoutHitpoints = []; { if (_x == "") then { diff --git a/addons/common/functions/fnc_getSettingData.sqf b/addons/common/functions/fnc_getSettingData.sqf index de9ef40447..ae9dd5351e 100644 --- a/addons/common/functions/fnc_getSettingData.sqf +++ b/addons/common/functions/fnc_getSettingData.sqf @@ -23,12 +23,13 @@ params ["_name"]; -private "_value"; -_value = []; +scopeName "main"; { - if (_x select 0 == _name) exitWith {_value = _x}; + if (_x select 0 == _name) then { + _x breakOut "main"; + }; false } count GVAR(settings); -_value +[] diff --git a/addons/common/functions/fnc_getStringFromMissionSQM.sqf b/addons/common/functions/fnc_getStringFromMissionSQM.sqf index 6b6a34cfb7..0893b7bb0d 100644 --- a/addons/common/functions/fnc_getStringFromMissionSQM.sqf +++ b/addons/common/functions/fnc_getStringFromMissionSQM.sqf @@ -14,13 +14,11 @@ */ #include "script_component.hpp" -private ["_path", "_mission", "_class", "_index", "_array", "_entry"]; - -_path = _this; +[_this] params ["_path", [], [[]]]; if (missionName == "") exitWith {""}; -_mission = toArray toLower loadFile "mission.sqm"; +private _mission = toArray toLower loadFile "mission.sqm"; _mission resize 65536; { @@ -34,11 +32,9 @@ _mission = toString (_mission - [-1]); {_path set [_forEachIndex, toLower _x]} forEach _path; for "_a" from 0 to (count _path - 2) do { - _class = format ["class%1{", _path select _a]; - - _index = _mission find _class; - - _array = toArray _mission; + private _class = format ["class%1{", _path select _a]; + private _index = _mission find _class; + private _array = toArray _mission; for "_b" from 0 to (_index + count toArray _class - 1) do { _array set [_b, -1]; @@ -49,7 +45,7 @@ for "_a" from 0 to (count _path - 2) do { _mission = toString _array; }; -_entry = format ["%1=", _path select (count _path - 1)]; +private _entry = format ["%1=", _path select (count _path - 1)]; _index = _mission find _entry; if (_index == -1) exitWith {""}; diff --git a/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf b/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf index da23e600aa..0d2343bec9 100644 --- a/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf +++ b/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf @@ -13,13 +13,11 @@ */ #include "script_component.hpp" -private ["_position", "_direction", "_azimuth", "_inclination"]; +private _position = ATLToASL positionCameraToWorld [0, 0, 0]; +private _direction = ATLToASL positionCameraToWorld [0, 0, 1]; -_position = ATLToASL positionCameraToWorld [0, 0, 0]; -_direction = ATLToASL positionCameraToWorld [0, 0, 1]; - -_azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction select 1) - (_position select 1)); -_inclination = asin ((_direction select 2) - (_position select 2)); +private _azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction select 1) - (_position select 1)); +private _inclination = asin ((_direction select 2) - (_position select 2)); if (_azimuth < 0) then {_azimuth = _azimuth + 360}; diff --git a/addons/common/functions/fnc_getTargetDistance.sqf b/addons/common/functions/fnc_getTargetDistance.sqf index fe75268cea..000f0ae31d 100644 --- a/addons/common/functions/fnc_getTargetDistance.sqf +++ b/addons/common/functions/fnc_getTargetDistance.sqf @@ -1,11 +1,11 @@ /* - * Author: commy2 + * Author: VKing * Get the distance to the next object the player is looking at. Used for laser distance measurements. * * Arguments: - * 0: Messurement Accuracy - * 1: Maximal messure distance - * 2: Minimal messure distance (default: nil) + * 0: Measurement Accuracy (default: 1) + * 1: Maximum measure distance (default: 5000) + * 2: Minimum measure distance (default: 0) * * Return Value: * Distance in meters @@ -14,35 +14,23 @@ */ #include "script_component.hpp" -params ["_interval", "_maxDistance", "_minDistance"]; +params [["_accuracy",1], ["_maxDistance",5000], ["_minDistance",0]]; -private ["_position", "_laser", "_line", "_distance", "_iteration"]; +private _camPosition = AGLToASL positionCameraToWorld [0, 0, 0]; +private _aimLinePos = AGLToASL positionCameraToWorld [0, 0, _maxDistance]; -_position = ATLToASL positionCameraToWorld [0, 0, 0]; -_position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)]; +private _LIS = lineIntersectsSurfaces [_camPosition, _aimLinePos]; -_laser = + _position; -_line = [_position, _laser]; - -_distance = _maxDistance; -_iteration = _distance; - -while { - _iteration > _interval / 2 -} do { - _iteration = _iteration / 2; - - _laser = ATLToASL positionCameraToWorld [0, 0, _distance]; - _laser set [2, (_laser select 2) - (getTerrainHeightASL _laser min 0)]; - _line set [1, _laser]; - - _distance = _distance + (([1, -1] select (lineIntersects (_line + [vehicle ACE_player]) || {terrainIntersectASL _line})) * _iteration); +private _distance = 0; +if (count _LIS > 0) then { + _distance = _camPosition vectorDistance ((_LIS select 0) select 0); +} else { + _distance = _maxDistance; }; -_distance = _interval * round (_distance / _interval); +_distance = _distance max _minDistance; -_distance = _distance min _maxDistance; - -if (!isNil "_minDistance") then {_distance = _distance max _minDistance}; +_accuracy = _accuracy max 1; +_distance = (round (_distance/_accuracy)) * _accuracy; _distance diff --git a/addons/common/functions/fnc_getTargetObject.sqf b/addons/common/functions/fnc_getTargetObject.sqf index adaaa3e344..ed757dedf4 100644 --- a/addons/common/functions/fnc_getTargetObject.sqf +++ b/addons/common/functions/fnc_getTargetObject.sqf @@ -14,15 +14,13 @@ params ["_maxDistance"]; -private ["_position", "_laser", "_intersects"]; - -_position = ATLToASL positionCameraToWorld [0, 0, 0]; +private _position = ATLToASL positionCameraToWorld [0, 0, 0]; _position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)]; -_laser = ATLToASL positionCameraToWorld [0, 0, _maxDistance]; +private _laser = ATLToASL positionCameraToWorld [0, 0, _maxDistance]; _laser set [2, (_laser select 2) - (getTerrainHeightASL _laser min 0)]; -_intersects = lineIntersectsObjs [_position, _laser, objNull, objNull, true, 2]; +private _intersects = lineIntersectsObjs [_position, _laser, objNull, objNull, true, 2]; if (_intersects isEqualTo []) exitWith {objNull}; diff --git a/addons/common/functions/fnc_getTurnedOnLights.sqf b/addons/common/functions/fnc_getTurnedOnLights.sqf index 0d71a3362e..a996e146d2 100644 --- a/addons/common/functions/fnc_getTurnedOnLights.sqf +++ b/addons/common/functions/fnc_getTurnedOnLights.sqf @@ -16,15 +16,12 @@ params ["_vehicle"]; if (!isLightOn _vehicle) exitWith {[]}; -private ["_reflectorsWithSelections", "_lights", "_hitpoints", "_turnedOnLights"]; - -_reflectorsWithSelections = [[_vehicle], FUNC(getReflectorsWithSelections), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getReflectorsWithSelections)), typeOf _vehicle], 1E11] call FUNC(cachedCall); +private _reflectorsWithSelections = [[_vehicle], FUNC(getReflectorsWithSelections), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getReflectorsWithSelections)), typeOf _vehicle], 1E11] call FUNC(cachedCall); //_reflectorsWithSelections = [_vehicle] call FUNC(getReflectorsWithSelections); -_lights = _reflectorsWithSelections select 0; -_hitpoints = _reflectorsWithSelections select 1; +_reflectorsWithSelections params ["_lights", "_hitpoints"]; -_turnedOnLights = []; +private _turnedOnLights = []; { if (_vehicle getHit _x <= 0.9) then { diff --git a/addons/common/functions/fnc_getTurretCommander.sqf b/addons/common/functions/fnc_getTurretCommander.sqf index e045c2d46f..e73795e148 100644 --- a/addons/common/functions/fnc_getTurretCommander.sqf +++ b/addons/common/functions/fnc_getTurretCommander.sqf @@ -12,16 +12,14 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getTurretConfigPath.sqf b/addons/common/functions/fnc_getTurretConfigPath.sqf index 07d7ac4e0c..95d0773fd3 100644 --- a/addons/common/functions/fnc_getTurretConfigPath.sqf +++ b/addons/common/functions/fnc_getTurretConfigPath.sqf @@ -15,14 +15,12 @@ params ["_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; + private _offset = 0; + private _config2 = _config select 0; + private _foundClasses = 0; for "_a" from 0 to (count _config - 1) do { if (isClass _config2) then { diff --git a/addons/common/functions/fnc_getTurretCopilot.sqf b/addons/common/functions/fnc_getTurretCopilot.sqf index 94a30b7697..6161f5c4cc 100644 --- a/addons/common/functions/fnc_getTurretCopilot.sqf +++ b/addons/common/functions/fnc_getTurretCopilot.sqf @@ -12,16 +12,14 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getTurretDirection.sqf b/addons/common/functions/fnc_getTurretDirection.sqf index ced29a9a85..92c84cdca9 100644 --- a/addons/common/functions/fnc_getTurretDirection.sqf +++ b/addons/common/functions/fnc_getTurretDirection.sqf @@ -16,30 +16,25 @@ params ["_vehicle", "_position"]; -private ["_turret", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir"]; +private _turret = [_vehicle, _position] call CBA_fnc_getTurret; -_turret = [_vehicle, _position] call CBA_fnc_getTurret; - -_pov = getText (_turret >> "memoryPointGunnerOptics"); -_gunBeg = getText (_turret >> "gunBeg"); -_gunEnd = getText (_turret >> "gunEnd"); +private _pov = getText (_turret >> "memoryPointGunnerOptics"); +private _gunBeg = getText (_turret >> "gunBeg"); +private _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)); //@todo AGLToASL ? -_povDir = [0,0,0]; +private _povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ? +private _povDir = [0,0,0]; if (_pov == "pip0_pos") then { - private "_pipDir"; - _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir")); + private _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir")); _povDir = _pipDir vectorDiff _povPos; } else { - private ["_gunBeginPos", "_gunEndPos"]; - - _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg)); - _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd)); + private _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg)); + private _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd)); _povDir = _gunBeginPos vectorDiff _gunEndPos; }; diff --git a/addons/common/functions/fnc_getTurretGunner.sqf b/addons/common/functions/fnc_getTurretGunner.sqf index 9a71d292bd..6f59798cc6 100644 --- a/addons/common/functions/fnc_getTurretGunner.sqf +++ b/addons/common/functions/fnc_getTurretGunner.sqf @@ -12,16 +12,14 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getTurretIndex.sqf b/addons/common/functions/fnc_getTurretIndex.sqf index 20ee178bf1..df2d540873 100644 --- a/addons/common/functions/fnc_getTurretIndex.sqf +++ b/addons/common/functions/fnc_getTurretIndex.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; private _vehicle = vehicle _unit; if (_unit == _vehicle) exitWith {[]}; diff --git a/addons/common/functions/fnc_getTurrets.sqf b/addons/common/functions/fnc_getTurrets.sqf index 9a1a48e2bd..229f3ab1f7 100644 --- a/addons/common/functions/fnc_getTurrets.sqf +++ b/addons/common/functions/fnc_getTurrets.sqf @@ -16,33 +16,25 @@ params ["_type"]; -private ["_varName", "_turrets"]; - -_varName = format [QGVAR(CachedTurrets_%1), _type]; -_turrets = + (uiNamespace getVariable _varName); +private _varName = format [QGVAR(CachedTurrets_%1), _type]; +private _turrets = + (uiNamespace getVariable _varName); if (!isNil "_turrets") exitWith {_turrets}; -private ["_config", "_fnc_addTurret"]; - -_config = configFile >> "CfgVehicles" >> _type; +private _config = configFile >> "CfgVehicles" >> _type; _turrets = []; -_fnc_addTurret = { +private _fnc_addTurret = { params ["_config", "_path"]; _config = _config >> "Turrets"; - private ["_count", "_offset", "_path2", "_config2"]; + private _offset = 0; - _count = count _config; - - _offset = 0; - - for "_index" from 0 to (_count - 1) do { - _path2 = _path + [_index - _offset]; - _config2 = _config select _index; + for "_index" from 0 to (count _config - 1) do { + private _path2 = _path + [_index - _offset]; + private _config2 = _config select _index; if (isClass _config2) then { _turrets pushBack _path2; diff --git a/addons/common/functions/fnc_getTurretsFFV.sqf b/addons/common/functions/fnc_getTurretsFFV.sqf index ff7726d1be..8c471824cf 100644 --- a/addons/common/functions/fnc_getTurretsFFV.sqf +++ b/addons/common/functions/fnc_getTurretsFFV.sqf @@ -12,16 +12,14 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getTurretsOther.sqf b/addons/common/functions/fnc_getTurretsOther.sqf index 93ab3f2321..408a5529d5 100644 --- a/addons/common/functions/fnc_getTurretsOther.sqf +++ b/addons/common/functions/fnc_getTurretsOther.sqf @@ -12,23 +12,22 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); - if ( getNumber (_config >> "isCopilot") != 1 - && {getNumber (_config >> "primaryGunner") != 1} - && {getNumber (_config >> "primaryObserver") != 1} - && {getNumber (_config >> "isPersonTurret") != 1} + if ( + getNumber (_config >> "isCopilot") != 1 + && {getNumber (_config >> "primaryGunner") != 1} + && {getNumber (_config >> "primaryObserver") != 1} + && {getNumber (_config >> "isPersonTurret") != 1} ) then { _turret pushBack _x; }; diff --git a/addons/common/functions/fnc_getUavControlPosition.sqf b/addons/common/functions/fnc_getUavControlPosition.sqf index a9b5340eb2..c98004c7e7 100644 --- a/addons/common/functions/fnc_getUavControlPosition.sqf +++ b/addons/common/functions/fnc_getUavControlPosition.sqf @@ -18,16 +18,14 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private ["_uav", "_positionArray", "_playerIndex"]; - -_uav = getConnectedUAV _unit; +private _uav = getConnectedUAV _unit; if (isNull _uav) exitWith {""}; -_positionArray = UAVControl _uav; -_playerIndex = _positionArray find _unit; +private _positionArray = UAVControl _uav; +private _playerIndex = _positionArray find _unit; if (_playerIndex == -1) exitWith {""}; diff --git a/addons/common/functions/fnc_getVehicleCargo.sqf b/addons/common/functions/fnc_getVehicleCargo.sqf index 5be213aa68..68599c919b 100644 --- a/addons/common/functions/fnc_getVehicleCargo.sqf +++ b/addons/common/functions/fnc_getVehicleCargo.sqf @@ -12,14 +12,12 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_config", "_cargo", "_codrivers"]; +private _config = configFile >> "CfgVehicles" >> _vehicle; -_config = configFile >> "CfgVehicles" >> _vehicle; - -_cargo = []; -_codrivers = getArray (_config >> "cargoIsCoDriver"); +private _cargo = []; +private _codrivers = getArray (_config >> "cargoIsCoDriver"); for "_index" from 0 to (getNumber (_config >> "transportSoldier") - 1) do { if !(_index in _codrivers && {_vehicle isKindOf "Car"} && {!(_vehicle isKindOf "Wheeled_APC_F")}) then { diff --git a/addons/common/functions/fnc_getVehicleCodriver.sqf b/addons/common/functions/fnc_getVehicleCodriver.sqf index e23cfcd0d4..a1cc5814e1 100644 --- a/addons/common/functions/fnc_getVehicleCodriver.sqf +++ b/addons/common/functions/fnc_getVehicleCodriver.sqf @@ -12,14 +12,12 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_config", "_cargo", "_codrivers"]; +private _config = configFile >> "CfgVehicles" >> _vehicle; -_config = configFile >> "CfgVehicles" >> _vehicle; - -_cargo = []; -_codrivers = getArray (_config >> "cargoIsCoDriver"); +private _cargo = []; +private _codrivers = getArray (_config >> "cargoIsCoDriver"); for "_index" from 0 to (getNumber (_config >> "transportSoldier") - 1) do { if (_index in _codrivers && {_vehicle isKindOf "Car"} && {!(_vehicle isKindOf "Wheeled_APC_F")}) then { diff --git a/addons/common/functions/fnc_getVehicleCrew.sqf b/addons/common/functions/fnc_getVehicleCrew.sqf index 58d0067b85..adb0e9701a 100644 --- a/addons/common/functions/fnc_getVehicleCrew.sqf +++ b/addons/common/functions/fnc_getVehicleCrew.sqf @@ -15,8 +15,7 @@ params ["_vehicle", ["_types", ["driver", "commander", "gunner", "turret", "cargo", "ffv"]]]; -private "_crew"; -_crew = []; +private _crew = []; // iterate through all crew members { diff --git a/addons/common/functions/fnc_getVehicleUAVCrew.sqf b/addons/common/functions/fnc_getVehicleUAVCrew.sqf index 8d9156810a..2b2281ed10 100644 --- a/addons/common/functions/fnc_getVehicleUAVCrew.sqf +++ b/addons/common/functions/fnc_getVehicleUAVCrew.sqf @@ -12,6 +12,6 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -[crew _vehicle, {getText (configFile >> "CfgVehicles" >> typeOf _this >> "simulation") == "UAVPilot"}] call FUNC(filter) // return +crew _vehicle select {getText (configFile >> "CfgVehicles" >> typeOf _x >> "simulation") == "UAVPilot"} // return diff --git a/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf b/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf index 09968d8e39..f7c7909e01 100644 --- a/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf +++ b/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf @@ -15,12 +15,10 @@ params ["_weapon"]; -private ["_direction", "_azimuth", "_inclination"]; +private _direction = ACE_player weaponDirection _weapon; -_direction = ACE_player weaponDirection _weapon; - -_azimuth = (_direction select 0) atan2 (_direction select 1); -_inclination = asin (_direction select 2); +private _azimuth = (_direction select 0) atan2 (_direction select 1); +private _inclination = asin (_direction select 2); if (_azimuth < 0) then {_azimuth = _azimuth + 360}; diff --git a/addons/common/functions/fnc_getWeaponModes.sqf b/addons/common/functions/fnc_getWeaponModes.sqf index a2bb9c3205..48755d3a9b 100644 --- a/addons/common/functions/fnc_getWeaponModes.sqf +++ b/addons/common/functions/fnc_getWeaponModes.sqf @@ -12,13 +12,11 @@ */ #include "script_component.hpp" -params ["_weapon"]; +params [["_weapon", "", [""]]]; -private ["_config", "_modes"]; +private _config = configFile >> "CfgWeapons" >> _weapon; -_config = configFile >> "CfgWeapons" >> _weapon; - -_modes = []; +private _modes = []; { if (getNumber (_config >> _x >> "showToPlayer") == 1) then { diff --git a/addons/common/functions/fnc_getWeaponMuzzles.sqf b/addons/common/functions/fnc_getWeaponMuzzles.sqf index cdfd58f238..d75a01f2e3 100644 --- a/addons/common/functions/fnc_getWeaponMuzzles.sqf +++ b/addons/common/functions/fnc_getWeaponMuzzles.sqf @@ -12,13 +12,14 @@ */ #include "script_component.hpp" -params ["_weapon"]; +params [["_weapon", "", [""]]]; -private "_muzzles"; -_muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); +private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); -if ("this" in _muzzles) then { - _muzzles set [_muzzles find "this", _weapon]; -}; +{ + if (_x == "this") then { + _muzzles set [_forEachIndex, _weapon]; + }; +} forEach _muzzles; _muzzles diff --git a/addons/common/functions/fnc_getWeaponState.sqf b/addons/common/functions/fnc_getWeaponState.sqf index 8ee1610f4e..e7b7bb80ec 100644 --- a/addons/common/functions/fnc_getWeaponState.sqf +++ b/addons/common/functions/fnc_getWeaponState.sqf @@ -18,17 +18,13 @@ params ["_unit", "_weapon"]; -private ["_muzzles", "_weaponInfo"]; +private _muzzles = _weapon call FUNC(getWeaponMuzzles); -_muzzles = [_weapon] call FUNC(getWeaponMuzzles); - -_weaponInfo = [["","","",""], primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit] select ((["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find _weapon) max 0); +private _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"]; - -_magazines = []; -_ammo = []; +private _magazines = []; +private _ammo = []; { _magazines pushBack ""; @@ -38,8 +34,7 @@ _ammo = []; { if (_x select 2) then { - private "_index"; - _index = _muzzles find (_x select 4); + private _index = _muzzles find (_x select 4); if (_index != -1) then { _magazines set [_index, _x select 0]; diff --git a/addons/common/functions/fnc_getWeaponType.sqf b/addons/common/functions/fnc_getWeaponType.sqf index f8ee7f9fe4..5666ea5bc0 100644 --- a/addons/common/functions/fnc_getWeaponType.sqf +++ b/addons/common/functions/fnc_getWeaponType.sqf @@ -18,11 +18,9 @@ params ["_weapon"]; -private ["_type", "_index"]; +private _type = [getNumber (configFile >> "CfgWeapons" >> _weapon >> "type")] call FUNC(binarizeNumber); -_type = [getNumber (configFile >> "CfgWeapons" >> _weapon >> "type")] call FUNC(binarizeNumber); - -_index = 0; +private _index = 0; while {!(_type select _index) && {_index < 16}} do { _index = _index + 1; diff --git a/addons/common/functions/fnc_hadamardProduct.sqf b/addons/common/functions/fnc_hadamardProduct.sqf index b4ed7f9be1..cdaf707395 100644 --- a/addons/common/functions/fnc_hadamardProduct.sqf +++ b/addons/common/functions/fnc_hadamardProduct.sqf @@ -16,8 +16,7 @@ params ["_vector1", "_vector2"]; -private "_newVector"; -_newVector = []; +private _newVector = []; 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_handleModifierKeyInit.sqf b/addons/common/functions/fnc_handleModifierKeyInit.sqf deleted file mode 100644 index a945f5eba1..0000000000 --- a/addons/common/functions/fnc_handleModifierKeyInit.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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_hasHatch.sqf b/addons/common/functions/fnc_hasHatch.sqf index a67ad0b0d3..e39c52f897 100644 --- a/addons/common/functions/fnc_hasHatch.sqf +++ b/addons/common/functions/fnc_hasHatch.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; private _vehicle = vehicle _unit; diff --git a/addons/common/functions/fnc_hasItem.sqf b/addons/common/functions/fnc_hasItem.sqf index 526f5a46f2..8ca785d78e 100644 --- a/addons/common/functions/fnc_hasItem.sqf +++ b/addons/common/functions/fnc_hasItem.sqf @@ -10,9 +10,11 @@ * has Item * * Public: yes + * + * Note: Case sensitive */ #include "script_component.hpp" -params ["_unit", "_item"]; +params [["_unit", objNull, [objNull]], ["_item", "", [""]]]; _item in items _unit // return diff --git a/addons/common/functions/fnc_hasMagazine.sqf b/addons/common/functions/fnc_hasMagazine.sqf index 27150ea5d5..eaa9bc0556 100644 --- a/addons/common/functions/fnc_hasMagazine.sqf +++ b/addons/common/functions/fnc_hasMagazine.sqf @@ -10,9 +10,11 @@ * has Magazine * * Public: yes + * + * Note: Case sensitive */ #include "script_component.hpp" -params ["_unit", "_magazine"]; +params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]]; _magazine in magazines _unit // return diff --git a/addons/common/functions/fnc_hashGet.sqf b/addons/common/functions/fnc_hashGet.sqf index df5d294beb..d0a5cdf22e 100644 --- a/addons/common/functions/fnc_hashGet.sqf +++ b/addons/common/functions/fnc_hashGet.sqf @@ -13,15 +13,13 @@ */ #include "script_component.hpp" -private ["_val", "_index"]; - params ["_hash", "_key"]; ERRORDATA(2); -_val = nil; +private _val = nil; try { if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; + private _index = (_hash select 0) find _key; if(_index != -1) then { _val = (_hash select 1) select _index; if(IS_STRING(_val) && {_val == "ACREHASHREMOVEDONOTUSETHISVAL"}) then { diff --git a/addons/common/functions/fnc_hashHasKey.sqf b/addons/common/functions/fnc_hashHasKey.sqf index 5c6293fc85..b2978f9cc4 100644 --- a/addons/common/functions/fnc_hashHasKey.sqf +++ b/addons/common/functions/fnc_hashHasKey.sqf @@ -12,16 +12,15 @@ */ #include "script_component.hpp" -private ["_val", "_index"]; // diag_log text format["%1 HASH HAS KEY: %2", ACE_diagTime, _this]; params ["_hash", "_key"]; ERRORDATA(2); -_val = false; +private _val = false; try { if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; + private _index = (_hash select 0) find _key; if(_index != -1) then { _val = true; }; diff --git a/addons/common/functions/fnc_hashListCreateHash.sqf b/addons/common/functions/fnc_hashListCreateHash.sqf index d6a94445eb..d5cc323c8d 100644 --- a/addons/common/functions/fnc_hashListCreateHash.sqf +++ b/addons/common/functions/fnc_hashListCreateHash.sqf @@ -12,12 +12,10 @@ */ #include "script_component.hpp" -private ["_hashKeys"]; - params ["_hashList"]; ERRORDATA(1); -_hashKeys = []; +private _hashKeys = []; try { if(VALIDHASH(_hashList)) then { _hashKeys = (_hashList select 0); diff --git a/addons/common/functions/fnc_hashListSelect.sqf b/addons/common/functions/fnc_hashListSelect.sqf index df072d55bd..f5e3d85b31 100644 --- a/addons/common/functions/fnc_hashListSelect.sqf +++ b/addons/common/functions/fnc_hashListSelect.sqf @@ -12,18 +12,16 @@ */ #include "script_component.hpp" -private ["_hash", "_keys", "_hashes", "_values"]; - params ["_hashList", "_index"]; ERRORDATA(2); -_hash = nil; +private _hash = nil; try { if(VALIDHASH(_hashList)) then { - _keys = _hashList select 0; - _hashes = _hashList select 1; + _hashList params ["_keys", "_hashes"]; + if(_index < (count _hashes)) then { - _values = _hashes select _index; + private _values = _hashes select _index; _hash = [_keys, _values, 1]; } else { diff --git a/addons/common/functions/fnc_hashListSet.sqf b/addons/common/functions/fnc_hashListSet.sqf index 5fea048327..ee0a8dc7eb 100644 --- a/addons/common/functions/fnc_hashListSet.sqf +++ b/addons/common/functions/fnc_hashListSet.sqf @@ -12,15 +12,13 @@ */ #include "script_component.hpp" -private ["_vals"]; - params ["_hashList", "_index", "_value"]; ERRORDATA(3); try { if(VALIDHASH(_hashList)) then { if(VALIDHASH(_value)) then { - _vals = _value select 1; + _value params ["", "_vals"]; (_hashList select 1) set[_index, _vals]; } else { diff --git a/addons/common/functions/fnc_hashRem.sqf b/addons/common/functions/fnc_hashRem.sqf index 4346a509cf..bd0c8f2a2d 100644 --- a/addons/common/functions/fnc_hashRem.sqf +++ b/addons/common/functions/fnc_hashRem.sqf @@ -12,15 +12,13 @@ */ #include "script_component.hpp" -private ["_val", "_index"]; - params ["_hash", "_key"]; ERRORDATA(2); -_val = nil; +private _val = nil; try { if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; + private _index = (_hash select 0) find _key; if(_index != -1) then { (_hash select 1) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; // is this hash is not part of a hash list? diff --git a/addons/common/functions/fnc_hashSet.sqf b/addons/common/functions/fnc_hashSet.sqf index af7a361dd6..10e2881c10 100644 --- a/addons/common/functions/fnc_hashSet.sqf +++ b/addons/common/functions/fnc_hashSet.sqf @@ -12,7 +12,6 @@ */ #include "script_component.hpp" -private ["_index"]; // diag_log text format["%1 HASH SET: %2", ACE_diagTime, _this]; params ["_hash", "_key", "_val"]; @@ -20,7 +19,7 @@ params ["_hash", "_key", "_val"]; ERRORDATA(3); try { if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; + private _index = (_hash select 0) find _key; if(_index == -1) then { _index = (_hash select 0) find "ACREHASHREMOVEDONOTUSETHISVAL"; if(_index == -1) then { diff --git a/addons/common/functions/fnc_headBugFix.sqf b/addons/common/functions/fnc_headBugFix.sqf index 78b1a602df..dffb28ff4b 100644 --- a/addons/common/functions/fnc_headBugFix.sqf +++ b/addons/common/functions/fnc_headBugFix.sqf @@ -14,24 +14,22 @@ */ #include "script_component.hpp" -private ["_unit", "_anim", "_pos", "_dir", "_dummy"]; - -_unit = ACE_player; -_anim = animationState _unit; +private _unit = ACE_player; +private _anim = animationState _unit; ["HeadbugFixUsed", [profileName, _anim]] call FUNC(serverEvent); ["HeadbugFixUsed", [profileName, _anim]] call FUNC(localEvent); if (_unit != vehicle _unit || {!([_unit, objNull, ["isNotSitting"]] call FUNC(canInteractWith))}) exitWith {false}; -_pos = getPosATL _unit; -_dir = getDir _unit; +private _pos = getPosATL _unit; +private _dir = getDir _unit; titleCut ["", "BLACK"]; [_unit, "headBugFix"] call FUNC(hideUnit); // create invisible headbug fix vehicle -_dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"]; +private _dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"]; _dummy setDir _dir; _unit moveInAny _dummy; sleep 0.1; // @todo diff --git a/addons/common/functions/fnc_hideUnit.sqf b/addons/common/functions/fnc_hideUnit.sqf index 7fdd901848..85636a08f7 100644 --- a/addons/common/functions/fnc_hideUnit.sqf +++ b/addons/common/functions/fnc_hideUnit.sqf @@ -12,7 +12,7 @@ * Example: * [ACE_Player, "SpectatorMode"] call ace_common_fnc_hideUnit * - * Public: No + * Public: Yes */ #include "script_component.hpp" @@ -20,8 +20,7 @@ params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; -private "_setHiddenReasons"; -_setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []]; +private _setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []]; if !(_reason in _setHiddenReasons) then { _setHiddenReasons pushBack _reason; diff --git a/addons/common/functions/fnc_inWater.sqf b/addons/common/functions/fnc_inWater.sqf deleted file mode 100644 index 3b323469fc..0000000000 --- a/addons/common/functions/fnc_inWater.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: Glowbal - * Check if unit's head is underwater - * - * Arguments: - * 0: Unit - * - * Return Value: - * If unit's head is underwater - * - * Public: Yes - * - * Deprecated - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_inWater","3.5.0","ace_common_fnc_isUnderwater"); - -_this call FUNC(isUnderwater) diff --git a/addons/common/functions/fnc_inheritsFrom.sqf b/addons/common/functions/fnc_inheritsFrom.sqf deleted file mode 100644 index 7f881ff746..0000000000 --- a/addons/common/functions/fnc_inheritsFrom.sqf +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Author: Ruthberg - * Checks whether a given configuration name appears in the inheritance tree of a specific configuration entry. - * - * 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" - -ACE_DEPRECATED("ace_common_fnc_inheritsFrom","3.5.0","inheritsFrom ARRAY"); - -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; -}; - -_match diff --git a/addons/common/functions/fnc_insertionSort.sqf b/addons/common/functions/fnc_insertionSort.sqf index 9f8c95e095..d2f89a039e 100644 --- a/addons/common/functions/fnc_insertionSort.sqf +++ b/addons/common/functions/fnc_insertionSort.sqf @@ -17,10 +17,8 @@ params ["_list", ["_ascending", true]]; _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; + private _tmp = _list select _i; _j = _i; while {_j >= 1 && {_tmp < _list select (_j - 1)}} do { diff --git a/addons/common/functions/fnc_interpolateFromArray.sqf b/addons/common/functions/fnc_interpolateFromArray.sqf index 5ce59bde62..07207071e7 100644 --- a/addons/common/functions/fnc_interpolateFromArray.sqf +++ b/addons/common/functions/fnc_interpolateFromArray.sqf @@ -15,9 +15,7 @@ params ["_array", "_value"]; -private ["_min", "_max"]; - -_min = _array select floor _value; -_max = _array select ceil _value; +private _min = _array select floor _value; +private _max = _array select ceil _value; _min + (_max - _min) * (_value % 1) // return diff --git a/addons/common/functions/fnc_isAlive.sqf b/addons/common/functions/fnc_isAlive.sqf deleted file mode 100644 index b9d94eed5d..0000000000 --- a/addons/common/functions/fnc_isAlive.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Author: commy2 - * Check if the object still exists and is alive. This function exists because 'alive objNull' actually returns true. - * - * Argument: - * 0: Any object - * - * Return value: - * The object exists and is alive . - * - * Public: Yes - * - * Deprecated - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_isAlive","3.5.0","alive"); - -params ["_unit"]; - -!isNull _unit && {alive _unit} // return diff --git a/addons/common/functions/fnc_isInBuilding.sqf b/addons/common/functions/fnc_isInBuilding.sqf index 577b865aee..e5234b9200 100644 --- a/addons/common/functions/fnc_isInBuilding.sqf +++ b/addons/common/functions/fnc_isInBuilding.sqf @@ -14,13 +14,11 @@ #define CHECK_DISTANCE 10 -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private ["_position", "_intersections"]; +private _position = eyePos _unit; -_position = eyePos _unit; - -_intersections = 0; +private _intersections = 0; if (lineIntersects [_position, _position vectorAdd [0, 0, +CHECK_DISTANCE]]) then { _intersections = _intersections + 1; diff --git a/addons/common/functions/fnc_isModLoaded.sqf b/addons/common/functions/fnc_isModLoaded.sqf index cb62a90440..46e1bc03a8 100644 --- a/addons/common/functions/fnc_isModLoaded.sqf +++ b/addons/common/functions/fnc_isModLoaded.sqf @@ -12,6 +12,6 @@ */ #include "script_component.hpp" -params ["_modName"]; +params [["_modName", "", [""]]]; isClass (configFile >> "CfgPatches" >> _modName) // return diff --git a/addons/common/functions/fnc_isTurnedOut.sqf b/addons/common/functions/fnc_isTurnedOut.sqf deleted file mode 100644 index 39eb460cc4..0000000000 --- a/addons/common/functions/fnc_isTurnedOut.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Author: commy2 - * Check if the unit is in a vehicle and turned out. - * - * 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. - * - * Public: Yes - * - * Deprecated - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_isTurnedOut","3.5.0","isTurnedOut"); - -params ["_unit"]; - -isTurnedOut _unit // return diff --git a/addons/common/functions/fnc_isUnderwater.sqf b/addons/common/functions/fnc_isUnderwater.sqf index d2f399b770..637ed49f3d 100644 --- a/addons/common/functions/fnc_isUnderwater.sqf +++ b/addons/common/functions/fnc_isUnderwater.sqf @@ -12,14 +12,12 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private "_return"; -_return = false; +private _return = false; if (surfaceIsWater getPosASL _unit) then { - private "_pos"; - _pos = _unit modelToWorldVisual (_unit selectionPosition "head"); + private _pos = _unit modelToWorldVisual (_unit selectionPosition "head"); if (_pos select 2 < 0) then { _return = true; diff --git a/addons/common/functions/fnc_letterToCode.sqf b/addons/common/functions/fnc_letterToCode.sqf deleted file mode 100644 index 7bbbcf4f3d..0000000000 --- a/addons/common/functions/fnc_letterToCode.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 df88671405..a495897dea 100644 --- a/addons/common/functions/fnc_lightIntensityFromObject.sqf +++ b/addons/common/functions/fnc_lightIntensityFromObject.sqf @@ -15,79 +15,60 @@ params ["_unit", "_lightSource"]; -private ["_unitPos", "_lightLevel"]; - -_unitPos = _unit modelToWorld (_unit selectionPosition "spine3"); -_lightLevel = 0; +private _unitPos = _unit modelToWorld (_unit selectionPosition "spine3"); +private _lightLevel = 0; if (_lightSource isKindOf "CAManBase") then { // handle persons with flashlights - private "_weapon"; - _weapon = currentWeapon _lightSource; + private _weapon = currentWeapon _lightSource; if !(_lightSource isFlashlightOn _weapon) exitWith {}; - private ["_flashlight", "_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"]; - - _flashlight = switch (_weapon) do { - case (primaryWeapon _lightSource): { - primaryWeaponItems _lightSource select 1 - }; - case (secondaryWeapon _lightSource): { - secondaryWeaponItems _lightSource select 1 - }; - case (handgunWeapon _lightSource): { - handgunItems _lightSource select 1 - }; - default {""}; - }; + private _flashlight = (_lightSource weaponAccessories _weapon) select 1; 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); + private _properties = [[_flashlight], FUNC(getLightPropertiesWeapon), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getLightPropertiesWeapon)), _flashlight], 1E11] call FUNC(cachedCall); //_properties = [_flashlight] call FUNC(getLightPropertiesWeapon); - _innerAngle = (_properties select 3) / 2; - _outerAngle = (_properties select 4) / 2; + private _innerAngle = (_properties select 3) / 2; + private _outerAngle = (_properties select 4) / 2; - _position = _lightSource modelToWorld (_lightSource selectionPosition "rightHand"); - _direction = _lightSource weaponDirection _weapon; + private _position = _lightSource modelToWorld (_lightSource selectionPosition "rightHand"); + private _direction = _lightSource weaponDirection _weapon; - _directionToUnit = _position vectorFromTo _unitPos; + private _directionToUnit = _position vectorFromTo _unitPos; - _distance = _unitPos distance _position; - _angle = acos (_direction vectorDotProduct _directionToUnit); + private _distance = _unitPos distance _position; + private _angle = acos (_direction vectorDotProduct _directionToUnit); _lightLevel = (linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true]); } else { // handle any object, strcutures, cars, tanks, etc. @todo campfires, burning vehicles - private "_lights"; - _lights = [_lightSource] call FUNC(getTurnedOnLights); + private _lights = _lightSource call FUNC(getTurnedOnLights); { - private ["_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"]; - - _properties = [[_lightSource, _x], FUNC(getLightProperties), uiNamespace, format [QEGVAR(cache,%1_%2_%3), QUOTE(DFUNC(getLightProperties)), typeOf _lightSource, _x], 1E11] call FUNC(cachedCall); + private _properties = [[_lightSource, _x], FUNC(getLightProperties), uiNamespace, format [QEGVAR(cache,%1_%2_%3), QUOTE(DFUNC(getLightProperties)), typeOf _lightSource, _x], 1E11] call FUNC(cachedCall); //_properties = [_lightSource, _x] call FUNC(getLightProperties); // @todo intensity affects range? - //_intensity = _properties select 0; + //_properties params ["_intensity"]; - _innerAngle = (_properties select 3) / 2; - _outerAngle = (_properties select 4) / 2; + private _innerAngle = (_properties select 3) / 2; + private _outerAngle = (_properties select 4) / 2; // get world position and direction - _position = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 1)); - _direction = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 2)); + private _position = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 1)); + private _direction = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 2)); _direction = _position vectorFromTo _direction; - _directionToUnit = _position vectorFromTo _unitPos; + private _directionToUnit = _position vectorFromTo _unitPos; - _distance = _unitPos distance _position; - _angle = acos (_direction vectorDotProduct _directionToUnit); + private _distance = _unitPos distance _position; + private _angle = acos (_direction vectorDotProduct _directionToUnit); _lightLevel = _lightLevel max ((linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true])); @@ -97,8 +78,7 @@ if (_lightSource isKindOf "CAManBase") then { // handle campfires if (inflamed _lightSource) then { - private "_distance"; - _distance = _unitPos distance position _lightSource; + private _distance = _unitPos distance position _lightSource; _lightLevel = _lightLevel max linearConversion [0, 30, _distance, 0.5, 0, true]; }; diff --git a/addons/common/functions/fnc_loadPerson.sqf b/addons/common/functions/fnc_loadPerson.sqf index 659d63224a..3071ffbd47 100644 --- a/addons/common/functions/fnc_loadPerson.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -17,28 +17,26 @@ params ["_caller", "_unit"]; -private ["_vehicle", "_loadcar", "_loadair", "_loadtank", "_loadboat"]; - -_vehicle = objNull; +private _vehicle = objNull; if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitWith {_vehicle}; -_loadcar = nearestObject [_unit, "Car"]; +private _loadcar = nearestObject [_unit, "Car"]; if (_unit distance _loadcar <= 10) then { _vehicle = _loadcar; } else { - _loadair = nearestObject [_unit, "Air"]; + private _loadair = nearestObject [_unit, "Air"]; if (_unit distance _loadair <= 10) then { _vehicle = _loadair; } else { - _loadtank = nearestObject [_unit, "Tank"]; + private _loadtank = nearestObject [_unit, "Tank"]; if (_unit distance _loadtank <= 10) then { _vehicle = _loadtank; } else { - _loadboat = nearestObject [_unit, "Ship_F"]; + private _loadboat = nearestObject [_unit, "Ship_F"]; if (_unit distance _loadboat <= 10) then { _vehicle = _loadboat; diff --git a/addons/common/functions/fnc_loadPersonLocal.sqf b/addons/common/functions/fnc_loadPersonLocal.sqf index 5b52b38b05..db0248a901 100644 --- a/addons/common/functions/fnc_loadPersonLocal.sqf +++ b/addons/common/functions/fnc_loadPersonLocal.sqf @@ -20,9 +20,7 @@ if (!alive _unit) then { // _unit = [_unit, _caller] call FUNC(makeCopyOfBody); //func does not exist }; -private "_slotsOpen"; - -_slotsOpen = false; +private _slotsOpen = false; if (_vehicle emptyPositions "cargo" > 0) then { _unit moveInCargo _vehicle; @@ -35,8 +33,7 @@ if (_vehicle emptyPositions "cargo" > 0) then { }; if (_slotsOpen) then { - private "_loaded"; - _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; + private _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; _loaded pushBack _unit; _vehicle setVariable [QGVAR(loaded_persons), _loaded, true]; diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf index a596583a5c..46b0134740 100644 --- a/addons/common/functions/fnc_loadSettingsFromProfile.sqf +++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf @@ -21,8 +21,7 @@ if (_isClientSetable) then { // If setting is not forced if !(_isForced) then { - private "_profileValue"; - _profileValue = profileNamespace getVariable _name; + private _profileValue = profileNamespace getVariable _name; // If the setting is stored on the profile if !(isNil "_profileValue") then { diff --git a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf index 225c2d9675..f846fa9354 100644 --- a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf +++ b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf @@ -12,14 +12,12 @@ */ #include "script_component.hpp" -private "_fnc_parseConfigForDisplayNames"; -_fnc_parseConfigForDisplayNames = { +private _fnc_parseConfigForDisplayNames = { params ["_optionEntry"]; if !(isClass _optionEntry) exitWith {false}; - private "_values"; - _values = getArray (_optionEntry >> "values"); + private _values = getArray (_optionEntry >> "values"); _x set [3, getText (_optionEntry >> "displayName")]; _x set [4, getText (_optionEntry >> "description")]; @@ -27,8 +25,7 @@ _fnc_parseConfigForDisplayNames = { _x set [8, getText (_optionEntry >> "category")]; { - private "_text"; - _text = _x; + private _text = _x; if (_text isEqualType "" && {count _text > 1} && {_text select [0, 1] == "$"}) then { _text = localize (_text select [1]); //chop off the leading $ diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf index cdf8b48041..4498c9d058 100644 --- a/addons/common/functions/fnc_loadSettingsOnServer.sqf +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -15,15 +15,13 @@ GVAR(settings) = []; -private "_fnc_parseConfigForSettings"; -_fnc_parseConfigForSettings = { - private ["_config", "_countOptions", "_optionEntry"]; +private _fnc_parseConfigForSettings = { + params ["_config"]; - _config = _this select 0; - _countOptions = count _config; + private _countOptions = count _config; for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = _config select _index; + private _optionEntry = _config select _index; [_optionEntry] call FUNC(setSettingFromConfig); }; diff --git a/addons/common/functions/fnc_localEvent.sqf b/addons/common/functions/fnc_localEvent.sqf index f5a121c088..bf17cc0d0e 100644 --- a/addons/common/functions/fnc_localEvent.sqf +++ b/addons/common/functions/fnc_localEvent.sqf @@ -15,14 +15,9 @@ params ["_eventName", "_eventArgs"]; -GVAR(events) params ["_eventNames", "_eventArray"]; +private _eventFunctions = GVAR(eventsLocation) getVariable _eventName; -private "_eventIndex"; -_eventIndex = _eventNames find _eventName; - -if (_eventIndex != -1) then { - private "_events"; - _events = _eventArray select _eventIndex; +if (!isNil "_eventFunctions") then { #ifdef DEBUG_EVENTS ACE_LOGINFO_1("* Local Event: %1",_eventName); @@ -37,5 +32,5 @@ if (_eventIndex != -1) then { ACE_LOGINFO_1(" ID: %1",_forEachIndex); #endif }; - } forEach _events; + } forEach _eventFunctions; }; diff --git a/addons/common/functions/fnc_map.sqf b/addons/common/functions/fnc_map.sqf index a727de08bf..c92a4eb588 100644 --- a/addons/common/functions/fnc_map.sqf +++ b/addons/common/functions/fnc_map.sqf @@ -1,6 +1,6 @@ /* * Author: KoffeinFlummi, commy2 - * Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT. + * Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT. <- :kappa: * * Arguments: * 0: Array to be thingied. @@ -9,14 +9,15 @@ * Return Value: * Final array * - * Usage: - * [["2", "gobblecock", "25"], {parseNumber _this}] call FUNC(map) ==> [2, 0, 25] - * * Public: Yes + * + * Deprecated */ #include "script_component.hpp" -params ["_array", "_code"]; +params [["_array", [], [[]]], ["_code", {}, [{}]]]; + +ACE_DEPRECATED("ace_common_fnc_map","3.7.0","apply"); // copy array to not alter the original one _array = + _array; diff --git a/addons/common/functions/fnc_muteUnit.sqf b/addons/common/functions/fnc_muteUnit.sqf index 84d56f92bd..d4648155b6 100644 --- a/addons/common/functions/fnc_muteUnit.sqf +++ b/addons/common/functions/fnc_muteUnit.sqf @@ -17,17 +17,15 @@ params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; -private ["_muteUnitReasons", "_speaker"]; - // add reason to mute to the unit -_muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []]; +private _muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []]; if !(_reason in _muteUnitReasons) then { _muteUnitReasons pushBack _reason; _unit setVariable [QGVAR(muteUnitReasons), _muteUnitReasons, true]; }; -_speaker = speaker _unit; +private _speaker = speaker _unit; if (_speaker == "ACE_NoVoice") exitWith {}; diff --git a/addons/common/functions/fnc_numberToDigits.sqf b/addons/common/functions/fnc_numberToDigits.sqf index c5e1b6d7b6..b90f0eefd7 100644 --- a/addons/common/functions/fnc_numberToDigits.sqf +++ b/addons/common/functions/fnc_numberToDigits.sqf @@ -18,8 +18,7 @@ params ["_number", "_minLength"]; _number = _number min 999999; _number = str _number; -private "_length"; -_length = count _number; +private _length = count _number; if (isNil "_minLength") then {_minLength = _length}; @@ -30,8 +29,7 @@ while {_length < _minLength} do { _length = _length + 1; }; -private "_digits"; -_digits = []; +private _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 f8f192e0e3..7e2c78f8b4 100644 --- a/addons/common/functions/fnc_numberToDigitsString.sqf +++ b/addons/common/functions/fnc_numberToDigitsString.sqf @@ -18,8 +18,7 @@ params ["_number", "_minLength"]; _number = _number min 999999; _number = str _number; -private "_length"; -_length = count _number; +private _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 4dd810607c..1cb2f521f8 100644 --- a/addons/common/functions/fnc_numberToString.sqf +++ b/addons/common/functions/fnc_numberToString.sqf @@ -14,8 +14,7 @@ params ["_number"]; -private "_decimals"; -_decimals = str (abs _number mod 1); +private _decimals = str (abs _number mod 1); _decimals = toArray _decimals; _decimals deleteAt 0; diff --git a/addons/common/functions/fnc_onAnswerRequest.sqf b/addons/common/functions/fnc_onAnswerRequest.sqf index 2f7aef43a5..d88969b059 100644 --- a/addons/common/functions/fnc_onAnswerRequest.sqf +++ b/addons/common/functions/fnc_onAnswerRequest.sqf @@ -14,17 +14,12 @@ params ["_unit", "_id", "_accepted"]; -private ["_requestID", "_info", "_callBack", "_caller", "_replyParams", "_requestMessage", "_target"]; - -_info = _unit getVariable _id; +private _info = _unit getVariable _id; if (!isNil "_info") then { - _caller = _info select 0; - _target = _info select 1; - _requestID = _info select 2; - _requestMessage = _info select 3; - _callBack = _info select 4; - _replyParams = [_info, _accepted]; + _info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; + + private _replyParams = [_info, _accepted]; [_replyParams, QFUNC(requestCallback), _caller, false] call FUNC(execRemoteFnc); _unit setVariable [_id, nil]; }; diff --git a/addons/common/functions/fnc_parseList.sqf b/addons/common/functions/fnc_parseList.sqf index ef7eaae92a..fc92605682 100644 --- a/addons/common/functions/fnc_parseList.sqf +++ b/addons/common/functions/fnc_parseList.sqf @@ -19,36 +19,34 @@ params ["_list", ["_removeWhitespace", false], ["_checkNil", false]]; -private ["_whitespaceList", "_nilCheckedList"]; - // Split using comma delimiter _list = _list splitString ","; TRACE_1("Splitted List",_list); - // Remove or Trim Whitespace -_whitespaceList = []; +private _whitespaceList = []; + { if (_removeWhitespace) then { _whitespaceList pushBack ([_x] call FUNC(stringRemoveWhiteSpace)); } else { _whitespaceList pushBack ([_x] call CBA_fnc_trim); }; - nil + false } count _list; _list = _whitespaceList; TRACE_1("Whitespace List",_list); - // Check for object existence if (_checkNil) then { - _nilCheckedList = []; + private _nilCheckedList = []; + { if !(isNil _x) then { _nilCheckedList pushBack (missionNamespace getVariable _x); }; - nil + false } count _list; _list = _nilCheckedList; diff --git a/addons/common/functions/fnc_progressBar.sqf b/addons/common/functions/fnc_progressBar.sqf index 170d0060c0..e842590f35 100644 --- a/addons/common/functions/fnc_progressBar.sqf +++ b/addons/common/functions/fnc_progressBar.sqf @@ -24,9 +24,7 @@ params ["_totalTime", "_args", "_onFinish", "_onFail", ["_localizedTitle", ""], ["_condition", {true}], ["_exceptions", []]]; -private ["_player", "_ctrlPos", "_fnc_perFrameFunction"]; - -_player = ACE_player; +private _player = ACE_player; //Open Dialog and set the title closeDialog 0; @@ -35,7 +33,7 @@ createDialog QGVAR(ProgressBar_Dialog); (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle; //Adjust position based on user setting: -_ctrlPos = ctrlPosition (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)); +private _ctrlPos = ctrlPosition (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)); _ctrlPos set [1, ((0 + 29 * GVAR(SettingProgressBarLocation)) * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))]; (uiNamespace getVariable QGVAR(ctrlProgressBG)) ctrlSetPosition _ctrlPos; @@ -45,13 +43,11 @@ _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"]; - private ["_elapsedTime", "_errorCode"]; - - _elapsedTime = ACE_time - _startTime; - _errorCode = -1; + private _elapsedTime = ACE_time - _startTime; + private _errorCode = -1; // this does not check: target fell unconscious, target died, target moved inside vehicle / left vehicle, target moved outside of players range, target moves at all. if (isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then { @@ -101,6 +97,4 @@ _fnc_perFrameFunction = { //Update Progress Bar (ratio of elepased:total) (uiNamespace getVariable QGVAR(ctrlProgressBar)) progressSetPosition (_elapsedTime / _totalTime); }; -}; - -[_fnc_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler; +}, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/functions/fnc_receiveRequest.sqf b/addons/common/functions/fnc_receiveRequest.sqf index d4e867e348..75f684f5dd 100644 --- a/addons/common/functions/fnc_receiveRequest.sqf +++ b/addons/common/functions/fnc_receiveRequest.sqf @@ -50,8 +50,7 @@ GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn { _time = _time + 40; - private "_id"; - _id = _target getVariable _requestID; + private _id = _target getVariable _requestID; waitUntil { _id = _target getVariable _requestID; diff --git a/addons/common/functions/fnc_removeActionEventHandler.sqf b/addons/common/functions/fnc_removeActionEventHandler.sqf index b22ed0f152..60e551590d 100644 --- a/addons/common/functions/fnc_removeActionEventHandler.sqf +++ b/addons/common/functions/fnc_removeActionEventHandler.sqf @@ -18,10 +18,8 @@ params ["_unit", "_action", "_id"]; if (_id == -1) exitWith {}; -private ["_name", "_actionsVar"]; - -_name = format ["ACE_Action_%1", _action]; -_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; +private _name = format ["ACE_Action_%1", _action]; +private _actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; _actionsVar params ["_actionID", "_actionsArray"]; _actionsArray params ["_currentID", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_removeActionMenuEventHandler.sqf b/addons/common/functions/fnc_removeActionMenuEventHandler.sqf index e5adbe0c01..943e3b4e22 100644 --- a/addons/common/functions/fnc_removeActionMenuEventHandler.sqf +++ b/addons/common/functions/fnc_removeActionMenuEventHandler.sqf @@ -18,10 +18,8 @@ params ["_unit", "_action", "_id"]; if (_id == -1) exitWith {}; -private ["_name", "_actionsVar"]; - -_name = format ["ACE_ActionMenu_%1", _action]; -_actionsVar = _unit getVariable [_name, [-1, [-1, [], []]]]; +private _name = format ["ACE_ActionMenu_%1", _action]; +private _actionsVar = _unit getVariable [_name, [-1, [-1, [], []]]]; _actionsVar params ["_currentID", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_removeAllEventHandlers.sqf b/addons/common/functions/fnc_removeAllEventHandlers.sqf index 1a1a6e255f..ed1cce278c 100644 --- a/addons/common/functions/fnc_removeAllEventHandlers.sqf +++ b/addons/common/functions/fnc_removeAllEventHandlers.sqf @@ -14,13 +14,4 @@ params ["_eventName"]; -GVAR(events) params ["_eventNames", "_events"]; - -private ["_eventFunctions", "_eventIndex"]; - -_eventFunctions = []; -_eventIndex = _eventNames find _eventName; - -if (_eventIndex != -1) then { - _events set [_eventIndex, []]; -}; +GVAR(eventsLocation) setVariable [_eventName, nil]; diff --git a/addons/common/functions/fnc_removeBinocularMagazine.sqf b/addons/common/functions/fnc_removeBinocularMagazine.sqf index ee35f28f1b..487295ccc3 100644 --- a/addons/common/functions/fnc_removeBinocularMagazine.sqf +++ b/addons/common/functions/fnc_removeBinocularMagazine.sqf @@ -9,19 +9,16 @@ * None * * Example: - * [player] call ace_common_fnc_removeBinocularMagazine + * player call ace_common_fnc_removeBinocularMagazine * * Public: Yes */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private ["_binocular", "_selectBinocular"]; - -_binocular = binocular _unit; - -_selectBinocular = currentWeapon _unit == _binocular; +private _binocular = binocular _unit; +private _selectBinocular = currentWeapon _unit == _binocular; _unit addWeapon _binocular; diff --git a/addons/common/functions/fnc_removeCanInteractWithCondition.sqf b/addons/common/functions/fnc_removeCanInteractWithCondition.sqf index 6c3fa8354b..b267e84557 100644 --- a/addons/common/functions/fnc_removeCanInteractWithCondition.sqf +++ b/addons/common/functions/fnc_removeCanInteractWithCondition.sqf @@ -16,13 +16,11 @@ params ["_conditionName"]; _conditionName = toLower _conditionName; -private "_conditions"; -_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; +private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; _conditions params ["_conditionNames", "_conditionFuncs"]; -private "_index"; -_index = _conditionNames find _conditionName; +private _index = _conditionNames find _conditionName; if (_index == -1) exitWith {}; diff --git a/addons/common/functions/fnc_removeEventHandler.sqf b/addons/common/functions/fnc_removeEventHandler.sqf index 0c70046706..a0b5ed5333 100644 --- a/addons/common/functions/fnc_removeEventHandler.sqf +++ b/addons/common/functions/fnc_removeEventHandler.sqf @@ -15,14 +15,9 @@ params ["_eventName", "_eventCodeIndex"]; -GVAR(events) params ["_eventNames", "_events"]; +private _eventFunctions = GVAR(eventsLocation) getVariable _eventName; -private ["_eventFunctions", "_eventIndex"]; +if (isNil "_eventFunctions") exitWith {TRACE_1("eventName not found",_eventName);}; +if ((_eventCodeIndex < 0) || {(count _eventFunctions) <= _eventCodeIndex}) exitWith {TRACE_2("index out of bounds",_eventName,_eventCodeIndex);}; -_eventFunctions = []; -_eventIndex = _eventNames find _eventName; - -if (_eventIndex != -1) then { - _eventFunctions = _events select _eventIndex; - _eventFunctions set [_eventCodeIndex, nil]; -}; +_eventFunctions set [_eventCodeIndex, nil]; diff --git a/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf index d156359ebf..825281c3e0 100644 --- a/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf +++ b/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf @@ -14,8 +14,7 @@ params ["_id"]; -private "_actionsVar"; -_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; +private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; _actionsVar params ["_currentId", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf b/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf index b277467cce..d7a8ae28cc 100644 --- a/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf +++ b/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf @@ -14,8 +14,7 @@ params ["_id"]; -private "_actionsVar"; -_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; +private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; _actionsVar params ["_currentId", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_removeSpecificMagazine.sqf b/addons/common/functions/fnc_removeSpecificMagazine.sqf index 46950cc1d8..4ca5eec6d7 100644 --- a/addons/common/functions/fnc_removeSpecificMagazine.sqf +++ b/addons/common/functions/fnc_removeSpecificMagazine.sqf @@ -14,15 +14,14 @@ */ #include "script_component.hpp" -params ["_unit", "_magazineType", "_ammoCount"]; +params [["_unit", objNull, [objNull]], ["_magazineType", "", [""]], ["_ammoCount", 0, [0]]]; -private ["_isRemoved", "_magazines", "_index"]; - -_isRemoved = false; +private _isRemoved = false; // Check uniform -_magazines = [magazinesAmmoCargo uniformContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); -_index = _magazines find [_magazineType, _ammoCount]; +private _magazines = magazinesAmmoCargo uniformContainer _unit select {_x select 0 == _magazineType}; +private _index = _magazines find [_magazineType, _ammoCount]; + if (_index > -1) exitWith { { _unit removeItemFromUniform (_x select 0); @@ -40,8 +39,9 @@ if (_index > -1) exitWith { }; // Check vest -_magazines = [magazinesAmmoCargo vestContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); -_index = _magazines find [_magazineType,_ammoCount]; +_magazines = magazinesAmmoCargo vestContainer _unit select {_x select 0 == _magazineType}; +_index = _magazines find [_magazineType, _ammoCount]; + if (_index > -1) exitWith { { _unit removeItemFromVest (_x select 0); @@ -59,8 +59,9 @@ if (_index > -1) exitWith { }; // Check backpack -_magazines = [magazinesAmmoCargo backpackContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); -_index = _magazines find [_magazineType,_ammoCount]; +_magazines = magazinesAmmoCargo backpackContainer _unit select {_x select 0 == _magazineType}; +_index = _magazines find [_magazineType, _ammoCount]; + if (_index > -1) exitWith { { _unit removeItemFromBackpack (_x select 0); diff --git a/addons/common/functions/fnc_removeSyncedEventHandler.sqf b/addons/common/functions/fnc_removeSyncedEventHandler.sqf index ffc4a364f3..126bf0b70f 100644 --- a/addons/common/functions/fnc_removeSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_removeSyncedEventHandler.sqf @@ -19,10 +19,8 @@ if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { false }; -private ["_data", "_eventId"]; - -_data = HASH_GET(GVAR(syncedEvents),_name); -_eventId = _data select 3; +private _data = HASH_GET(GVAR(syncedEvents),_name); +_data params ["", "", "", "_eventId"]; [_eventId] call FUNC(removeEventHandler); HASH_REM(GVAR(syncedEvents),_name); diff --git a/addons/common/functions/fnc_resetAllDefaults.sqf b/addons/common/functions/fnc_resetAllDefaults.sqf index d9850ffd5b..6432f3759e 100644 --- a/addons/common/functions/fnc_resetAllDefaults.sqf +++ b/addons/common/functions/fnc_resetAllDefaults.sqf @@ -19,11 +19,6 @@ _unit setVariable ["ACE_isUnconscious", nil, true]; if (isPlayer _unit) then { [true] call FUNC(setVolume); - // [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 { // clear all disable user input @@ -40,5 +35,3 @@ if (isPlayer _unit) then { }; 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 491ce89bb4..39626514bb 100644 --- a/addons/common/functions/fnc_restoreVariablesJIP.sqf +++ b/addons/common/functions/fnc_restoreVariablesJIP.sqf @@ -14,8 +14,7 @@ params ["_unit"]; -private "_respawnVariables"; -_respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; +private _respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; // yes those _respawnVariables pushBack "ACE_PersistentFunctions"; diff --git a/addons/common/functions/fnc_sanitizeString.sqf b/addons/common/functions/fnc_sanitizeString.sqf index 2450ba5be5..6e0db2cda2 100644 --- a/addons/common/functions/fnc_sanitizeString.sqf +++ b/addons/common/functions/fnc_sanitizeString.sqf @@ -18,8 +18,7 @@ params ["_string", ["_removeTags", false]]; -private "_array"; -_array = []; +private _array = []; { switch _x do { diff --git a/addons/common/functions/fnc_selectWeaponMode.sqf b/addons/common/functions/fnc_selectWeaponMode.sqf deleted file mode 100644 index 582f6fd4b2..0000000000 --- a/addons/common/functions/fnc_selectWeaponMode.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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"]; - -private _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_setAllGear.sqf b/addons/common/functions/fnc_setAllGear.sqf index 2b5a2a9cc7..152eb4fd60 100644 --- a/addons/common/functions/fnc_setAllGear.sqf +++ b/addons/common/functions/fnc_setAllGear.sqf @@ -1,6 +1,6 @@ /* * Author: bux578, commy2 - * Applies gear to unit. + * Applies gear to unit. It must be called in the machine in which the unit is local. * * Arguments: * 0: Unit @@ -20,6 +20,10 @@ params ["_unit", "_allGear", ["_clearAttachments", false], ["_clearBackpack", false]]; +if (!local _unit) exitWith { + ACE_LOGWARNING_1("setAllGear - %1 has to be local.",_unit); +}; + // remove all starting gear of a player removeAllWeapons _unit; removeGoggles _unit; diff --git a/addons/common/functions/fnc_setApproximateVariablePublic.sqf b/addons/common/functions/fnc_setApproximateVariablePublic.sqf new file mode 100644 index 0000000000..5131f99058 --- /dev/null +++ b/addons/common/functions/fnc_setApproximateVariablePublic.sqf @@ -0,0 +1,42 @@ +/* + * Author: esteldunedain + * Publish a variable if it's different enough from the previously published value. + * + * Argument: + * 0: Object the variable should be assigned to + * 1: Name of the variable + * 2: Value of the variable + * 3: Absolute tolerance + * + * Return value: + * Nothing. + * + * Example: + * [player, "balls", 2, 0.1] call ace_common_fnc_setApproximateVariablePublic; + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params ["_object", "_varName", "_value", "_tolerance"]; +TRACE_4("params",_object,_varName,_value,_tolerance); + +// Set exact new value locally +_object setVariable [_varName, _value]; + +// Exit if in SP - "duh" +if (!isMultiplayer) exitWith {}; + +// If new value is not different +private _oldVarName = format ["ACE_oldValue_%1", _varName]; +private _oldValue = _object getVariable [_oldVarName, -100000]; + +// Exit if new value is not different enough from the old onedifferent +if (abs(_value - _oldValue) < _tolerance) exitWith {}; + +// Publish the new value: +_object setVariable [_varName, _value, true]; +_object setVariable [_oldVarName, _value]; + +TRACE_2("Published variable:", _varName, _value); diff --git a/addons/common/functions/fnc_setCaptivityStatus.sqf b/addons/common/functions/fnc_setCaptivityStatus.sqf index ecb7b3152a..062c126f81 100644 --- a/addons/common/functions/fnc_setCaptivityStatus.sqf +++ b/addons/common/functions/fnc_setCaptivityStatus.sqf @@ -10,35 +10,13 @@ * Return Value: * None * - * Public: No + * Public: Yes */ #include "script_component.hpp" params ["_unit", "_reason", "_status"]; -private ["_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"]; +//Now just a wrapper for FUNC(statusEffect_set) [No longer used in ace as of 3.5] +ACE_DEPRECATED("ace_common_fnc_setCaptivityStatus","3.7.0","ace_common_fnc_statusEffect_set"); -_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; - -// register new reason (these reasons are shared publicly, since units can change ownership, but keep their captivity status) -if !(_reason in _captivityReasons) then { - _captivityReasons pushBack _reason; - - ACE_captivityReasons = _captivityReasons; - publicVariable "ACE_captivityReasons"; -}; - -// get reasons why the unit is captive already and update to the new status -_unitCaptivityReasons = [_unit] call FUNC(getCaptivityStatus); - -_captivityReasonsBooleans = []; -{ - _captivityReasonsBooleans set [_forEachIndex, (_captivityReasons select _forEachIndex) in _unitCaptivityReasons]; -} forEach _captivityReasons; - -_captivityReasonsBooleans set [_captivityReasons find _reason, _status]; - -_bitmask = _captivityReasonsBooleans call FUNC(toBitmask); - -// actually apply the setCaptive command globaly -[[_unit, _bitmask], "{(_this select 0) setCaptive (_this select 1)}", _unit] call FUNC(execRemoteFnc); +[_unit, "setCaptive", _reason, _status] call FUNC(statusEffect_set); diff --git a/addons/common/functions/fnc_setDefinedVariable.sqf b/addons/common/functions/fnc_setDefinedVariable.sqf index 9b7812ee82..6f1f0c2e58 100644 --- a/addons/common/functions/fnc_setDefinedVariable.sqf +++ b/addons/common/functions/fnc_setDefinedVariable.sqf @@ -17,8 +17,7 @@ params ["_unit", "_variable", "_value", "_global"]; if (isNil "_global") then { - private "_definedVariable"; - _definedVariable = [_variable] call FUNC(getDefinedVariableInfo); + private _definedVariable = [_variable] call FUNC(getDefinedVariableInfo); _definedVariable params ["", "", ["_global", false]]; }; diff --git a/addons/common/functions/fnc_setForceWalkStatus.sqf b/addons/common/functions/fnc_setForceWalkStatus.sqf index aaa594b9a9..800040d978 100644 --- a/addons/common/functions/fnc_setForceWalkStatus.sqf +++ b/addons/common/functions/fnc_setForceWalkStatus.sqf @@ -14,36 +14,13 @@ * Example: * [ACE_Player, "BrokenLeg", true] call FUNC(setForceWalkStatus) * - * Public: No + * Public: Yes */ #include "script_component.hpp" params ["_unit", "_reason", "_status"]; -private ["_forceWalkReasons", "_unitForceWalkReasons", "_forceWalkReasonsBooleans", "_bitmaskNumber"]; +//Now just a wrapper for FUNC(statusEffect_set) [No longer used in ace as of 3.5] +ACE_DEPRECATED("ace_common_fnc_setForceWalkStatus","3.7.0","ace_common_fnc_statusEffect_set"); -_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"; -}; - -// get reasons why the unit is forceWalking already and update to the new status -_unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus); - -_forceWalkReasonsBooleans = []; -{ - _forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons]; -} forEach _forceWalkReasons; - -_forceWalkReasonsBooleans set [_forceWalkReasons find _reason, _status]; - -_bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask); - -_unit setVariable ["ACE_forceWalkStatusNumber", _bitmaskNumber, true]; - -// actually apply the forceWalk command globaly -[[_unit], QFUNC(applyForceWalkStatus), 2] call FUNC(execRemoteFnc); +[_unit, "forceWalk", _reason, _status] call FUNC(statusEffect_set); diff --git a/addons/common/functions/fnc_setHearingCapability.sqf b/addons/common/functions/fnc_setHearingCapability.sqf index d24f8d0d9d..7bd375a58b 100644 --- a/addons/common/functions/fnc_setHearingCapability.sqf +++ b/addons/common/functions/fnc_setHearingCapability.sqf @@ -18,11 +18,10 @@ params ["_id", "_settings", ["_add", true]]; -private ["_map", "_exists", "_lowestVolume"]; +private _map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]]; -_map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]]; +private _exists = false; -_exists = false; { if (_id == _x select 0) exitWith { _exists = true; @@ -42,7 +41,8 @@ if (!_exists && _add) then { missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map]; // find lowest volume -_lowestVolume = 1; +private _lowestVolume = 1; + { _lowestVolume = (_x select 1) min _lowestVolume; false diff --git a/addons/common/functions/fnc_setPitchBankYaw.sqf b/addons/common/functions/fnc_setPitchBankYaw.sqf index ea7f27a906..fecc16208c 100644 --- a/addons/common/functions/fnc_setPitchBankYaw.sqf +++ b/addons/common/functions/fnc_setPitchBankYaw.sqf @@ -19,14 +19,12 @@ params ["_object", "_aroundX", "_aroundY", "_aroundZ"]; _aroundZ = - _aroundZ; -private ["_dirX", "_dirY", "_dirZ", "_upX", "_upY", "_upZ", "_dir", "_up"]; - -_dirX = 0; -_dirY = 1; -_dirZ = 0; -_upX = 0; -_upY = 0; -_upZ = 1; +private _dirX = 0; +private _dirY = 1; +private _dirZ = 0; +private _upX = 0; +private _upY = 0; +private _upZ = 1; if (_aroundX != 0) then { _dirY = cos _aroundX; @@ -43,18 +41,16 @@ if (_aroundY != 0) then { }; if (_aroundZ != 0) then { - private ["_dirXTemp", "_upXTemp"]; - - _dirXTemp = _dirX; + private _dirXTemp = _dirX; _dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ); _dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ); - _upXTemp = _upX; + private _upXTemp = _upX; _upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ); _upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ); }; -_dir = [_dirX, _dirY, _dirZ]; -_up = [_upX, _upY, _upZ]; +private _dir = [_dirX, _dirY, _dirZ]; +private _up = [_upX, _upY, _upZ]; _object setVectorDirAndUp [_dir,_up]; diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index 5dc55f51f7..ac7a0f4875 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -14,13 +14,11 @@ params ["_optionEntry"]; -private ["_fnc_getValueWithType", "_value", "_name", "_typeName", "_settingData", "_valueConfig", "_text"]; - -_fnc_getValueWithType = { +private _fnc_getValueWithType = { params ["_optionEntry", "_typeName"]; - _valueConfig = (_optionEntry >> "value"); - _value = if (isNumber (_optionEntry >> "value")) then {getNumber (_optionEntry >> "value")} else {0}; + private _valueConfig = (_optionEntry >> "value"); + private _value = if (isNumber (_optionEntry >> "value")) then {getNumber (_optionEntry >> "value")} else {0}; TRACE_3("_fnc_getValueWithType:", configName _optionEntry, _typeName, _value); if (_typeName == "BOOL") exitWith { _value > 0 @@ -37,27 +35,27 @@ _fnc_getValueWithType = { _value }; -_name = configName _optionEntry; +private _name = configName _optionEntry; // Check if the variable is already defined if (isNil _name) then { // That setting was not loaded yet // Get type from config - _typeName = getText (_optionEntry >> "typeName"); + private _typeName = getText (_optionEntry >> "typeName"); if (_typeName == "") then { _typeName = "SCALAR"; }; // Read entry and cast it to the correct type - _value = [_optionEntry, _typeName] call _fnc_getValueWithType; + private _value = [_optionEntry, _typeName] call _fnc_getValueWithType; // Init the variable missionNamespace setVariable [_name, _value]; // Add the setting to a list on the server // Set the variable to not forced - /*_settingData = [ + /*private _settingData = [ name, typeName, isClientSettable, @@ -68,7 +66,7 @@ if (isNil _name) then { defaultValue, category ];*/ - _settingData = [ + private _settingData = [ _name, _typeName, (getNumber (_optionEntry >> "isClientSettable")) > 0, @@ -81,10 +79,10 @@ if (isNil _name) then { ]; //Strings in the values array won't be localized from the config, so just do that now: - /*private "_values"; - _values = _settingData select 5; + /*private _values = _settingData select 5; + { - _text = _x; + private _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 $ _values set [_forEachIndex, _text]; @@ -98,13 +96,13 @@ if (isNil _name) then { // The setting already exists. // Check if it's already forced and quit - _settingData = [_name] call FUNC(getSettingData); + private _settingData = [_name] call FUNC(getSettingData); if (_settingData select 6) exitWith {}; // The setting is not forced, so update the value // Read entry and cast it to the correct type from the existing variable - _value = [_optionEntry, _settingData select 1] call _fnc_getValueWithType; + private _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 d1bd27ea4e..35e8c0d116 100644 --- a/addons/common/functions/fnc_setVariableJIP.sqf +++ b/addons/common/functions/fnc_setVariableJIP.sqf @@ -16,8 +16,7 @@ params ["_unit", "_varName", "_value"]; -private "_respawnVariables"; -_respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; +private _respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; if !(_varName in _respawnVariables) then { _respawnVariables pushBack _varName; diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf index 8dbaeffbd6..bf6b35a862 100644 --- a/addons/common/functions/fnc_setVariablePublic.sqf +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -1,56 +1,53 @@ /* - * Author: commy2 and joko // Jonas - * Sets a public variable, but wait a certain amount of time to transfer the value over the network. Changing the value by calling this function again resets the windup timer. + * Author: commy2 and CAA-Picard and joko and PabstMirror + * Publish a variable, but wait a certain amount of time before allowing it to be published it again. * - * Arguments: + * Argument: * 0: Object the variable should be assigned to * 1: Name of the variable * 2: Value of the variable - * 3: Windup time (default: 1) + * 3: Embargo delay (Optional. Default: 1) * - * Return Value: - * None + * Return value: + * Nothing. + * + * Example: + * [player, "balls", 2, 1] call ace_common_fnc_setVariablePublic; * * Public: No */ +// #define DEBUG_MODE_FULL #include "script_component.hpp" -params ["_object", "_varName", "_value", ["_sync", 1]]; +params ["_object", "_varName", "_value", ["_delay", 1]]; +TRACE_4("params",_object,_varName,_value,_delay); // set value locally _object setVariable [_varName, _value]; -// Exit if in SP +// Exit if in SP - "duh" if (!isMultiplayer) exitWith {}; -private ["_idName", "_syncTime"]; +// If we are on embargo, exit +if (_object isEqualTo (_object getVariable [format ["ACE_onEmbargo_%1", _varName], objNull])) exitWith {}; -_idName = format ["ACE_setVariablePublic_%1", _varName]; +// Publish Now and set last update time: +_object setVariable [_varName, _value, true]; +_object setVariable [format ["ACE_onEmbargo_%1", _varName], _object]; -if (_idName in GVAR(setVariableNames)) exitWith {}; +TRACE_2("Starting Embargo", _varName, _delay); -_syncTime = ACE_diagTime + _sync; +[{ + params ["_object", "_varName", "_value"]; + if (isNull _object) exitWith {TRACE_1("objNull",_this);}; -GVAR(setVariableNames) pushBack _idName; + _object setVariable [format ["ACE_onEmbargo_%1", _varName], nil]; //Remove Embargo + private _curValue = _object getVariable _varName; -GVAR(setVariablePublicArray) pushBack [_object, _varName, _syncTime, _idName]; + TRACE_4("End of embargo", _object, _varName, _value, _curValue); -if (isNil QGVAR(setVariablePublicPFH)) exitWith {}; - -GVAR(setVariablePublicPFH) = [{ - { - _x params ["_object", "_varName", "_syncTime", "_idName"]; - if (ACE_diagTime > _syncTime) then { - // set value public - _object setVariable [_varName, _object getVariable _varName, true]; - GVAR(setVariablePublicArray) deleteAt (GVAR(setVariablePublicArray) find _x); - GVAR(setVariableNames) deleteAt (GVAR(setVariableNames) find _x); - }; - nil - } count +GVAR(setVariablePublicArray); - - if (GVAR(setVariablePublicArray) isEqualTo []) then { - [GVAR(setVariablePublicPFH)] call CBA_fnc_removePerFrameHandler; - GVAR(setVariablePublicPFH) = nil; + //If value at start of embargo doesn't equal current, then broadcast and start new embargo + if (!(_value isEqualTo _curValue)) then { + _this call FUNC(setVariablePublic); }; -}, 0, []] call CBA_fnc_addPerFrameHandler; +}, _this, _delay] call FUNC(waitAndExecute); diff --git a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf deleted file mode 100644 index 9bbec92d40..0000000000 --- a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: Glowbal - * ? - * - * Arguments: - * ? - * - * Return Value: - * ? - * - * Public: Yes - * - * Deprecated - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_sortAlphabeticallyBy","3.5.0","sort"); - -params ["_array", "_elementN"]; - -private ["_elements", "_indexes", "_theElement", "_tmp", "_tempIndex", "_returnArray"]; - -_indexes = []; -_elements = []; - -{ - _theElement = toArray (_x select _elementN); - _indexes pushBack _forEachIndex; - _elements pushBack _theElement; -} forEach _array; - -for "_i" from 1 to (count _elements) - 1 do { - _tmp = _elements select _i; - _tempIndex = _indexes select _i; - _j = _i; - while {_j >= 1 && {_tmp < _elements select (_j - 1)}} do { - _elements set [_j, _elements select (_j - 1)]; - _indexes set [_j, _indexes select (_j - 1)]; - _j = _j - 1; - }; - _elements set[_j, _tmp]; - _indexes set [_j, _tempIndex]; -}; - -_returnArray = []; - -{ - _returnArray pushBack (_array select _x); -} forEach _indexes; - -_returnArray diff --git a/addons/common/functions/fnc_statusEffect_addType.sqf b/addons/common/functions/fnc_statusEffect_addType.sqf new file mode 100644 index 0000000000..afd7ff7be7 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_addType.sqf @@ -0,0 +1,37 @@ +/* + * Author: PabstMirror + * Adds a status effect that will be handled. + * + * Arguments: + * 0: Status Effect Name, this should match a corisponding event name + * 1: Send event globaly + * 2: Common Effect Reaons to pre-seed durring init + * + * Return Value: + * Nothing + * + * Example: + * ["setCaptive", true, []] call ace_common_fnc_statusEffect_addType + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_name", "", [""]], ["_isGlobal", false, [false]], ["_commonReasonsArray", [], [[]]]]; +TRACE_3("params",_name,_isGlobal,_commonReasonsArray); + +if (_name == "") exitWith {ACE_LOGERROR_1("addStatusEffect - Bad Name %1", _this)}; +if (_name in GVAR(statusEffect_Names)) exitWith {ACE_LOGWARNING_1("addStatusEffect - Effect Already Added (note, will not update global bit) %1", _this)}; + +GVAR(statusEffect_Names) pushBack _name; +GVAR(statusEffect_isGlobal) pushBack _isGlobal; + +//We add reasons at any time, but more efficenet to add all common ones at one time during init +if (isServer && {!(_commonReasonsArray isEqualTo [])}) then { + //Switch case to lower: + { + _commonReasonsArray set [_forEachIndex, toLower _x]; + } forEach _commonReasonsArray; + missionNamespace setVariable [(format [QGVAR(statusEffects_%1), _name]), _commonReasonsArray, true]; +}; diff --git a/addons/common/functions/fnc_statusEffect_get.sqf b/addons/common/functions/fnc_statusEffect_get.sqf new file mode 100644 index 0000000000..2d7e17e0ec --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_get.sqf @@ -0,0 +1,63 @@ +/* + * Author: PabstMirror + * Retrives list of current status effects + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * 1: Effect Name + * + * Return Value: + * Effect status + * 0: is activly set (if false, the effect is ignored and never modified) + * 1: reasons why it is set true (list of strings, count of 0 = false, 1+ = true) + * + * Example: + * [player, "forceWalk"] call ace_common_fnc_statusEffect_get + * + * Public: Yes + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_effectName", "", [""]]]; +TRACE_2("params",_object,_effectName); + +if (isNull _object) exitWith { + TRACE_1("null",_object); + [false, []] +}; + +[_object, false] call FUNC(statusEffect_resetVariables); //Check for mismatch + +//List of reasons +private _statusReasons = missionNamespace getVariable [(format [QGVAR(statusEffects_%1), _effectName]), []]; +if (_statusReasons isEqualTo []) exitWith { + TRACE_1("no reasons - bad effect?",_statusReasons); + [false, []] +}; + +//Get Effect Number +private _effectVarName = format [QGVAR(effect_%1), _effectName]; +private _effectNumber = _object getVariable [_effectVarName, -1]; +TRACE_2("current",_effectVarName,_effectNumber); + +if (_effectNumber == -1) exitWith { //Nil array - no effect + [false, []] +}; +if (_effectNumber == 0) exitWith { //empty array - false effect + [true, []] +}; + +//if no change: skip sending publicVar and events +private _effectBoolArray = [_effectNumber, count _statusReasons] call FUNC(binarizeNumber); +TRACE_2("bitArray",_statusIndex,_effectBoolArray); + +private _activeEffects = []; +{ + if (_x) then { + _activeEffects pushBack (_statusReasons select _forEachIndex); + }; +} forEach _effectBoolArray; + +//non-empty array - true effect +[true, _activeEffects] diff --git a/addons/common/functions/fnc_statusEffect_localEH.sqf b/addons/common/functions/fnc_statusEffect_localEH.sqf new file mode 100644 index 0000000000..5490029a3b --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_localEH.sqf @@ -0,0 +1,36 @@ +/* + * Author: PabstMirror + * Handles locality switch, runs a respawn check and then reapplies all effect events. + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * + * Return Value: + * Nothing + * + * Example: + * [player, true] call ace_common_fnc_statusEffect_localEH + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params ["_object", "_isLocal"]; +TRACE_2("params",_object,_isLocal); + +//Only run this after the settings are initialized +//Need to wait for all EH to be installed (local event will happen between pre and post init) +if !(GVAR(settingsInitFinished)) exitWith { + TRACE_1("pushing to runAtSettingsInitialized", _this); + GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_localEH), _this]; +}; + +if (!_isLocal) exitWith {TRACE_1("object no longer local", _this)}; +if (isNull _object) exitWith {TRACE_1("object null", _this)}; + + //Reset any variables because of respawn +[_object, false] call FUNC(statusEffect_resetVariables); + +//Send all Variables to client +[_object, ""] call FUNC(statusEffect_sendEffects); diff --git a/addons/common/functions/fnc_statusEffect_resetVariables.sqf b/addons/common/functions/fnc_statusEffect_resetVariables.sqf new file mode 100644 index 0000000000..2a307c84e5 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_resetVariables.sqf @@ -0,0 +1,45 @@ +/* + * Author: PabstMirror + * Resets all effect numbers to 0 when an object respawns (but does not apply the effect event). + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * + * Return Value: + * Nothing + * + * Example: + * [player, true] call ace_common_fnc_statusEffect_resetVariables + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_setObjectRef", false, [false]]]; +TRACE_2("params",_object,_setObjectRef); + +if (isNull _object) exitWith {}; + +private _objectRef = _object getVariable QGVAR(statusEffect_object); +TRACE_2("testing",_object,_objectRef); + +// If nothing was ever set, or objects match, exit (always true unless respawned) +if (isNil "_objectRef") exitWith { + if (_setObjectRef) then { + _object setVariable [QGVAR(statusEffect_object), _object, true]; //explicitly set new object ref + }; +}; +if (_object == _objectRef) exitWith {}; + +//Mismatch, so if effect has ever been defined, reset to 0 +{ + private _effectVarName = format [QGVAR(effect_%1), _x]; + private _effectNumber = _object getVariable [_effectVarName, -1]; + if (_effectNumber != -1) then { + TRACE_2("forced reset defined array on object mismatch",_x,_effectNumber); + _object setVariable [_effectVarName, 0, true]; //This always resets to 0 (not -1/nil)! + }; +} forEach GVAR(statusEffect_Names); + +_object setVariable [QGVAR(statusEffect_object), _object, true]; diff --git a/addons/common/functions/fnc_statusEffect_respawnEH.sqf b/addons/common/functions/fnc_statusEffect_respawnEH.sqf new file mode 100644 index 0000000000..92717b68c7 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_respawnEH.sqf @@ -0,0 +1,36 @@ +/* + * Author: PabstMirror + * Handles the Respawn Event Handler to reset effects. + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * + * Return Value: + * Nothing + * + * Example: + * [player, objNull] call ace_common_fnc_statusEffect_respawnEH + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params ["_object"]; +TRACE_1("params",_object); + +//Only run this after the settings are initialized +//Need to wait for all EH to be installed (local event will happen between pre and post init) +if !(GVAR(settingsInitFinished)) exitWith { + TRACE_1("pushing to runAtSettingsInitialized", _this); + GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_respawnEH), _this]; +}; + +if (!local _object) exitWith {TRACE_1("object no longer local", _this)}; +if (isNull _object) exitWith {TRACE_1("object null", _this)}; + + //Reset any variables on "real" respawn +[_object, false] call FUNC(statusEffect_resetVariables); + +//Send all Variables to client +[_object, ""] call FUNC(statusEffect_sendEffects); diff --git a/addons/common/functions/fnc_statusEffect_sendEffects.sqf b/addons/common/functions/fnc_statusEffect_sendEffects.sqf new file mode 100644 index 0000000000..4291de1ad8 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_sendEffects.sqf @@ -0,0 +1,48 @@ +/* + * Author: PabstMirror + * Sends all status effects for an object (can be run on non-local objects) + * + * Arguments: + * 0: Object + * 1: Effect name (or "" or send all) + * + * Return Value: + * Nothing + * + * Example: + * [player, ""] call ace_common_fnc_statusEffect_sendEffects + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_effectName", "", [""]]]; +TRACE_2("params",_object,_effectName); + +if (isNull _object) exitWith {}; + +{ + if ((_effectName == "") || {_effectName == _x}) then { + private _effectVarName = format [QGVAR(effect_%1), _x]; + private _effectNumber = _object getVariable [_effectVarName, -1]; + + //We only do anything if the effect has been defined at some point in the game for this unit + TRACE_2("checking if event is nil",_x,_effectNumber); + if (_effectNumber != -1) then { + if (GVAR(statusEffect_isGlobal) select _forEachIndex) then { + TRACE_2("Sending Global Event", _object, _effectNumber); + [_x, [_object, _effectNumber]] call FUNC(globalEvent); + } else { + if (local _object) then { + //If local, send directly to bypass network delay of targetEvent call + TRACE_2("Sending Target Local Event", _object, _effectNumber); + [_x, [_object, _effectNumber]] call FUNC(localEvent); + } else { + TRACE_2("Sending Target Non-Local Event", _object, _effectNumber); + [_x, [_object], [_object, _effectNumber]] call FUNC(targetEvent); + }; + }; + }; + }; +} forEach GVAR(statusEffect_Names); diff --git a/addons/common/functions/fnc_statusEffect_set.sqf b/addons/common/functions/fnc_statusEffect_set.sqf new file mode 100644 index 0000000000..a0be8d8719 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_set.sqf @@ -0,0 +1,70 @@ +/* + * Author: PabstMirror + * Adds or removes an id to a status effect and will send an event to apply. + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * 1: Effect Name + * 2: Unique Reason ID + * 3: Is Set (true adds/false removes) + * + * Return Value: + * Nothing + * + * Example: + * [player, "setCaptive", "reason1", true] call ace_common_fnc_statusEffect_set + * + * Public: Yes + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_effectName", "", [""]], ["_ID", "", [""]], ["_set", true, [false]]]; +TRACE_4("params",_object,_effectName,_ID,_set); + +//Only run this after the settings are initialized +if !(GVAR(settingsInitFinished)) exitWith { + TRACE_1("pushing to runAtSettingsInitialized", _this); + GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_set), _this]; +}; + +if (isNull _object) exitWith {TRACE_1("null",_object);}; + +[_object, true] call FUNC(statusEffect_resetVariables); //Check for mismatch, and set object ref + +//check ID case and set globaly if not already set: +_ID = toLower _ID; +private _statusReasons = missionNamespace getVariable [(format [QGVAR(statusEffects_%1), _effectName]), []]; +private _statusIndex = _statusReasons find _ID; +if (_statusIndex == -1) then { + TRACE_2("ID not in global reasons, adding",_statusReasons,_ID); + _statusIndex = _statusReasons pushBack _ID; + missionNamespace setVariable [(format [QGVAR(statusEffects_%1), _effectName]), _statusReasons, true]; +}; + +private _effectVarName = format [QGVAR(effect_%1), _effectName]; +private _effectNumber = _object getVariable [_effectVarName, -1]; +TRACE_2("current",_effectVarName,_effectNumber); + +if ((_effectNumber == -1) && {!_set}) exitWith { + //Optimization for modules that always set an ID to false even if never set true + TRACE_2("Set False on nil array, exiting",_set,_effectNumber); +}; + +if (_effectNumber == -1) then {_effectNumber = 0}; //reset (-1/nil) to 0 + +//if no change: skip sending publicVar and events +private _effectBoolArray = [_effectNumber, count _statusReasons] call FUNC(binarizeNumber); +TRACE_2("bitArray",_statusIndex,_effectBoolArray); +if (_set isEqualTo (_effectBoolArray select _statusIndex)) exitWith { + TRACE_2("No Change, exiting",_set,_effectBoolArray select _statusIndex); +}; + +TRACE_2("Setting to new value",_set,_effectBoolArray select _statusIndex); +_effectBoolArray set [_statusIndex, _set]; +_effectNumber = _effectBoolArray call FUNC(toBitmask); //Convert array back to number + +TRACE_2("Saving globaly",_effectVarName,_effectNumber); +_object setVariable [_effectVarName, _effectNumber, true]; + +[_object, _effectName] call FUNC(statusEffect_sendEffects); diff --git a/addons/common/functions/fnc_stringCompare.sqf b/addons/common/functions/fnc_stringCompare.sqf index da65c676f8..ad3073eb1e 100644 --- a/addons/common/functions/fnc_stringCompare.sqf +++ b/addons/common/functions/fnc_stringCompare.sqf @@ -18,16 +18,14 @@ params ["_string", "_searchTerm"]; _string = toLower _string; // removes case sensitivity _searchTerm = toLower _searchTerm; -private ["_arraySearchTerm", "_arrayString", "_sizeSearchTerm", "_sizeString", "_matchingCharacters", "_searchIterator", "_targetIterator"]; +private _arraySearchTerm = toArray _searchTerm; // splits string into array of unicode decimals +private _arrayString = toArray _string; +private _sizeSearchTerm = count _arraySearchTerm; // We only measure the array once +private _sizeString = count _arrayString; -_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; -_searchIterator = 0; -_targetIterator = 0; +private _matchingCharacters = 0; +private _searchIterator = 0; +private _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 diff --git a/addons/common/functions/fnc_switchToGroupSide.sqf b/addons/common/functions/fnc_switchToGroupSide.sqf index 7d23e6442a..3a559a7a65 100644 --- a/addons/common/functions/fnc_switchToGroupSide.sqf +++ b/addons/common/functions/fnc_switchToGroupSide.sqf @@ -17,29 +17,24 @@ params [["_unit", objNull], ["_switch", false], ["_id", ""], ["_side", side _unit]]; -private "_previousGroupsList"; -_previousGroupsList = _unit getVariable [QGVAR(previousGroupSwitchTo), []]; +private _previousGroupsList = _unit getVariable [QGVAR(previousGroupSwitchTo), []]; if (_switch) then { // go forward - private ["_previousGroup", "_originalSide", "_newGroup"]; - - _previousGroup = group _unit; - _originalSide = side group _unit; + private _previousGroup = group _unit; + private _originalSide = side group _unit; if (count units _previousGroup == 1 && _originalSide == _side) exitWith { [format ["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug); }; - _newGroup = createGroup _side; + private _newGroup = createGroup _side; [_unit] joinSilent _newGroup; _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]; @@ -53,11 +48,11 @@ if (_switch) then { { if (_x select 3) exitWith {}; // stop at first id set to true if !(_x select 3) then { - _currentGroup = group _unit; + private _currentGroup = group _unit; if (!isNull (_x select 0)) then { [_unit] joinSilent (_x select 0); } else { - _newGroup = createGroup (_x select 1); + private _newGroup = createGroup (_x select 1); [_unit] joinSilent _newGroup; }; if (count units _currentGroup == 0) then { diff --git a/addons/common/functions/fnc_syncedEvent.sqf b/addons/common/functions/fnc_syncedEvent.sqf index 34043fa8ae..4ed8107330 100644 --- a/addons/common/functions/fnc_syncedEvent.sqf +++ b/addons/common/functions/fnc_syncedEvent.sqf @@ -21,7 +21,6 @@ if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { false }; -private "_eventData"; -_eventData = [_name, _args, _ttl]; +private _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 1b2f634ace..62df8f10a7 100644 --- a/addons/common/functions/fnc_syncedEventPFH.sqf +++ b/addons/common/functions/fnc_syncedEventPFH.sqf @@ -19,21 +19,17 @@ if (!isServer) exitWith {false}; // @TODO: This should be iteration limited to prevent FPS lag { - private ["_name", "_data", "_newEventLog"]; + private _name = _x; - _name = _x; - - _data = HASH_GET(GVAR(syncedEvents),_name); + private _data = HASH_GET(GVAR(syncedEvents),_name); _data params ["_eventTime", "_eventLog", "_globalEventTTL"]; - _newEventLog = []; + private _newEventLog = []; // @TODO: This should be iteration limited to prevent FPS lag { - private ["_eventEntry", "_ttlReturn"]; - - _eventEntry = _x; - _ttlReturn = true; + private _eventEntry = _x; + private _ttlReturn = true; if (_globalEventTTL isEqualType {}) then { _ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL; diff --git a/addons/common/functions/fnc_toBin.sqf b/addons/common/functions/fnc_toBin.sqf index 9f3296597d..f8ec0bac68 100644 --- a/addons/common/functions/fnc_toBin.sqf +++ b/addons/common/functions/fnc_toBin.sqf @@ -14,15 +14,13 @@ params ["_number", ["_minLength", 1]]; -private ["_sign", "_bin", "_rest"]; - -_sign = ["", "-"] select (_number < 0); +private _sign = ["", "-"] select (_number < 0); _number = round abs _number; -_bin = ["", "0"] select (_number == 0); +private _bin = ["", "0"] select (_number == 0); while {_number > 0} do { - _rest = str (_number mod 2); + private _rest = str (_number mod 2); _number = floor (_number / 2); _bin = _rest + _bin; }; diff --git a/addons/common/functions/fnc_toBitmask.sqf b/addons/common/functions/fnc_toBitmask.sqf index 35b1e06f9f..333e5c737b 100644 --- a/addons/common/functions/fnc_toBitmask.sqf +++ b/addons/common/functions/fnc_toBitmask.sqf @@ -12,8 +12,7 @@ */ #include "script_component.hpp" -private "_result"; -_result = 0; +private _result = 0; { if (_x) then {_result = _result + 2 ^ _forEachIndex}; diff --git a/addons/common/functions/fnc_toHex.sqf b/addons/common/functions/fnc_toHex.sqf index 80d8757b80..c558aab04b 100644 --- a/addons/common/functions/fnc_toHex.sqf +++ b/addons/common/functions/fnc_toHex.sqf @@ -19,16 +19,14 @@ _number = ((round abs _number) max 0) min 255; if (isNil QGVAR(hexArray)) then { GVAR(hexArray) = []; - private ["_minLength", "_num", "_hex", "_rest"]; - - _minLength = 2; + private _minLength = 2; for [{_i = 0;}, {_i < 256}, {_i = _i + 1}] do { - _num = _i; - _hex = ["", "0"] select (_i == 0); + private _num = _i; + private _hex = ["", "0"] select (_i == 0); while {_num > 0} do { - _rest = _num mod 16; + private _rest = _num mod 16; _rest = switch _rest do { case 10 : {"A"}; case 11 : {"B"}; diff --git a/addons/common/functions/fnc_translateToModelSpace.sqf b/addons/common/functions/fnc_translateToModelSpace.sqf index b05a19bed6..b9fa35243a 100644 --- a/addons/common/functions/fnc_translateToModelSpace.sqf +++ b/addons/common/functions/fnc_translateToModelSpace.sqf @@ -14,8 +14,7 @@ params ["_object", "_matrix", "_offset"]; -private "_origin"; -_origin = getPosASL _object; +private _origin = getPosASL _object; _matrix params ["_xVec", "_yVec", "_zVec"]; diff --git a/addons/common/functions/fnc_translateToWeaponSpace.sqf b/addons/common/functions/fnc_translateToWeaponSpace.sqf index db3a5eaf37..cd360bd874 100644 --- a/addons/common/functions/fnc_translateToWeaponSpace.sqf +++ b/addons/common/functions/fnc_translateToWeaponSpace.sqf @@ -14,8 +14,7 @@ params ["_object", "_matrix", "_offset"]; -private "_origin"; -_origin = getPosASL _object; +private _origin = getPosASL _object; _matrix params ["_xVec", "_yVec", "_zVec"]; diff --git a/addons/common/functions/fnc_unhideUnit.sqf b/addons/common/functions/fnc_unhideUnit.sqf index 5bcafc3509..908dbf3dc8 100644 --- a/addons/common/functions/fnc_unhideUnit.sqf +++ b/addons/common/functions/fnc_unhideUnit.sqf @@ -20,8 +20,7 @@ params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; -private "_setHiddenReasons"; -_setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []]; +private _setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []]; if (_reason in _setHiddenReasons) then { _setHiddenReasons deleteAt (_setHiddenReasons find _reason); diff --git a/addons/common/functions/fnc_uniqueElements.sqf b/addons/common/functions/fnc_uniqueElements.sqf index 55d8c4ef5f..471ba47457 100644 --- a/addons/common/functions/fnc_uniqueElements.sqf +++ b/addons/common/functions/fnc_uniqueElements.sqf @@ -12,6 +12,6 @@ */ #include "script_component.hpp" -params ["_array"]; +params [["_array", [], [[]]]]; _array arrayIntersect _array // return diff --git a/addons/common/functions/fnc_uniqueElementsOnly.sqf b/addons/common/functions/fnc_uniqueElementsOnly.sqf deleted file mode 100644 index 9bdb6ff647..0000000000 --- a/addons/common/functions/fnc_uniqueElementsOnly.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: Glowbal - * Make a copy of an array with only the unique elements. - * - * Arguments: - * 0: array - * - * Return Value: - * Copy of original array - * - * Public: Yes - * - * Deprecated - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_uniqueElementsOnly","3.5.0","ace_common_fnc_uniqueElements"); - -_this call FUNC(uniqueElements) diff --git a/addons/common/functions/fnc_unloadPerson.sqf b/addons/common/functions/fnc_unloadPerson.sqf index 73e02cd7ce..72816f2c3f 100644 --- a/addons/common/functions/fnc_unloadPerson.sqf +++ b/addons/common/functions/fnc_unloadPerson.sqf @@ -8,6 +8,9 @@ * Return Value: * Returns true if succesfully unloaded person * + * Example: + * [hurtGuy] call ace_common_fnc_unloadPerson + * * Public: No */ #include "script_component.hpp" @@ -16,20 +19,14 @@ params ["_unit"]; -private "_vehicle"; -_vehicle = vehicle _unit; +private _vehicle = vehicle _unit; if (_vehicle == _unit) 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 (speed _vehicle > 1 || {((getPos _vehicle) select 2) > 2}) exitWith {false}; if (!isNull _vehicle) then { - [[_unit], QUOTE(FUNC(unloadPersonLocal)), _unit, false] call FUNC(execRemoteFnc); + ["unloadPersonEvent", [_unit], [_unit, _vehicle]] call EFUNC(common,targetEvent); }; true diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf index a7e61a7868..ff5813434a 100644 --- a/addons/common/functions/fnc_unloadPersonLocal.sqf +++ b/addons/common/functions/fnc_unloadPersonLocal.sqf @@ -3,7 +3,9 @@ * Unload a person from a vehicle, local * * Arguments: - * 0: unit + * 0: unit to unload + * 1: Vehicle + * 2: Unloader (player) * * Return Value: * Returns true if succesfully unloaded person @@ -14,54 +16,22 @@ #define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) -params ["_unit", "_vehicle"]; -TRACE_2("params",_unit,_vehicle); +params ["_unit", "_vehicle", ["_unloader", objNull]]; +TRACE_3("params",_unit,_vehicle,_unloader); -private ["_validVehiclestate", "_emptyPos", "_loaded"]; +//This covers testing vehicle stability and finding a safe position +private _emptyPos = [_vehicle, (typeOf _unit), _unloader] call EFUNC(common,findUnloadPosition); +TRACE_1("findUnloadPosition",_emptyPos); -_validVehiclestate = true; - -if (_vehicle isKindOf "Ship") then { - if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then { - _validVehiclestate = false; +if (count _emptyPos != 3) exitwith { + ACE_LOGWARNING_4("Could not find unload pos %1-ASL: %2 isTouchingGround: %3 Speed: %4",_vehicle, getPosASL _vehicle, isTouchingGround _vehicle, speed _vehicle); + if ((!isNull _unloader) && {[_unloader] call FUNC(isPlayer)}) then { + //display text saying there are no safe places to exit the vehicle + ["displayTextStructured", [_unloader], [localize LSTRING(NoRoomToUnload)]] call FUNC(targetEvent); }; - - 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 = ASLToAGL getPosASL _vehicle; - _emptyPos = _emptyPos vectorAdd [random 10 - 5, random 10 - 5, 0]; - } else { - if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then { - _validVehiclestate = false; - }; - - TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); - - _emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeOf _unit]; - }; -}; - -TRACE_1("getPosASL Vehicle Check", getPosASL _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; @@ -78,8 +48,7 @@ _unit action ["Eject", vehicle _unit]; TRACE_1("Check if isAwake", [_unit] call FUNC(isAwake)); if (driver _unit == _unit) then { - private "_anim"; - _anim = [_unit] call FUNC(getDeathAnim); + private _anim = [_unit] call FUNC(getDeathAnim); [_unit, _anim, 1, true] call FUNC(doAnimation); @@ -89,16 +58,16 @@ _unit action ["Eject", vehicle _unit]; if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { [_unit, _anim, 2, true] call FUNC(doAnimation); }; - }, [_unit, _anim], 0.5, 0] call FUNC(waitAndExecute); + }, [_unit, _anim], 0.5] call FUNC(waitAndExecute); }; }; -}, [_unit, _emptyPos], 0.5, 0] call FUNC(waitAndExecute); +}, [_unit, _emptyPos], 0.5] call FUNC(waitAndExecute); [_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide); -_loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; +private _loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; _loaded deleteAt (_loaded find _unit); -_vehicle setVariable [QGVAR(loaded_persons), _loaded, true]; +_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 bf02fe676f..a995eed244 100644 --- a/addons/common/functions/fnc_unmuteUnit.sqf +++ b/addons/common/functions/fnc_unmuteUnit.sqf @@ -18,8 +18,7 @@ params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; // remove reason to mute to the unit -private "_muteUnitReasons"; -_muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []]; +private _muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []]; if (_reason in _muteUnitReasons) then { _muteUnitReasons deleteAt (_muteUnitReasons find _reason); @@ -29,8 +28,7 @@ if (_reason in _muteUnitReasons) then { // don't unmute if there is another mute reason! if (count _muteUnitReasons > 0) exitWith {}; -private "_speaker"; -_speaker = _unit getVariable ["ACE_OriginalSpeaker", ""]; +private _speaker = _unit getVariable ["ACE_OriginalSpeaker", ""]; if (_speaker == "") exitWith {}; diff --git a/addons/common/functions/fnc_useItem.sqf b/addons/common/functions/fnc_useItem.sqf index acf359813c..2d2116b38f 100644 --- a/addons/common/functions/fnc_useItem.sqf +++ b/addons/common/functions/fnc_useItem.sqf @@ -15,8 +15,7 @@ params ["_unit", "_item", ["_vehicleUsage", false]]; -private "_return"; -_return = false; +private _return = false; if !(_vehicleUsage) then { if (_item != "") then { diff --git a/addons/common/functions/fnc_useMagazine.sqf b/addons/common/functions/fnc_useMagazine.sqf index 1a77d0b3f3..4dc6136fa6 100644 --- a/addons/common/functions/fnc_useMagazine.sqf +++ b/addons/common/functions/fnc_useMagazine.sqf @@ -15,8 +15,7 @@ params ["_unit", "_magazine", ["_vehicleUsage", false]]; -private "_return"; -_return = false; +private _return = false; if !(_vehicleUsage) then { if (_magazine != "") then { diff --git a/addons/common/functions/fnc_waveHeightAt.sqf b/addons/common/functions/fnc_waveHeightAt.sqf index a3f2447729..bc278a9b70 100644 --- a/addons/common/functions/fnc_waveHeightAt.sqf +++ b/addons/common/functions/fnc_waveHeightAt.sqf @@ -1,6 +1,5 @@ /* * Author: jaynus - * * Gets the wave height at a specific location. Uses a logic, so may be performance iffy * * Arguments: diff --git a/addons/common/functions/fnc_worldToScreenBounds.sqf b/addons/common/functions/fnc_worldToScreenBounds.sqf index 2de07c7bbd..c9e5551d19 100644 --- a/addons/common/functions/fnc_worldToScreenBounds.sqf +++ b/addons/common/functions/fnc_worldToScreenBounds.sqf @@ -1,6 +1,5 @@ /* * Author: zGuba 2011 - * * Function helper for framing objects on screen. * * Arguments: @@ -26,14 +25,12 @@ params ["_object", "_margins", "_offsets"]; -private ["_minX", "_minY", "_maxX", "_maxY", "_bounds", "_boundsCorners"]; +private _minX = 10; +private _minY = 10; +private _maxX = -10; +private _maxY = -10; -_minX = 10; -_minY = 10; -_maxX = -10; -_maxY = -10; - -_bounds = boundingBox _object; +private _bounds = boundingBox _object; _margins params ["_marginsX", "_marginsY", "_marginsZ"]; _offsets params ["_offsetsX", "_offsetsY", "_offsetsZ"]; @@ -49,22 +46,23 @@ _boundsMaxX = _boundsMaxX + _marginsX + _offsetsX; _boundsMaxY = _boundsMaxY + _marginsY + _offsetsY; _boundsMaxZ = _boundsMaxZ + _marginsZ + _offsetsZ; -_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 _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); + private _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}; @@ -73,4 +71,4 @@ _boundsCorners = [ false } count _boundsCorners; -[_minX,_minY,_maxX,_maxY] +[_minX, _minY, _maxX, _maxY] diff --git a/addons/common/init_handleModifierKey.sqf b/addons/common/init_handleModifierKey.sqf new file mode 100644 index 0000000000..dd07db621c --- /dev/null +++ b/addons/common/init_handleModifierKey.sqf @@ -0,0 +1,20 @@ +/* + * Author: commy2 + * Initializes the modifier key handler. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +disableSerialization; + +params ["_display"]; + +_display displayAddEventHandler ["KeyDown", FUNC(handleModifierKey)]; +_display displayAddEventHandler ["KeyUp", FUNC(handleModifierKeyUp)]; diff --git a/addons/common/functions/fnc_handleScrollWheelInit.sqf b/addons/common/init_handleScrollWheel.sqf similarity index 55% rename from addons/common/functions/fnc_handleScrollWheelInit.sqf rename to addons/common/init_handleScrollWheel.sqf index 12f8b5f337..0acb84a5f2 100644 --- a/addons/common/functions/fnc_handleScrollWheelInit.sqf +++ b/addons/common/init_handleScrollWheel.sqf @@ -12,4 +12,8 @@ */ #include "script_component.hpp" -(findDisplay 46) displayAddEventHandler ["MouseZChanged", QUOTE(_this call FUNC(handleScrollWheel))]; +disableSerialization; + +params ["_display"]; + +_display displayAddEventHandler ["MouseZChanged", QUOTE(_this call FUNC(handleScrollWheel))]; diff --git a/addons/common/init_versionTooltip.sqf b/addons/common/init_versionTooltip.sqf new file mode 100644 index 0000000000..7aef3f4786 --- /dev/null +++ b/addons/common/init_versionTooltip.sqf @@ -0,0 +1,59 @@ +#include "script_component.hpp" + +#define MAX_COUNT 30 +#define ANIM_TIME 10 + +private _display = findDisplay 0; + +if (!scriptDone (_display getVariable [QGVAR(versionTooltip), scriptNull])) exitWith {}; + +_display setVariable [QGVAR(versionTooltip), [_display] spawn { + disableSerialization; + + params ["_display"]; + + private _allControls = []; + + private _fnc_create = { + private _ctrl = _display ctrlCreate ["RscPicture", -1]; + + // randomize size + private _size = selectRandom [safezoneW / 30, safezoneW / 20, safezoneW / 15]; + private _position = [ + random safezoneW + safezoneX - _size / 2, + - random (safezoneH / 5) + safezoneY - _size, + _size, + _size + ]; + + _ctrl ctrlSetPosition _position; + _ctrl ctrlCommit 0; + + // pls ignore + _ctrl ctrlSetText QUOTE(PATHTOF(data\icon_banana_ca.paa)); + + // animate with random speed + _position set [1, 1 - safezoneY]; + _ctrl ctrlSetPosition _position; + _ctrl ctrlCommit (ANIM_TIME * random [0.5, 1, 1.5]); + + _allControls pushBack _ctrl; + }; + + while {!isNull _display} do { + _allControls = _allControls select { + if (ctrlCommitted _x) then { + ctrlDelete _x; + false + } else { + true + }; + }; + + while {count _allControls < MAX_COUNT} do { + call _fnc_create; + }; + + uiSleep 3; + }; +}]; diff --git a/addons/common/script_component.hpp b/addons/common/script_component.hpp index 7c266c169d..4e941943fa 100644 --- a/addons/common/script_component.hpp +++ b/addons/common/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_COMMON #define DEBUG_MODE_FULL @@ -11,4 +14,8 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_COMMON #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" + +#define VERSION_CONFIG_COMMON VERSION_CONFIG;\ + versionDesc = "ACE 3";\ + versionAct = QUOTE(call COMPILE_FILE(init_versionTooltip)) diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index 111300e87c..a8c485cd38 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -418,7 +418,7 @@ Цвет фона всплывающих подсказок АСЕ. Kolor tła dla powiadomień ACE Notification ACE: couleur de l'arrière plan - Barva pozadí ACE nápověd. + Barva pozadí ACE nápovědy. Az ACE-súgók hátterének színe. A cor de fundo das hints do ACE. @@ -430,7 +430,7 @@ Цвет шрифта всплывающих подсказок Kolor tekstu powiadomień Notification: couleur du texte - Barva fontu nápověd. + Barva fontu nápovědy. Súgószöveg betűinek színe Cor do do texto da hint @@ -475,11 +475,12 @@ Sprawdzaj PBO Comprobar PBOs Überprüfe PBOs - Zkontrolovat PBO + Zkontrolovat soubory PBO Verificar PBOs Vérifier les PBOs PBO-k ellenőrzése Проверка аддонов + Controlla PBO Check addon integrity with server and do selected action if an addon is missing. @@ -490,6 +491,7 @@ 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 + Controlla l'integrità degli addon con il server ed esegui l'azione selezionata se un addon è mancante Action @@ -501,6 +503,7 @@ Action Cselekvés Действие + Azione What to do with people who do not have the right PBOs? @@ -512,6 +515,7 @@ Que faire avec les personnes n'ayant pas les bon PBOs Mi legyen azokkal a személyekkel, akiknek nincsenek meg a helyes PBO-k? Что делать с игроками с неправильными аддонами? + Cosa fare con giocatori che non hanno i PBO corretti? Warn once @@ -523,6 +527,7 @@ Avertir une fois Egyszeri figyelmeztetés Предупредить один раз + Avverti una volta Warn (permanent) @@ -534,6 +539,7 @@ Avertir (permanent) Figyelmeztetés (tartós) Предупреждать (постоянно) + Avverti (permanente) Kick @@ -545,6 +551,7 @@ Ejecter Kirúgás Кикнуть + Kick Check all addons @@ -556,6 +563,7 @@ Vérifier tous les addons Összes bővítmény ellenőrzése Проверять все аддоны + Controlla tutti gli addon Check all addons instead of only those of ACE? @@ -567,6 +575,7 @@ 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? + Controlla tutti gli addon invece dei soli addon ACE? Whitelist @@ -578,6 +587,7 @@ Liste blanche Fehérlista Вайтлист доп. аддонов + Lista Bianca What addons are allowed regardless? @@ -589,6 +599,7 @@ Quels addons sont tolérés Milyen bővítmények vannak feltétlenül engedélyezve? Какие аддоны дополнительно разрешены? + Quali addon sono permessi in ogni caso? LSD Vehicles @@ -600,6 +611,7 @@ LSD - Véhicules LSD járművek Транспорт под LSD + Veicoli LSD Adds LSD effect to synchronized vehicle @@ -611,6 +623,7 @@ Ajoute l'effet LSD aux véhicules synchronisés LSD-effekt hozzáadása a szinkronizált járművekhez Добавляет эффект LSD (мигание всеми цветами радуги) синхронизированным транспортным средствам + Aggiunge effetti LSD ai veicoli sincronizzati Toggle Handheld Device @@ -622,6 +635,7 @@ Allumer l'ordinateur de poche Kézi eszköz kapcsolása Включить портативное устройство + Apri dispositivo palmare Close Handheld Device @@ -633,6 +647,7 @@ Fermer l'ordinateur de poche Kézi eszköz bezárása Закрыть портативное устройство + Chiudi dispositivo palmare Cycle Handheld Devices @@ -644,6 +659,7 @@ Changer (cycle) d'ordinateur de poche Kézi eszköz váltása Следующее портативное устройство + Cicla tra dispositivi palmari Disabled @@ -658,7 +674,7 @@ Enabled - Zapnuto + Povoleno Oui Aktiviert Attivato @@ -699,6 +715,7 @@ Только в транспорте Pouze vozidla Solo vehículos + Solo veicoli Do Not Force @@ -708,14 +725,17 @@ Nevynucovat Não forçar Не обязывать + Non forzare ACE3 Equipment + ACE-Ausrüstung ACE3 Wyposażenie Equipamentos ACE3 ACE3 Снаряжение ACE3 Vybavení ACE3 Equipo + Equipaggiamento ACE3 ACE3 Common @@ -725,6 +745,7 @@ ACE3 Общие ACE3 Común ACE3 Obecné + Comune ACE3 ACE3 Weapons @@ -734,6 +755,7 @@ ACE3 Оружие ACE3 Zbraně ACE3 Armas + Armi ACE3 ACE3 Movement @@ -743,6 +765,7 @@ ACE3 Перемещение ACE3 Movimiento ACE3 Pohyb + Movimento ACE3 ACE3 Scope Adjustment @@ -752,6 +775,7 @@ ACE3 Прицелы ACE3 Nastavení optiky ACE3 Ajuste de miras + Regolazione Ottiche ACE3 ACE3 Vehicles @@ -761,6 +785,13 @@ ACE3 Транспорт ACE3 Vozidla ACE3 Vehículos + Veicoli ACE3 + + + No Room to unload + Kein Platz zum Entladen + Brak miejsca na rozładunek + Non c'è spazio per scaricare diff --git a/addons/common/tests/script_component.hpp b/addons/common/tests/script_component.hpp new file mode 100644 index 0000000000..6a1bf9154d --- /dev/null +++ b/addons/common/tests/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\common\script_component.hpp" diff --git a/addons/common/tests/test_eventHandlers.sqf b/addons/common/tests/test_eventHandlers.sqf new file mode 100644 index 0000000000..5a75cb0a06 --- /dev/null +++ b/addons/common/tests/test_eventHandlers.sqf @@ -0,0 +1,78 @@ +// ---------------------------------------------------------------------------- +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +#ifndef TEST_DEFINED_AND_OP +if (true) exitWith {}; +#endif + +// ---------------------------------------------------------------------------- + +LOG('Testing EventHandlers'); + +TEST_DEFINED(QFUNC(_handleNetEvent),""); +TEST_DEFINED(QFUNC(addEventHandler),""); +TEST_DEFINED(QFUNC(localEvent),""); +TEST_DEFINED(QFUNC(targetEvent),""); +TEST_DEFINED(QFUNC(globalEvent),""); +TEST_DEFINED(QFUNC(serverEvent),""); +TEST_DEFINED(QFUNC(removeAllEventHandlers),""); +TEST_DEFINED(QFUNC(removeEventHandler),""); + +private _result = ["A", {}] call ace_common_fnc_addEventHandler; +private _expected = 0; +TEST_DEFINED_AND_OP(_result,==,_expected,"Adding first A EH"); + +_result = ["A", {GVAR(test_A2) = _this}] call ace_common_fnc_addEventHandler; +_expected = 1; +TEST_DEFINED_AND_OP(_result,==,_expected,"Adding second A EH"); + +_result = ["A", {GVAR(test_A3) = _this}] call ace_common_fnc_addEventHandler; +_expected = 2; +TEST_DEFINED_AND_OP(_result,==,_expected,"Adding third A EH"); + +GVAR(test_A2) = -1; +["A", 11] call FUNC(localEvent); +_expected = 11; +_result = GVAR(test_A2); +TEST_DEFINED_AND_OP(_result,==,_expected,"Test Local Event"); + +//Remove 2nd EH +["A", 1] call FUNC(removeEventHandler); + +GVAR(test_A2) = -1; +GVAR(test_A3) = -1; +["A", 22] call FUNC(localEvent); +_expected = -1; +_result = GVAR(test_A2); +TEST_DEFINED_AND_OP(_result,==,_expected,"Test 2nd (removed) EH"); +_expected = 22; +_result = GVAR(test_A3); +TEST_DEFINED_AND_OP(_result,==,_expected,"Test 3rd Event"); + +//Remove All EH: +["A"] call FUNC(removeAllEventHandlers); + +GVAR(test_A3) = -1; +["A", 77] call FUNC(localEvent); +_expected = -1; +_result = GVAR(test_A3); +TEST_DEFINED_AND_OP(_result,==,_expected,"Test 3rd is removed after removeAll"); + +//Much harder to test network events +TRACE_2("testing network events",isServer,isDedicated); + +["B", {GVAR(test_B) = _this}] call ace_common_fnc_addEventHandler; + +GVAR(test_B) = -1; +["B", 33] call FUNC(globalEvent); +_expected = 33; +_result = GVAR(test_B); +TEST_DEFINED_AND_OP(_result,==,_expected,"Test globalEvent"); + +GVAR(test_B) = -1; +["B", 44] call FUNC(serverEvent); +_expected = if (isServer) then {44} else {-1}; +_result = GVAR(test_B); +TEST_DEFINED_AND_OP(_result,==,_expected,"Test serverEvent"); + diff --git a/addons/concertina_wire/CfgEventHandlers.hpp b/addons/concertina_wire/CfgEventHandlers.hpp index 026afb4e2d..80711b5390 100644 --- a/addons/concertina_wire/CfgEventHandlers.hpp +++ b/addons/concertina_wire/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/concertina_wire/CfgVehicles.hpp b/addons/concertina_wire/CfgVehicles.hpp index 81304da853..2a0b8cead2 100644 --- a/addons/concertina_wire/CfgVehicles.hpp +++ b/addons/concertina_wire/CfgVehicles.hpp @@ -1,7 +1,7 @@ class CfgVehicles { class Fence; - class thingX; + class ThingX; class NonStrategic; class ACE_ConcertinaWireNoGeo: Fence { @@ -94,7 +94,7 @@ class CfgVehicles { }; }; }; - class ACE_ConcertinaWireCoil: thingX { + class ACE_ConcertinaWireCoil: ThingX { XEH_ENABLED; scope = 2; displayName = $STR_ACE_CONCERTINA_WIRECOIL; diff --git a/addons/concertina_wire/XEH_PREP.hpp b/addons/concertina_wire/XEH_PREP.hpp new file mode 100644 index 0000000000..34a666a6b9 --- /dev/null +++ b/addons/concertina_wire/XEH_PREP.hpp @@ -0,0 +1,7 @@ + +PREP(deploy); +PREP(dismount); +PREP(dismountSuccess); +PREP(handleDamage); +PREP(handleKilled); +PREP(vehicleDamage); diff --git a/addons/concertina_wire/XEH_preInit.sqf b/addons/concertina_wire/XEH_preInit.sqf index 582d642484..a7feade1c3 100644 --- a/addons/concertina_wire/XEH_preInit.sqf +++ b/addons/concertina_wire/XEH_preInit.sqf @@ -2,11 +2,6 @@ ADDON = false; -PREP(deploy); -PREP(dismount); -PREP(dismountSuccess); -PREP(handleDamage); -PREP(handleKilled); -PREP(vehicleDamage); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/concertina_wire/XEH_preStart.sqf b/addons/concertina_wire/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/concertina_wire/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/concertina_wire/script_component.hpp b/addons/concertina_wire/script_component.hpp index 3512643b81..cdde4d05be 100644 --- a/addons/concertina_wire/script_component.hpp +++ b/addons/concertina_wire/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_CONCERTINA_WIRE #define DEBUG_MODE_FULL diff --git a/addons/concertina_wire/stringtable.xml b/addons/concertina_wire/stringtable.xml index 26216b7c0e..bffbc2fb63 100644 --- a/addons/concertina_wire/stringtable.xml +++ b/addons/concertina_wire/stringtable.xml @@ -9,7 +9,7 @@ Alambre de espino Fill barbelé Ostnatý drát - Concertina wire + Filo spinato di concertina Concertina wire Arame farpado @@ -20,8 +20,8 @@ Zwój koncentriny Bobina de alambre de espino Bobine de fil barbelé - Smyčka ostnatého drátu - Concertina wire coil + Svitek ostnatého drátu + Bobina di concertina Concertina wire coil Bobina de arame farpado @@ -33,7 +33,7 @@ Desmontar alambre de espino Descendre le fil barbelé Svinout ostnatý drát - Dismount Concertina wire + Smonta la concertina Dismount Concertina wire Desmontar arame farpado @@ -45,7 +45,7 @@ Desplegar alambre de espino Mettre en place le fil barbelé Rozvinout ostnatý drát - Deploy Concertina wire + Posa il filo di concertina Deploy Concertina wire Colocar arame farpado diff --git a/addons/dagr/CfgEventHandlers.hpp b/addons/dagr/CfgEventHandlers.hpp index 2a05b72298..ccbe4f4abb 100644 --- a/addons/dagr/CfgEventHandlers.hpp +++ b/addons/dagr/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/dagr/XEH_PREP.hpp b/addons/dagr/XEH_PREP.hpp new file mode 100644 index 0000000000..746a36de38 --- /dev/null +++ b/addons/dagr/XEH_PREP.hpp @@ -0,0 +1,7 @@ + +PREP(handleRangeFinderData); +PREP(menuInit); +PREP(outputData); +PREP(outputVector); +PREP(outputWP); +PREP(toggleOverlay); diff --git a/addons/dagr/XEH_preInit.sqf b/addons/dagr/XEH_preInit.sqf index 7c61d71775..a7feade1c3 100644 --- a/addons/dagr/XEH_preInit.sqf +++ b/addons/dagr/XEH_preInit.sqf @@ -2,11 +2,6 @@ ADDON = false; -PREP(handleRangeFinderData); -PREP(menuInit); -PREP(outputData); -PREP(outputVector); -PREP(outputWP); -PREP(toggleOverlay); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/dagr/XEH_preStart.sqf b/addons/dagr/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/dagr/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/dagr/script_component.hpp b/addons/dagr/script_component.hpp index f7a723e533..792ef7f119 100644 --- a/addons/dagr/script_component.hpp +++ b/addons/dagr/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT dagr #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_DAGR #define DEBUG_MODE_FULL #endif diff --git a/addons/dagr/stringtable.xml b/addons/dagr/stringtable.xml index 61d226377d..50b088ad85 100644 --- a/addons/dagr/stringtable.xml +++ b/addons/dagr/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -9,6 +9,7 @@ DAGR DAGR DAGR + DAGR Configure DAGR @@ -18,6 +19,7 @@ Настроить DAGR Configurar DAGR Konfigurovat DAGR + Configura DAGR Toggle DAGR @@ -27,6 +29,7 @@ Вкл./выкл. DAGR Mostrar DAGR Přepnout DAGR + Apri DAGR Defense Advanced GPS Receiver @@ -36,6 +39,7 @@ Военный многофункциональный GPS-приёмник Defense Advanced GPS Receiver Defense Advanced GPS Receiver + Defense Advanced GPS Receiver diff --git a/addons/difficulties/script_component.hpp b/addons/difficulties/script_component.hpp index bac2935aa7..b6f387b02f 100644 --- a/addons/difficulties/script_component.hpp +++ b/addons/difficulties/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT difficulties #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_DIFFICULTIES #define DEBUG_MODE_FULL #endif diff --git a/addons/disarming/CfgEventHandlers.hpp b/addons/disarming/CfgEventHandlers.hpp index e75956f440..becf395052 100644 --- a/addons/disarming/CfgEventHandlers.hpp +++ b/addons/disarming/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/disarming/XEH_PREP.hpp b/addons/disarming/XEH_PREP.hpp new file mode 100644 index 0000000000..1a0e85f447 --- /dev/null +++ b/addons/disarming/XEH_PREP.hpp @@ -0,0 +1,12 @@ + +PREP(canBeDisarmed); +PREP(canPlayerDisarmUnit); +PREP(disarmDropItems); +PREP(eventCallerFinish); +PREP(eventTargetFinish); +PREP(eventTargetStart); +PREP(getAllGearContainer); +PREP(getAllGearUnit); +PREP(openDisarmDialog); +PREP(showItemsInListbox); +PREP(verifyMagazinesMoved); diff --git a/addons/disarming/XEH_preInit.sqf b/addons/disarming/XEH_preInit.sqf index 84534e41b4..a7feade1c3 100644 --- a/addons/disarming/XEH_preInit.sqf +++ b/addons/disarming/XEH_preInit.sqf @@ -2,16 +2,6 @@ ADDON = false; -PREP(canBeDisarmed); -PREP(canPlayerDisarmUnit); -PREP(disarmDropItems); -PREP(eventCallerFinish); -PREP(eventTargetFinish); -PREP(eventTargetStart); -PREP(getAllGearContainer); -PREP(getAllGearUnit); -PREP(openDisarmDialog); -PREP(showItemsInListbox); -PREP(verifyMagazinesMoved); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/disarming/XEH_preStart.sqf b/addons/disarming/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/disarming/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/disarming/script_component.hpp b/addons/disarming/script_component.hpp index 9a1ef9156b..af0ede134c 100644 --- a/addons/disarming/script_component.hpp +++ b/addons/disarming/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT disarming #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_DISARMING #define DEBUG_MODE_FULL #endif diff --git a/addons/disposable/CfgEventHandlers.hpp b/addons/disposable/CfgEventHandlers.hpp index 98fec255c2..a7c50f3247 100644 --- a/addons/disposable/CfgEventHandlers.hpp +++ b/addons/disposable/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -10,11 +17,9 @@ class Extended_PostInit_EventHandlers { }; }; -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - firedBIS = QUOTE(_this call FUNC(replaceATWeapon)); - }; +class Extended_DisplayLoad_EventHandlers { + class RscDisplayInventory { + ADDON = QUOTE([ARR_2(ACE_player, _this select 0)] call FUNC(updateInventoryDisplay)); }; }; diff --git a/addons/disposable/XEH_PREP.hpp b/addons/disposable/XEH_PREP.hpp new file mode 100644 index 0000000000..8319e582aa --- /dev/null +++ b/addons/disposable/XEH_PREP.hpp @@ -0,0 +1,4 @@ + +PREP(replaceATWeapon); +PREP(takeLoadedATWeapon); +PREP(updateInventoryDisplay); diff --git a/addons/disposable/XEH_postInit.sqf b/addons/disposable/XEH_postInit.sqf index 800d749d06..94ad62b1cc 100644 --- a/addons/disposable/XEH_postInit.sqf +++ b/addons/disposable/XEH_postInit.sqf @@ -3,12 +3,13 @@ if (!hasInterface) exitWith {}; -["inventoryDisplayLoaded", { - [ACE_player, _this select 0] call FUNC(updateInventoryDisplay) -}] call EFUNC(common,addEventHandler); - ["playerInventoryChanged", { params ["_unit"]; [_unit] call FUNC(takeLoadedATWeapon); [_unit] call FUNC(updateInventoryDisplay); }] call EFUNC(common,addEventHandler); + +// Register fire event handler +// Only for the local player and for AI. Non-local players will handle it themselves +["firedPlayer", DFUNC(replaceATWeapon)] call EFUNC(common,addEventHandler); +["firedNonPlayer", DFUNC(replaceATWeapon)] call EFUNC(common,addEventHandler); diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 020187b730..a7feade1c3 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -2,8 +2,6 @@ ADDON = false; -PREP(replaceATWeapon); -PREP(takeLoadedATWeapon); -PREP(updateInventoryDisplay); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/disposable/XEH_preStart.sqf b/addons/disposable/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/disposable/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/disposable/functions/fnc_replaceATWeapon.sqf b/addons/disposable/functions/fnc_replaceATWeapon.sqf index f0cee0a048..58c58a6056 100644 --- a/addons/disposable/functions/fnc_replaceATWeapon.sqf +++ b/addons/disposable/functions/fnc_replaceATWeapon.sqf @@ -1,15 +1,9 @@ /* * Author: bux, commy2 - * Replace the disposable launcher with the used dummy. + * Replace the disposable launcher with the used dummy. Called from the unified fired EH. * * Arguments: - * 0: unit - Object the event handler is assigned to - * 1: weapon - Fired weapon - * 2: muzzle - Muzzle that was used - * 3: mode - Current mode of the fired weapon - * 4: ammo - Ammo used - * 5: magazine - magazine name which was used - * 6: projectile - Object of the projectile that was shot + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Nothing @@ -21,18 +15,16 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon", "", "", "", "", "_projectile"]; -TRACE_3("params",_unit,_weapon,_projectile); +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -if ((!local _unit) || {_weapon != (secondaryWeapon _unit)}) exitWith {}; +if (!local _unit || {_weapon != secondaryWeapon _unit}) exitWith {}; -private ["_replacementTube", "_items"]; -_replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube"); +private _replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube"); if (_replacementTube == "") exitWith {}; //If no replacement defined just exit - //Save array of items attached to launcher -_items = secondaryWeaponItems _unit; +private _items = secondaryWeaponItems _unit; //Replace the orginal weapon with the 'usedTube' weapon _unit addWeapon _replacementTube; //Makes sure the used tube is still equiped @@ -55,12 +47,10 @@ if !([_unit] call EFUNC(common,isPlayer)) then { [_idPFH] call CBA_fnc_removePerFrameHandler; //If (tube is dropped) OR (is dead) OR (is player) just exit - if (((secondaryWeapon _unit) != _tube) || {!alive _unit} || {([_unit] call EFUNC(common,isPlayer))}) exitWith {}; + if (secondaryWeapon _unit != _tube || {!alive _unit} || {[_unit] call EFUNC(common,isPlayer)}) exitWith {}; - private ["_items", "_container"]; - - // _items = secondaryWeaponItems _unit; - _container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"]; + //private _items = secondaryWeaponItems _unit; + private _container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"]; _container setPosAsl (getPosAsl _unit); _container addWeaponCargoGlobal [_tube, 1]; diff --git a/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf b/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf index c371c8d5a5..bd6dec057c 100644 --- a/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf +++ b/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf @@ -20,17 +20,12 @@ TRACE_1("params",_unit); if (!local _unit) exitWith {}; -private ["_launcher", "_config"]; - -_launcher = secondaryWeapon _unit; -_config = configFile >> "CfgWeapons" >> _launcher; +private _launcher = secondaryWeapon _unit; +private _config = configFile >> "CfgWeapons" >> _launcher; if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then { - private ["_magazine", "_isLauncherSelected", "_didAdd"]; - - _magazine = getArray (_config >> "magazines") select 0; - - _isLauncherSelected = currentWeapon _unit == _launcher; + private _magazine = getArray (_config >> "magazines") select 0; + private _isLauncherSelected = currentWeapon _unit == _launcher; _unit removeMagazines _magazine; @@ -38,8 +33,9 @@ if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber _unit addBackpack "ACE_FakeBackpack"; _unit removeWeapon _launcher; _unit addMagazine _magazine; - _didAdd = _magazine in (magazines _unit); + private _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; @@ -48,8 +44,9 @@ if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber } else { _unit removeWeapon _launcher; _unit addMagazine _magazine; - _didAdd = _magazine in (magazines _unit); + private _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; diff --git a/addons/disposable/functions/fnc_updateInventoryDisplay.sqf b/addons/disposable/functions/fnc_updateInventoryDisplay.sqf index 7f50e45089..9908c86186 100644 --- a/addons/disposable/functions/fnc_updateInventoryDisplay.sqf +++ b/addons/disposable/functions/fnc_updateInventoryDisplay.sqf @@ -24,13 +24,11 @@ _player removeMagazines "ACE_FiredMissileDummy"; if (isNull _display) exitWith {}; -private ["_launcher", "_control", "_config"]; - -_launcher = secondaryWeapon _player; +private _launcher = secondaryWeapon _player; if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "ACE_UsedTube") == ""}) then { - _control = _display displayCtrl 627; - _config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine"; + private _control = _display displayCtrl 627; + private _config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine"; _control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")]; _control ctrlCommit 0; @@ -39,7 +37,7 @@ if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "ACE _control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")]; _control ctrlCommit 0; } else { - _control = _display displayCtrl 627; + private _control = _display displayCtrl 627; _control ctrlSetPosition [0, 0, 0, 0]; _control ctrlCommit 0; diff --git a/addons/disposable/script_component.hpp b/addons/disposable/script_component.hpp index 12a05ea60d..cd15715601 100644 --- a/addons/disposable/script_component.hpp +++ b/addons/disposable/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_ATTACH #define DEBUG_MODE_FULL diff --git a/addons/disposable/stringtable.xml b/addons/disposable/stringtable.xml index 2c6f0b0afd..acdc79473c 100644 --- a/addons/disposable/stringtable.xml +++ b/addons/disposable/stringtable.xml @@ -29,7 +29,7 @@ Preloaded Missile Dummy Vorgeladene Racketennachbildung Missile préchargé - Přednabitá dummy střela + Přednabitá maketa rakety Wstępnie załadowana atrapa pocisku Precargado misil inerte Előtöltött műrakéta @@ -38,4 +38,4 @@ Míssel inerte pré-carregado - + \ No newline at end of file diff --git a/addons/dragging/CfgEventHandlers.hpp b/addons/dragging/CfgEventHandlers.hpp index 6a64491e00..313406a3f1 100644 --- a/addons/dragging/CfgEventHandlers.hpp +++ b/addons/dragging/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -27,6 +33,11 @@ class Extended_Init_EventHandlers { init = QUOTE(_this call DFUNC(initObject)); }; }; + class Land_PortableLight_single_F { + 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 b7128341bb..be5021fd43 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -32,7 +32,6 @@ class CfgVehicles { // ammo boxes class ThingX; class ReammoBox_F: ThingX { - XEH_ENABLED; GVAR(canCarry) = 0; GVAR(carryPosition[]) = {0,1,1}; GVAR(carryDirection) = 0; @@ -85,7 +84,7 @@ class CfgVehicles { }; // Barrier - class RoadCone_F: thingX { + class RoadCone_F: ThingX { XEH_ENABLED; GVAR(canCarry) = 1; GVAR(carryPosition[]) = {0,1,1}; @@ -113,4 +112,15 @@ class CfgVehicles { GVAR(carryPosition[]) = {0,1,1}; GVAR(carryDirection) = 0; }; + + class Lamps_base_F; + class Land_PortableLight_single_F: Lamps_base_F { + GVAR(canCarry) = 1; + GVAR(carryPosition[]) = {0,1.2,0}; + GVAR(carryDirection) = 180; + + GVAR(canDrag) = 1; + GVAR(dragPosition[]) = {0,1.2,0}; + GVAR(dragDirection) = 180; + }; }; diff --git a/addons/dragging/XEH_PREP.hpp b/addons/dragging/XEH_PREP.hpp new file mode 100644 index 0000000000..b04c15e7ec --- /dev/null +++ b/addons/dragging/XEH_PREP.hpp @@ -0,0 +1,27 @@ + +PREP(canCarry); +PREP(canDrag); +PREP(canDrop); +PREP(canDrop_carry); +PREP(carryObject); +PREP(carryObjectPFH); +PREP(dragObject); +PREP(dragObjectPFH); +PREP(dropObject); +PREP(dropObject_carry); +PREP(getWeight); +PREP(handleAnimChanged); +PREP(handleKilled); +PREP(handlePlayerChanged); +PREP(handlePlayerWeaponChanged); +PREP(handleScrollWheel); +PREP(handleUnconscious); +PREP(initObject); +PREP(initPerson); +PREP(isObjectOnObject); +PREP(setCarryable); +PREP(setDraggable); +PREP(startCarry); +PREP(startCarryPFH); +PREP(startDrag); +PREP(startDragPFH); diff --git a/addons/dragging/XEH_preInit.sqf b/addons/dragging/XEH_preInit.sqf index f596a89493..a7feade1c3 100644 --- a/addons/dragging/XEH_preInit.sqf +++ b/addons/dragging/XEH_preInit.sqf @@ -2,31 +2,6 @@ ADDON = false; -PREP(canCarry); -PREP(canDrag); -PREP(canDrop); -PREP(canDrop_carry); -PREP(carryObject); -PREP(carryObjectPFH); -PREP(dragObject); -PREP(dragObjectPFH); -PREP(dropObject); -PREP(dropObject_carry); -PREP(getWeight); -PREP(handleAnimChanged); -PREP(handleKilled); -PREP(handlePlayerChanged); -PREP(handlePlayerWeaponChanged); -PREP(handleScrollWheel); -PREP(handleUnconscious); -PREP(initObject); -PREP(initPerson); -PREP(isObjectOnObject); -PREP(setCarryable); -PREP(setDraggable); -PREP(startCarry); -PREP(startCarryPFH); -PREP(startDrag); -PREP(startDragPFH); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/dragging/XEH_preStart.sqf b/addons/dragging/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/dragging/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index 1f5e9f68aa..381940a9df 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if unit can carry the object. Doesn't check weight. * * Arguments: @@ -10,6 +9,9 @@ * Return Value: * Can the unit carry the object? * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_canCarry; + * * Public: No */ #include "script_component.hpp" @@ -18,6 +20,10 @@ params ["_unit", "_target"]; if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; +//#2644 - Units with injured legs cannot bear the extra weight of carrying an object +//The fireman carry animation does not slow down for injured legs, so you could carry and run +if ((_unit getHitPointDamage "HitLegs") >= 0.5) 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}; diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index d96c0dd5da..b45a7d1d14 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if unit can drag the object. Doesn't check weight. * * Arguments: @@ -10,14 +9,14 @@ * Return Value: * Can the unit drag the object? * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_canDrag; + * * 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}; diff --git a/addons/dragging/functions/fnc_canDrop.sqf b/addons/dragging/functions/fnc_canDrop.sqf index 58c02cab07..b9a6170bf2 100644 --- a/addons/dragging/functions/fnc_canDrop.sqf +++ b/addons/dragging/functions/fnc_canDrop.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if unit can drop the object. * * Arguments: @@ -10,6 +9,9 @@ * Return Value: * Can the unit drop the object? * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_canDrop; + * * Public: No */ #include "script_component.hpp" diff --git a/addons/dragging/functions/fnc_canDrop_carry.sqf b/addons/dragging/functions/fnc_canDrop_carry.sqf index 430b12c642..3d3732f62d 100644 --- a/addons/dragging/functions/fnc_canDrop_carry.sqf +++ b/addons/dragging/functions/fnc_canDrop_carry.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if unit can drop the carried object. * * Arguments: @@ -10,6 +9,9 @@ * Return Value: * Can the unit drop the object? * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_canDrop_carry; + * * Public: No */ #include "script_component.hpp" diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index 8bea72b907..ec00693825 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Carry an object. * * Arguments: @@ -10,17 +9,20 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_carryObject; + * * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // get attachTo offset and direction. -private ["_position", "_direction", "_UAVCrew"]; -_position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]]; -_direction = _target getVariable [QGVAR(carryDirection), 0]; +private _position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]]; +private _direction = _target getVariable [QGVAR(carryDirection), 0]; // handle objects vs persons if (_target isKindOf "CAManBase") then { @@ -34,8 +36,7 @@ if (_target isKindOf "CAManBase") then { } else { // add height offset of model - private "_offset"; - _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); + private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); _position = _position vectorAdd [0, 0, _offset]; @@ -56,16 +57,20 @@ _unit setVariable [QGVAR(ReleaseActionID), [ ] call EFUNC(common,addActionEventHandler)]; // show mouse hint -[localize LSTRING(Drop), "", localize LSTRING(LowerRaise)] call EFUNC(interaction,showMouseHint); +if (_target isKindOf "CAManBase") then { + [localize LSTRING(Drop), "", ""] call EFUNC(interaction,showMouseHint); +} else { + [localize LSTRING(Drop), "", localize LSTRING(LowerRaise)] call EFUNC(interaction,showMouseHint); +}; // check everything -[FUNC(carryObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; +[FUNC(carryObjectPFH), 0.5, [_unit, _target, ACE_time]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; // prevent UAVs from firing -_UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); +private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); if !(_UAVCrew isEqualTo []) then { {_target deleteVehicleCrew _x} count _UAVCrew; diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index b50383707a..948af15891 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -1,14 +1,20 @@ /* * Author: commy2 - * * PFH for Carry Object * * Arguments: - * ? + * 0: ARGS + * 0: Unit + * 1: Target + * 2: Start time + * 1: PFEH Id * * Return Value: * None * + * Example: + * [[player, target], 20] call ace_dragging_fnc_carryObjectPFH; + * * Public: No */ #include "script_component.hpp" @@ -18,14 +24,21 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit","_target"]; +_args params ["_unit","_target", "_startTime"]; if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { + TRACE_2("carry false",_unit,_target); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { + TRACE_2("dead/distance",_unit,_target); + if ((_unit distance _target > 10) && {(ACE_time - _startTime) < 1}) exitWith { + //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) + TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,ACE_time); + }; [_unit, _target] call FUNC(dropObject_carry); [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index 17fbc60c06..3237ddbb07 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Drag an object. Called from ace_dragging_fnc_startDrag * * Arguments: @@ -10,24 +9,29 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_dragObject; + * * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; - -private ["_position", "_direction", "_offset", "_UAVCrew"]; +TRACE_2("params",_unit,_target); // get attachTo offset and direction. -_position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]]; -_direction = _target getVariable [QGVAR(dragDirection), 0]; +private _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]]; +private _direction = _target getVariable [QGVAR(dragDirection), 0]; // add height offset of model -_offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); - +private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); +if (_target isKindOf "CAManBase") then { + _offset = 0; +}; _position = _position vectorAdd [0, 0, _offset]; // attach object +TRACE_3("attaching",_position,_offset,_direction); _target attachTo [_unit, _position]; ["setDir", _target, [_target, _direction]] call EFUNC(common,targetEvent); @@ -49,13 +53,13 @@ _unit setVariable [QGVAR(ReleaseActionID), [ [localize LSTRING(Drop), ""] call EFUNC(interaction,showMouseHint); // check everything -[FUNC(dragObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; +[FUNC(dragObjectPFH), 0.5, [_unit, _target, ACE_time]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; // prevent UAVs from firing -_UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); +private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); if !(_UAVCrew isEqualTo []) then { {_target deleteVehicleCrew _x} count _UAVCrew; diff --git a/addons/dragging/functions/fnc_dragObjectPFH.sqf b/addons/dragging/functions/fnc_dragObjectPFH.sqf index f6ff252886..ab117e90fd 100644 --- a/addons/dragging/functions/fnc_dragObjectPFH.sqf +++ b/addons/dragging/functions/fnc_dragObjectPFH.sqf @@ -1,14 +1,20 @@ /* * Author: commy2 - * * PFH for Drag Object * * Arguments: - * ? + * 0: ARGS + * 0: Unit + * 1: Target + * 2: Start time + * 1: PFEH Id * * Return Value: * None * + * Example: + * [[player, target], 20] call ace_dragging_fnc_dragObjectPFH; + * * Public: No */ #include "script_component.hpp" @@ -18,14 +24,21 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit", "_target"]; +_args params ["_unit","_target", "_startTime"]; if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { + TRACE_2("drag false",_unit,_target); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { + TRACE_2("dead/distance",_unit,_target); + if ((_unit distance _target > 10) && {(ACE_time - _startTime) < 1}) exitWith { + //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) + TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,ACE_time); + }; [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 5e5687db8a..604f6c25b7 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Drop a dragged object. * * Arguments: @@ -10,17 +9,20 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_dropObject; + * * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // remove drop action [_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); -private "_inBuilding"; -_inBuilding = [_unit] call FUNC(isObjectOnObject); +private _inBuilding = [_unit] call FUNC(isObjectOnObject); if !(_unit getVariable ["ACE_isUnconscious", false]) then { // play release animation @@ -47,6 +49,7 @@ _unit removeWeapon "ACE_FakePrimaryWeapon"; // prevent object from flipping inside buildings if (_inBuilding) then { _target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]); + TRACE_2("setPos",getPosASL _unit,getPosASL _target); }; // hide mouse hint diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index c9c34c82a0..2002142e2e 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Drop a carried object. * * Arguments: @@ -10,17 +9,20 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_dropObject_carry; + * * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // remove drop action [_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); -private "_inBuilding"; -_inBuilding = [_unit] call FUNC(isObjectOnObject); +private _inBuilding = [_unit] call FUNC(isObjectOnObject); // prevent collision damage ["fixCollision", _unit] call EFUNC(common,localEvent); @@ -48,7 +50,7 @@ _unit removeWeapon "ACE_FakePrimaryWeapon"; // reselect weapon and re-enable sprint _unit selectWeapon primaryWeapon _unit; -[_unit, "isDragging", false] call EFUNC(common,setforceWalkStatus); +[_unit, "forceWalk", "ACE_dragging", false] call EFUNC(common,statusEffect_set); // prevent object from flipping inside buildings if (_inBuilding) then { diff --git a/addons/dragging/functions/fnc_getWeight.sqf b/addons/dragging/functions/fnc_getWeight.sqf index 0fbee19d41..ac2db86ad0 100644 --- a/addons/dragging/functions/fnc_getWeight.sqf +++ b/addons/dragging/functions/fnc_getWeight.sqf @@ -1,6 +1,5 @@ /* * Author: L-H, edited by commy2, rewritten by joko // Jonas - * * Returns the weight of a crate. * * Arguments: @@ -10,20 +9,20 @@ * Total Weight * * Example: - * _weight = Crate1 call ace_dragging_fnc_getweight; + * [Crate1] call ace_dragging_fnc_getweight; * * Public: No */ #include "script_component.hpp" -private "_totalWeight"; params ["_object"]; + // Initialize the total weight. -_totalWeight = 0; +private _totalWeight = 0; // Cycle through all item types with their assigned config paths. { - _x params["_items","_getConfigCode"]; + _x params ["_items", "_getConfigCode"]; _items params ["_item", "_count"]; // Cycle through all items and read their mass out of the config. { diff --git a/addons/dragging/functions/fnc_handleAnimChanged.sqf b/addons/dragging/functions/fnc_handleAnimChanged.sqf index 0694687ca4..e186370e55 100644 --- a/addons/dragging/functions/fnc_handleAnimChanged.sqf +++ b/addons/dragging/functions/fnc_handleAnimChanged.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle the animaion for a Unit for Dragging Module * * Arguments: @@ -17,35 +16,28 @@ */ #include "script_component.hpp" -private ["_unit", "_anim"]; - -_unit = _this select 0; -_anim = _this select 1; +params ["_unit", "_anim"]; if (_unit getVariable [QGVAR(isDragging), false]) then { // drop dragged object when not in valid animation if !(_anim in DRAG_ANIMATIONS) then { - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; if (!isNull _draggedObject) then { [_unit, _draggedObject] call FUNC(dropObject); }; }; - }; if (_unit getVariable [QGVAR(isCarrying), false]) then { // drop carried object when not standing; also some exceptions when picking up crate if (stance _unit != "STAND" && {_anim != "amovpercmstpsnonwnondnon"}) then { - private "_carriedObject"; - _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; + private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; if (!isNull _carriedObject) then { [_unit, _carriedObject] call FUNC(dropObject_carry); }; }; - }; diff --git a/addons/dragging/functions/fnc_handleKilled.sqf b/addons/dragging/functions/fnc_handleKilled.sqf index 2d0923d624..36bda60b78 100644 --- a/addons/dragging/functions/fnc_handleKilled.sqf +++ b/addons/dragging/functions/fnc_handleKilled.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle death of the dragger * * Arguments: @@ -17,17 +16,16 @@ #include "script_component.hpp" params ["_unit"]; +TRACE_1("params",_unit); if (_unit getVariable [QGVAR(isDragging), false]) then { - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; [_unit, _draggedObject] call FUNC(dropObject); }; if (_unit getVariable [QGVAR(isCarrying), false]) then { - private "_carriedObject"; - _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; + private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; [_unit, _carriedObject] call FUNC(dropObject_carry); }; diff --git a/addons/dragging/functions/fnc_handlePlayerChanged.sqf b/addons/dragging/functions/fnc_handlePlayerChanged.sqf index 41c9091c72..a0d9e63449 100644 --- a/addons/dragging/functions/fnc_handlePlayerChanged.sqf +++ b/addons/dragging/functions/fnc_handlePlayerChanged.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle player changes. * * Arguments: @@ -11,13 +10,14 @@ * None * * Example: - * [_unitNew, _unitOld] call ace_dragging_fnc_handlePlayerChanged; + * [_newPlayer, _oldPlayer] call ace_dragging_fnc_handlePlayerChanged; * * Public: No */ #include "script_component.hpp" params ["_newPlayer", "_oldPlayer"]; +TRACE_2("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 e0f1b2a8e4..a8df6b5b7d 100644 --- a/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf +++ b/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle the Weapon Changed Event * * Arguments: @@ -11,20 +10,20 @@ * None * * Example: - * [_unit, _currentWeapon] call ace_dragging_fnc_handlePlayerWeaponChanged; + * [_unit, "gun"] call ace_dragging_fnc_handlePlayerWeaponChanged; * * Public: No */ #include "script_component.hpp" params ["_unit", "_weapon"]; +TRACE_2("params",_unit,_weapon); if (_unit getVariable [QGVAR(isDragging), false]) then { // drop dragged object when selecting a non-primary weapon if (_weapon != primaryWeapon _unit) then { - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; [_unit, _draggedObject] call FUNC(dropObject); }; @@ -33,8 +32,7 @@ if (_unit getVariable [QGVAR(isDragging), false]) then { if (_unit getVariable [QGVAR(isCarrying), false]) then { - private "_carriedObject"; - _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; + private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; if (_carriedObject isKindOf "CAManBase") then { diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index 73c42c2810..e3547ca63a 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -1,6 +1,5 @@ /* * Author: L-H, commy2 - * * Handles raising and lowering the dragged weapon to be able to place it on top of objects. * * Arguments: @@ -9,15 +8,16 @@ * Return Value: * Handled or not. * + * Example: + * [0.1] call ace_dragging_fnc_handleScrollWheel; + * * Public: No */ #include "script_component.hpp" params ["_scrollAmount"]; -private ["_unit", "_carriedItem", "_position", "_maxHeight"]; - -_unit = ACE_player; +private _unit = ACE_player; // EH is always assigned. Exit and don't overwrite input if not carrying if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false}; @@ -25,13 +25,13 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false}; // move carried item 15 cm per scroll interval _scrollAmount = _scrollAmount * 0.15; -_carriedItem = _unit getVariable [QGVAR(carriedObject), objNull]; +private _carriedItem = _unit getVariable [QGVAR(carriedObject), objNull]; //disabled for persons if (_carriedItem isKindOf "CAManBase") exitWith {false}; -_position = getPosATL _carriedItem; -_maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2; +private _position = getPosATL _carriedItem; +private _maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2; _position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight]; diff --git a/addons/dragging/functions/fnc_handleUnconscious.sqf b/addons/dragging/functions/fnc_handleUnconscious.sqf index b87e36b92d..2e891b01c6 100644 --- a/addons/dragging/functions/fnc_handleUnconscious.sqf +++ b/addons/dragging/functions/fnc_handleUnconscious.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle the Unconscious of a Unit while Dragging * * Arguments: @@ -16,15 +15,13 @@ */ #include "script_component.hpp" -private ["_player", "_draggedObject", "_carriedObject"]; - params ["_unit"]; -_player = ACE_player; +private _player = ACE_player; if (_player getVariable [QGVAR(isDragging), false]) then { - _draggedObject = _player getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _player getVariable [QGVAR(draggedObject), objNull]; // handle falling unconscious if (_unit == _player) then { @@ -40,7 +37,7 @@ if (_player getVariable [QGVAR(isDragging), false]) then { if (_player getVariable [QGVAR(isCarrying), false]) then { - _carriedObject = _player getVariable [QGVAR(carriedObject), objNull]; + private _carriedObject = _player getVariable [QGVAR(carriedObject), objNull]; // handle falling unconscious if (_unit == _player) then { diff --git a/addons/dragging/functions/fnc_initObject.sqf b/addons/dragging/functions/fnc_initObject.sqf index 0dd36568bc..b9f623395e 100644 --- a/addons/dragging/functions/fnc_initObject.sqf +++ b/addons/dragging/functions/fnc_initObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Initialize variables for drag or carryable objects. Called from init EH. * * Argument: @@ -9,26 +8,27 @@ * Return Value: * None * + * Example: + * [box] call ace_dragging_fnc_initObject; + * * Public: No */ #include "script_component.hpp" -private ["_position", "_direction", "_config"]; - params ["_object"]; -_config = configFile >> "CfgVehicles" >> typeOf _object; +private _config = configFile >> "CfgVehicles" >> typeOf _object; if (getNumber (_config >> QGVAR(canDrag)) == 1) then { - _position = getArray (_config >> QGVAR(dragPosition)); - _direction = getNumber (_config >> QGVAR(dragDirection)); + private _position = getArray (_config >> QGVAR(dragPosition)); + private _direction = getNumber (_config >> QGVAR(dragDirection)); [_object, true, _position, _direction] call FUNC(setDraggable); }; if (getNumber (_config >> QGVAR(canCarry)) == 1) then { - _position = getArray (_config >> QGVAR(carryPosition)); - _direction = getNumber (_config >> QGVAR(carryDirection)); + private _position = getArray (_config >> QGVAR(carryPosition)); + private _direction = getNumber (_config >> QGVAR(carryDirection)); [_object, true, _position, _direction] call FUNC(setCarryable); }; diff --git a/addons/dragging/functions/fnc_initPerson.sqf b/addons/dragging/functions/fnc_initPerson.sqf index c0a951771c..9e4aefeead 100644 --- a/addons/dragging/functions/fnc_initPerson.sqf +++ b/addons/dragging/functions/fnc_initPerson.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Initialize variables for drag or carryable persons. Called from init EH. * * Argument: @@ -9,6 +8,9 @@ * Return value: * None * + * Example: + * [player] call ace_dragging_fnc_initPerson; + * * Public: No */ #include "script_component.hpp" diff --git a/addons/dragging/functions/fnc_isObjectOnObject.sqf b/addons/dragging/functions/fnc_isObjectOnObject.sqf index e8ab5f307a..c113688322 100644 --- a/addons/dragging/functions/fnc_isObjectOnObject.sqf +++ b/addons/dragging/functions/fnc_isObjectOnObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if Object is Overlapping * * Argument: @@ -9,6 +8,9 @@ * Return value: * * + * Example; + * [player] call ace_dragging_fnc_isObjectOnObject + * * Public: No */ params ["_object"]; diff --git a/addons/dragging/functions/fnc_setCarryable.sqf b/addons/dragging/functions/fnc_setCarryable.sqf index 6bf05e5fde..9e15e42446 100644 --- a/addons/dragging/functions/fnc_setCarryable.sqf +++ b/addons/dragging/functions/fnc_setCarryable.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Enable the object to be carried. * * Argument: @@ -12,12 +11,13 @@ * Return Value: * None * + * Example: + * [object, true, [0,1,1], 0] call ace_dragging_fnc_setCarryable; + * * Public: Yes */ #include "script_component.hpp" -private ["_carryAction", "_dropAction", "_type", "_initializedClasses"]; - params ["_object", "_enableCarry", "_position", "_direction"]; if (isNil "_position") then { @@ -34,8 +34,8 @@ _object setVariable [QGVAR(carryPosition), _position]; _object setVariable [QGVAR(carryDirection), _direction]; // add action to class if it is not already present -_type = typeOf _object; -_initializedClasses = GETGVAR(initializedClasses_carry,[]); +private _type = typeOf _object; +private _initializedClasses = GETGVAR(initializedClasses_carry,[]); // do nothing if the class is already initialized if (_type in _initializedClasses) exitWith {}; @@ -43,8 +43,8 @@ if (_type in _initializedClasses) exitWith {}; _initializedClasses pushBack _type; GVAR(initializedClasses_carry) = _initializedClasses; -_carryAction = [QGVAR(carry), localize LSTRING(Carry), "", {[_player, _target] call FUNC(startCarry)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction); -_dropAction = [QGVAR(drop_carry), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction); +private _carryAction = [QGVAR(carry), localize LSTRING(Carry), "", {[_player, _target] call FUNC(startCarry)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction); +private _dropAction = [QGVAR(drop_carry), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass); [_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/dragging/functions/fnc_setDraggable.sqf b/addons/dragging/functions/fnc_setDraggable.sqf index bbfca9d868..0adcb624d8 100644 --- a/addons/dragging/functions/fnc_setDraggable.sqf +++ b/addons/dragging/functions/fnc_setDraggable.sqf @@ -1,22 +1,23 @@ /* * Author: commy2 - * * Enable the object to be dragged. * * Argument: - * 0: Any object (Object) - * 1: true to enable dragging, false to disable (Bool) + * 0: Any object + * 1: true to enable dragging, false to disable * 2: Position offset for attachTo command (Array, optinal; default: [0,0,0]) * 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0) * * Return value: * None * + * Example: + * [object, true, [0,0,0], 0] call ace_dragging_fnc_setDraggable; + * * Public: Yes */ #include "script_component.hpp" -private ["_dragAction", "_dropAction", "_type", "_initializedClasses"]; //IGNORE_PRIVATE_WARNING("_player", "_target"); params ["_object", "_enableDrag", "_position", "_direction"]; @@ -34,8 +35,8 @@ _object setVariable [QGVAR(dragPosition), _position]; _object setVariable [QGVAR(dragDirection), _direction]; // add action to class if it is not already present -_type = typeOf _object; -_initializedClasses = GETGVAR(initializedClasses,[]); +private _type = typeOf _object; +private _initializedClasses = GETGVAR(initializedClasses,[]); // do nothing if the class is already initialized if (_type in _initializedClasses) exitWith {}; @@ -43,8 +44,8 @@ if (_type in _initializedClasses) exitWith {}; _initializedClasses pushBack _type; GVAR(initializedClasses) = _initializedClasses; -_dragAction = [QGVAR(drag), localize LSTRING(Drag), "", {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}] call EFUNC(interact_menu,createAction); -_dropAction = [QGVAR(drop), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction); +private _dragAction = [QGVAR(drag), localize LSTRING(Drag), "", {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}] call EFUNC(interact_menu,createAction); +private _dropAction = [QGVAR(drop), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass); [_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/dragging/functions/fnc_startCarry.sqf b/addons/dragging/functions/fnc_startCarry.sqf index 3b08de2c9d..fd528b0104 100644 --- a/addons/dragging/functions/fnc_startCarry.sqf +++ b/addons/dragging/functions/fnc_startCarry.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Start the carrying process. * * Arguments: @@ -10,22 +9,24 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_startCarry; + * * Public: No */ #include "script_component.hpp" -private ["_weight", "_timer"]; - params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // check weight -_weight = [_target] call FUNC(getWeight); +private _weight = [_target] call FUNC(getWeight); if (_weight > missionNamespace getVariable ["ACE_maxWeightCarry", 1E11]) exitWith { [localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); }; -_timer = ACE_time + 5; +private _timer = ACE_time + 5; // handle objects vs persons if (_target isKindOf "CAManBase") then { @@ -53,7 +54,7 @@ if (_target isKindOf "CAManBase") then { _unit action ["SwitchWeapon", _unit, _unit, 99]; [_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation); - [_unit, "isDragging", true] call EFUNC(common,setforceWalkStatus); + [_unit, "forceWalk", "ACE_dragging", true] call EFUNC(common,statusEffect_set); }; diff --git a/addons/dragging/functions/fnc_startCarryPFH.sqf b/addons/dragging/functions/fnc_startCarryPFH.sqf index eafc9b8e01..4d39672a9e 100644 --- a/addons/dragging/functions/fnc_startCarryPFH.sqf +++ b/addons/dragging/functions/fnc_startCarryPFH.sqf @@ -1,14 +1,20 @@ /* * Author: commy2 - * * Carry PFH * * Arguments: - * ? + * 0: ARGS + * 0: Unit + * 1: Target + * 2: Timeout + * 1: PFEH Id * * Return Value: * None * + * Example: + * [[player, target, 100], 20] call ace_dragging_fnc_startCarryPFH; + * * Public: No */ #include "script_component.hpp" @@ -22,11 +28,13 @@ _args params ["_unit", "_target", "_timeOut"]; // handle aborting carry if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { + TRACE_4("carry false",_unit,_target,_timeOut,ACE_time); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { + TRACE_4("dead/distance",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; @@ -34,25 +42,26 @@ if (!alive _target || {_unit distance _target > 10}) then { // handle persons vs objects if (_target isKindOf "CAManBase") then { if (ACE_time > _timeOut) exitWith { + TRACE_4("Start carry person",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(carryObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; } else { if (ACE_time > _timeOut) exitWith { + TRACE_4("timeout",_unit,_target,_timeOut,ACE_time); [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; [_unit, _draggedObject] call FUNC(dropObject); }; // wait for the unit to stand up if (stance _unit == "STAND") exitWith { + TRACE_4("Start carry object",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(carryObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; - }; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index 6ad315ce00..24a279e7a7 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Start the dragging process. * * Argument: @@ -9,14 +8,19 @@ * * Return value: * None + * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_startDrag; + * + * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // check weight -private "_weight"; -_weight = [_target] call FUNC(getWeight); +private _weight = [_target] call FUNC(getWeight); 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 14af1575a6..cfa84fe279 100644 --- a/addons/dragging/functions/fnc_startDragPFH.sqf +++ b/addons/dragging/functions/fnc_startDragPFH.sqf @@ -1,14 +1,20 @@ /* * Author: commy2 - * * Drag PFH * * Arguments: - * ? + * 0: ARGS + * 0: Unit + * 1: Target + * 2: Timeout + * 1: PFEH Id * * Return Value: * None * + * Example: + * [[player, target, 100], 20] call ace_dragging_fnc_startDragPFH; + * * Public: No */ #include "script_component.hpp" @@ -22,27 +28,30 @@ _args params ["_unit", "_target", "_timeOut"]; // handle aborting drag if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { + TRACE_4("drag false",_unit,_target,_timeOut,ACE_time); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { + TRACE_4("dead/distance",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // timeout. Do nothing. Quit. ACE_time, because anim length is linked to ingame time. if (ACE_time > _timeOut) exitWith { + TRACE_4("timeout",_unit,_target,_timeOut,ACE_time); [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; [_unit, _draggedObject] call FUNC(dropObject); }; // unit is ready to start dragging if (animationState _unit in DRAG_ANIMATIONS) exitWith { + TRACE_4("Start Dragging",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(dragObject); [_idPFH] call CBA_fnc_removePerFrameHandler; diff --git a/addons/dragging/script_component.hpp b/addons/dragging/script_component.hpp index 2427f89739..b4acb948c9 100644 --- a/addons/dragging/script_component.hpp +++ b/addons/dragging/script_component.hpp @@ -2,6 +2,10 @@ #include "\z\ace\addons\main\script_mod.hpp" //#define DEBUG_ENABLED_DRAGGING +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_DRAGGING #define DEBUG_MODE_FULL diff --git a/addons/dragging/stringtable.xml b/addons/dragging/stringtable.xml index 0e105f60ce..0659101cf2 100644 --- a/addons/dragging/stringtable.xml +++ b/addons/dragging/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -34,7 +34,7 @@ Objeto muito pesado L'oggetto pesa troppo Предмет слишком тяжёлый - Moc težké + Předmět je moc těžký Az objektum túl nehéz @@ -56,6 +56,7 @@ Levantar/Abaixar Поднять/Опустить Zvýšit/Snížit + Alza/Abbassa - \ No newline at end of file + diff --git a/addons/explosives/ACE_Triggers.hpp b/addons/explosives/ACE_Triggers.hpp index 952f360f22..280906432f 100644 --- a/addons/explosives/ACE_Triggers.hpp +++ b/addons/explosives/ACE_Triggers.hpp @@ -15,19 +15,19 @@ onSetup parameters: onPlace = QUOTE(_this call FUNC(AddClacker);false); requires[] = {"ACE_Clacker"}; }; - class MK16_Transmitter:Command { + class MK16_Transmitter: Command { isAttachable = 1; - displayName = CSTRING(MK16_displayName); + displayName = CSTRING(M152_displayName); picture = PATHTOF(Data\UI\MK16_Reciever_ca.paa); requires[] = {"ACE_M26_Clacker"}; }; - class DeadManSwitch:Command { + class DeadManSwitch: Command { isAttachable = 1; displayName = CSTRING(DeadManSwitch_displayName); picture = PATHTOF(Data\UI\DeadmanSwitch.paa); requires[] = {"ACE_DeadManSwitch"}; }; - class Cellphone:Command { + class Cellphone: Command { isAttachable = 1; displayName = CSTRING(cellphone_displayName); picture = PATHTOF(Data\UI\Cellphone_UI.paa); diff --git a/addons/explosives/CfgAmmo.hpp b/addons/explosives/CfgAmmo.hpp index 843ecdb8e3..977e01e3af 100644 --- a/addons/explosives/CfgAmmo.hpp +++ b/addons/explosives/CfgAmmo.hpp @@ -3,7 +3,7 @@ class CfgAmmo { class Default; class TimeBombCore: Default { - ACE_DefuseTime = 5; + GVAR(DefuseTime) = 5; }; /* class BoundingMineCore: TimeBombCore; @@ -29,12 +29,13 @@ class CfgAmmo { */ class DirectionalBombBase; class ClaymoreDirectionalMine_Remote_Ammo: DirectionalBombBase { - ACE_Explosive = "ClaymoreDirectionalMine_Remote_Ammo_Scripted"; + GVAR(magazine) = "ClaymoreDirectionalMine_Remote_Mag"; + GVAR(Explosive) = "ClaymoreDirectionalMine_Remote_Ammo_Scripted"; GVAR(defuseObjectPosition[]) = {0, 0, 0.038}; soundActivation[] = {"", 0, 0, 0}; soundDeactivation[] = {"", 0, 0, 0}; }; - //class ClaymoreDirectionalMine_Remote_Ammo_Scripted: ClaymoreDirectionalMine_Remote_Ammo; + // class ClaymoreDirectionalMine_Remote_Ammo_Scripted: ClaymoreDirectionalMine_Remote_Ammo {}; class APERSTripMine_Wire_Ammo: DirectionalBombBase { GVAR(defuseObjectPosition[]) = {-1.415, 0, 0.12}; @@ -42,23 +43,29 @@ class CfgAmmo { class SLAMDirectionalMine_Wire_Ammo: DirectionalBombBase { indirectHitRange = 20; - ACE_explodeOnDefuse = 1; + GVAR(explodeOnDefuseChance) = 1; + GVAR(magazine) = "SLAMDirectionalMine_Wire_Mag"; }; - class SLAMDirectionalMine_Command_Ammo: SLAMDirectionalMine_Wire_Ammo { + class ACE_SLAMDirectionalMine_Command_Ammo: SLAMDirectionalMine_Wire_Ammo { mineTrigger = "RemoteTrigger"; - ACE_explodeOnDefuse = 0; + GVAR(explodeOnDefuseChance) = 0; }; - class SLAMDirectionalMine_Timer_Ammo: SLAMDirectionalMine_Wire_Ammo { + class ACE_SLAMDirectionalMine_Timer_Ammo: SLAMDirectionalMine_Wire_Ammo { mineTrigger = "TimeTrigger"; - ACE_explodeOnDefuse = 0; }; - class SLAMDirectionalMine_Magnetic_Ammo: SLAMDirectionalMine_Wire_Ammo { - mineTrigger = "MagneticTrigger"; + class ACE_SLAMDirectionalMine_Magnetic_Ammo: SLAMDirectionalMine_Wire_Ammo { + mineTrigger = "ACE_MagneticTrigger"; + GVAR(explodeOnDefuseChance) = 0; + explosionAngle = 360; + indirectHitRange = 1; + mineInconspicuousness = 25; + icon = "iconExplosiveGP"; }; class PipeBombBase; class DemoCharge_Remote_Ammo: PipeBombBase { - ACE_Explosive = "DemoCharge_Remote_Ammo_Scripted"; + GVAR(magazine) = "DemoCharge_Remote_Mag"; + GVAR(Explosive) = "DemoCharge_Remote_Ammo_Scripted"; GVAR(defuseObjectPosition[]) = {0.07, 0, 0.055}; soundActivation[] = {"", 0, 0, 0}; soundDeactivation[] = {"", 0, 0, 0}; @@ -67,60 +74,64 @@ class CfgAmmo { indirectHitRange = 7; }; class SatchelCharge_Remote_Ammo: PipeBombBase { - ACE_Explosive = "SatchelCharge_Remote_Ammo_Scripted"; + GVAR(magazine) = "SatchelCharge_Remote_Mag"; + GVAR(Explosive) = "SatchelCharge_Remote_Ammo_Scripted"; GVAR(defuseObjectPosition[]) = {0.1, 0.1, 0.05}; soundActivation[] = {"", 0, 0, 0}; soundDeactivation[] = {"", 0, 0, 0}; }; - - /*class DemoCharge_Remote_Ammo_Scripted: DemoCharge_Remote_Ammo; - class SatchelCharge_Remote_Ammo_Scripted: SatchelCharge_Remote_Ammo;*/ + // class DemoCharge_Remote_Ammo_Scripted: DemoCharge_Remote_Ammo {}; + // class SatchelCharge_Remote_Ammo_Scripted: SatchelCharge_Remote_Ammo {}; class IEDUrbanBig_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; - ACE_explodeOnDefuse = 0.02; + GVAR(explodeOnDefuseChance) = 0.02; + GVAR(magazine) = "IEDUrbanBig_Remote_Mag"; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; - class IEDUrbanBig_Command_Ammo: IEDUrbanBig_Remote_Ammo { + class ACE_IEDUrbanBig_Command_Ammo: IEDUrbanBig_Remote_Ammo { mineTrigger = "RemoteTrigger"; }; - class IEDUrbanBig_Range_Ammo: IEDUrbanBig_Remote_Ammo { + class ACE_IEDUrbanBig_Range_Ammo: IEDUrbanBig_Remote_Ammo { mineTrigger = "RangeTrigger"; }; class IEDUrbanSmall_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; - ACE_explodeOnDefuse = 0.02; + GVAR(explodeOnDefuseChance) = 0.02; + GVAR(magazine) = "IEDUrbanSmall_Remote_Mag"; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; - class IEDUrbanSmall_Command_Ammo: IEDUrbanSmall_Remote_Ammo { + class ACE_IEDUrbanSmall_Command_Ammo: IEDUrbanSmall_Remote_Ammo { mineTrigger = "RemoteTrigger"; }; - class IEDUrbanSmall_Range_Ammo: IEDUrbanSmall_Remote_Ammo { - mineTrigger = "RangeTrigger"; + class ACE_IEDUrbanSmall_Range_Ammo: IEDUrbanSmall_Remote_Ammo { + mineTrigger = "RangeTriggerShort"; }; class IEDLandBig_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; - ACE_explodeOnDefuse = 0.02; + GVAR(explodeOnDefuseChance) = 0.02; + GVAR(magazine) = "IEDLandBig_Remote_Mag"; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; - class IEDLandBig_Command_Ammo: IEDLandBig_Remote_Ammo { + class ACE_IEDLandBig_Command_Ammo: IEDLandBig_Remote_Ammo { mineTrigger = "RemoteTrigger"; }; - class IEDLandBig_Range_Ammo: IEDLandBig_Remote_Ammo { + class ACE_IEDLandBig_Range_Ammo: IEDLandBig_Remote_Ammo { mineTrigger = "RangeTrigger"; }; class IEDLandSmall_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; - ACE_explodeOnDefuse = 0.02; + GVAR(explodeOnDefuseChance) = 0.02; + GVAR(magazine) = "IEDLandSmall_Remote_Mag"; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; - class IEDLandSmall_Command_Ammo: IEDLandSmall_Remote_Ammo { + class ACE_IEDLandSmall_Command_Ammo: IEDLandSmall_Remote_Ammo { mineTrigger = "RemoteTrigger"; }; - class IEDLandSmall_Range_Ammo: IEDLandSmall_Remote_Ammo { - mineTrigger = "RangeTrigger"; + class ACE_IEDLandSmall_Range_Ammo: IEDLandBig_Remote_Ammo { + mineTrigger = "RangeTriggerShort"; }; }; diff --git a/addons/explosives/CfgEventHandlers.hpp b/addons/explosives/CfgEventHandlers.hpp index e7bf74e414..0a40c12726 100644 --- a/addons/explosives/CfgEventHandlers.hpp +++ b/addons/explosives/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index 686dd83ee8..eec0dadfa3 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -1,10 +1,10 @@ class CfgMagazines { class CA_Magazine; class ATMine_Range_Mag: CA_Magazine { - ACE_Placeable = 1; + GVAR(Placeable) = 1; useAction = 0; - ACE_SetupObject = "ACE_Explosives_Place_ATMine"; // CfgVehicle class for setup object. - ACE_DelayTime = 2.5; + GVAR(SetupObject) = "ACE_Explosives_Place_ATMine"; // CfgVehicle class for setup object. + GVAR(DelayTime) = 2.5; class ACE_Triggers { SupportedTriggers[] = {"PressurePlate"}; class PressurePlate { @@ -13,7 +13,7 @@ class CfgMagazines { }; }; class APERSBoundingMine_Range_Mag: ATMine_Range_Mag { - ACE_SetupObject = "ACE_Explosives_Place_APERSBoundingMine"; + GVAR(SetupObject) = "ACE_Explosives_Place_APERSBoundingMine"; class ACE_Triggers { SupportedTriggers[] = {"PressurePlate"}; class PressurePlate { @@ -22,7 +22,7 @@ class CfgMagazines { }; }; class APERSMine_Range_Mag: ATMine_Range_Mag { - ACE_SetupObject = "ACE_Explosives_Place_APERSMine"; + GVAR(SetupObject) = "ACE_Explosives_Place_APERSMine"; class ACE_Triggers { SupportedTriggers[] = {"PressurePlate"}; class PressurePlate { @@ -31,7 +31,7 @@ class CfgMagazines { }; }; class APERSTripMine_Wire_Mag: ATMine_Range_Mag { - ACE_SetupObject = "ACE_Explosives_Place_APERSTripwireMine"; + GVAR(SetupObject) = "ACE_Explosives_Place_APERSTripwireMine"; class ACE_Triggers { SupportedTriggers[] = {"Tripwire"}; class Tripwire; @@ -39,10 +39,10 @@ class CfgMagazines { }; class ClaymoreDirectionalMine_Remote_Mag: CA_Magazine { - ACE_Placeable = 1; + GVAR(Placeable) = 1; useAction = 0; - ACE_SetupObject = "ACE_Explosives_Place_Claymore"; - ACE_DelayTime = 1.5; + GVAR(SetupObject) = "ACE_Explosives_Place_Claymore"; + GVAR(DelayTime) = 1.5; class ACE_Triggers { SupportedTriggers[] = {"Command", "MK16_Transmitter"}; class Command { @@ -53,12 +53,12 @@ class CfgMagazines { }; class SatchelCharge_Remote_Mag: CA_Magazine { - ACE_Placeable = 1; + GVAR(Placeable) = 1; useAction = 0; - ACE_SetupObject = "ACE_Explosives_Place_SatchelCharge"; - ACE_DelayTime = 1; + GVAR(SetupObject) = "ACE_Explosives_Place_SatchelCharge"; + GVAR(DelayTime) = 1; class ACE_Triggers { - SupportedTriggers[] = {"Timer","Command", "MK16_Transmitter", "DeadmanSwitch"}; + SupportedTriggers[] = {"Timer", "Command", "MK16_Transmitter", "DeadmanSwitch"}; class Timer { FuseTime = 0.5; }; @@ -70,89 +70,95 @@ class CfgMagazines { }; }; class DemoCharge_Remote_Mag: SatchelCharge_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_DemoCharge"; + GVAR(SetupObject) = "ACE_Explosives_Place_DemoCharge"; model = "\A3\Weapons_F\explosives\c4_charge_small_d"; }; class SLAMDirectionalMine_Wire_Mag: ATMine_Range_Mag { - ACE_SetupObject = "ACE_Explosives_Place_SLAM"; + GVAR(SetupObject) = "ACE_Explosives_Place_SLAM"; class ACE_Triggers { - SupportedTriggers[] = {"IRSensor","PressurePlate","Timer","Command"}; + SupportedTriggers[] = {"IRSensor", "PressurePlate", "Timer", "Command", "MK16_Transmitter"}; class PressurePlate{ displayName = CSTRING(SLAME_Magnetic); digDistance = 0; - ammo = "SLAMDirectionalMine_Magnetic_Ammo"; + ammo = "ACE_SLAMDirectionalMine_Magnetic_Ammo"; pitch = 90; }; class IRSensor{ displayName = CSTRING(SLAME_IRSensor); }; class Timer { - ammo = "SLAMDirectionalMine_Timer_Ammo"; + ammo = "ACE_SLAMDirectionalMine_Timer_Ammo"; }; class Command { - ammo = "SLAMDirectionalMine_Command_Ammo"; + ammo = "ACE_SLAMDirectionalMine_Command_Ammo"; fuseTime = 0.5; }; + class MK16_Transmitter: Command {}; }; }; class IEDUrbanBig_Remote_Mag: DemoCharge_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanBig"; + GVAR(SetupObject) = "ACE_Explosives_Place_IEDUrbanBig"; class ACE_Triggers { SupportedTriggers[] = {"Command", "DeadmanSwitch", "Cellphone", "PressurePlate"}; class Command { FuseTime = 0.5; - ammo = "IEDUrbanBig_Command_Ammo"; - }; - class DeadmanSwitch:Command {}; - class Cellphone:Command {}; - class PressurePlate { - displayName = CSTRING(PressurePlate); - digDistance = 0; - ammo = "IEDUrbanBig_Range_Ammo"; - pitch = 0; - }; - }; - }; - - class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_IEDLandBig"; - class ACE_Triggers: ACE_Triggers { - class Command: Command { - ammo = "IEDLandBig_Command_Ammo"; - }; - class PressurePlate: PressurePlate { - ammo = "IEDLandBig_Range_Ammo"; - }; - }; - }; - class IEDUrbanSmall_Remote_Mag: DemoCharge_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanSmall"; - class ACE_Triggers { - SupportedTriggers[] = {"Command", "DeadmanSwitch", "Cellphone", "PressurePlate"}; - class Command { - FuseTime = 0.5; - ammo = "IEDUrbanSmall_Command_Ammo"; + ammo = "ACE_IEDUrbanBig_Command_Ammo"; }; class DeadmanSwitch: Command {}; class Cellphone: Command {}; class PressurePlate { displayName = CSTRING(PressurePlate); digDistance = 0; - ammo = "IEDUrbanSmall_Range_Ammo"; + ammo = "ACE_IEDUrbanBig_Range_Ammo"; + pitch = 0; + }; + }; + }; + class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag { + GVAR(SetupObject) = "ACE_Explosives_Place_IEDLandBig"; + picture = "\A3\Weapons_F\Data\UI\gear_mine_AT_CA.paa"; // Fix inconsistent picture + class ACE_Triggers: ACE_Triggers { + class Command: Command { + ammo = "ACE_IEDLandBig_Command_Ammo"; + }; + class DeadmanSwitch: Command {}; + class Cellphone: Command {}; + class PressurePlate: PressurePlate { + ammo = "ACE_IEDLandBig_Range_Ammo"; + }; + }; + }; + class IEDUrbanSmall_Remote_Mag: DemoCharge_Remote_Mag { + GVAR(SetupObject) = "ACE_Explosives_Place_IEDUrbanSmall"; + picture = "\A3\Weapons_F\Data\UI\gear_mine_AP_bouncing_CA.paa"; // Fix inconsistent picture + class ACE_Triggers { + SupportedTriggers[] = {"Command", "DeadmanSwitch", "Cellphone", "PressurePlate"}; + class Command { + FuseTime = 0.5; + ammo = "ACE_IEDUrbanSmall_Command_Ammo"; + }; + class DeadmanSwitch: Command {}; + class Cellphone: Command {}; + class PressurePlate { + displayName = CSTRING(PressurePlate); + digDistance = 0; + ammo = "ACE_IEDUrbanSmall_Range_Ammo"; pitch = 0; }; }; }; class IEDLandSmall_Remote_Mag: IEDUrbanSmall_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_IEDLandSmall"; + GVAR(SetupObject) = "ACE_Explosives_Place_IEDLandSmall"; class ACE_Triggers: ACE_Triggers { class Command: Command { - ammo = "IEDLandSmall_Command_Ammo"; + ammo = "ACE_IEDLandSmall_Command_Ammo"; }; + class DeadmanSwitch: Command {}; + class Cellphone: Command {}; class PressurePlate: PressurePlate { - ammo = "IEDLandSmall_Range_Ammo"; + ammo = "ACE_IEDLandSmall_Range_Ammo"; }; }; }; diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 24de2f5a44..9be3a936e5 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -10,17 +10,8 @@ class CfgVehicles { showDisabled = 1; priority = 4; icon = PATHTOF(UI\Explosives_Menu_ca.paa); + insertChildren = QUOTE([_player] call FUNC(addTransmitterActions);); //Sub-menu items - class ACE_Detonate { - displayName = CSTRING(Detonate); - condition = QUOTE([_player] call FUNC(canDetonate)); - statement = ""; - insertChildren = QUOTE([_player] call FUNC(addTransmitterActions);); - exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"}; - showDisabled = 1; - icon = PATHTOF(UI\Explosives_Menu_ca.paa); - priority = 2; - }; class ACE_Place { displayName = CSTRING(Place); condition = QUOTE((vehicle _player == _player) and {[_player] call FUNC(hasExplosives)}); @@ -117,7 +108,7 @@ class CfgVehicles { }; }; - class ACE_Explosives_Place_DemoCharge:ACE_Explosives_Place { + class ACE_Explosives_Place_DemoCharge: ACE_Explosives_Place { displayName = "Demo Charge"; model = "\A3\Weapons_F\explosives\c4_charge_small_d"; class ACE_Actions: ACE_Actions { @@ -126,15 +117,15 @@ class CfgVehicles { }; }; }; - class ACE_Explosives_Place_APERSBoundingMine:ACE_Explosives_Place { + class ACE_Explosives_Place_APERSBoundingMine: ACE_Explosives_Place { displayName = "APERS Bounding Mine"; model = "\A3\Weapons_F\explosives\mine_AP_bouncing"; }; - class ACE_Explosives_Place_APERSMine:ACE_Explosives_Place { + class ACE_Explosives_Place_APERSMine: ACE_Explosives_Place { displayName = "APERS Mine"; model = "\A3\Weapons_F\explosives\mine_ap"; }; - class ACE_Explosives_Place_APERSTripwireMine:ACE_Explosives_Place { + class ACE_Explosives_Place_APERSTripwireMine: ACE_Explosives_Place { displayName = "APERS Tripwire Mine"; model = "\A3\Weapons_F\explosives\mine_AP_tripwire"; class ACE_Actions: ACE_Actions { @@ -144,12 +135,12 @@ class CfgVehicles { }; }; - class ACE_Explosives_Place_ATMine:ACE_Explosives_Place { + class ACE_Explosives_Place_ATMine: ACE_Explosives_Place { displayName = "AT Mine"; model = "\A3\Weapons_f\Explosives\mine_at"; }; - class ACE_Explosives_Place_Claymore:ACE_Explosives_Place { + class ACE_Explosives_Place_Claymore: ACE_Explosives_Place { displayName = "Claymore"; model = "\A3\Weapons_F\explosives\mine_AP_miniclaymore"; class ACE_Actions: ACE_Actions { @@ -159,7 +150,7 @@ class CfgVehicles { }; }; - class ACE_Explosives_Place_SatchelCharge:ACE_Explosives_Place { + class ACE_Explosives_Place_SatchelCharge: ACE_Explosives_Place { displayName = "Satchel Charge"; model = "\A3\Weapons_F\Explosives\satchel"; class ACE_Actions: ACE_Actions { @@ -169,28 +160,28 @@ class CfgVehicles { }; }; - class ACE_Explosives_Place_SLAM:ACE_Explosives_Place { + class ACE_Explosives_Place_SLAM: ACE_Explosives_Place { displayName = "SLAM"; model = "\A3\Weapons_F\Explosives\mine_SLAM_directional"; }; // IEDs - class ACE_Explosives_Place_IEDUrbanBig:ACE_Explosives_Place { + class ACE_Explosives_Place_IEDUrbanBig: ACE_Explosives_Place { displayName = "IED Urban Big"; model = "\A3\Weapons_F\Explosives\IED_urban_big"; }; - class ACE_Explosives_Place_IEDLandBig:ACE_Explosives_Place { + class ACE_Explosives_Place_IEDLandBig: ACE_Explosives_Place { displayName = "IED Land Big"; model = "\A3\Weapons_F\Explosives\IED_land_big"; }; - class ACE_Explosives_Place_IEDUrbanSmall:ACE_Explosives_Place { + class ACE_Explosives_Place_IEDUrbanSmall: ACE_Explosives_Place { displayName = "IED Urban Small"; model = "\A3\Weapons_F\Explosives\IED_urban_small"; }; - class ACE_Explosives_Place_IEDLandSmall:ACE_Explosives_Place { + class ACE_Explosives_Place_IEDLandSmall: ACE_Explosives_Place { displayName = "IED Land Small"; model = "\A3\Weapons_F\Explosives\IED_land_small"; }; @@ -338,4 +329,77 @@ class CfgVehicles { class O_Soldier_sniper_base_F; class O_sniper_F: O_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; class O_spotter_F: O_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; + + // Editor placed mines + class MineBase; + class SLAMDirectionalMine: MineBase { + displayName = CSTRING(Module_SLAMSideAttack_DisplayName); + }; + class ACE_SLAMBottomMine: SLAMDirectionalMine { + author = ECSTRING(common,aceteam); + ammo = "ACE_SLAMDirectionalMine_Magnetic_Ammo"; + displayName = CSTRING(Module_SLAMBottomAttack_DisplayName); + // TODO: Find a way to place the mine laying down instead of standing up + }; + + class IEDUrbanBig_F; + class ACE_IEDUrbanBig_Range: IEDUrbanBig_F { + author = ECSTRING(common,aceteam); + ammo = "ACE_IEDUrbanBig_Range_Ammo"; + displayName = CSTRING(Module_IEDUrbanBig_Range_DisplayName); + }; + class IEDLandBig_F; + class ACE_IEDLandBig_Range: IEDLandBig_F { + author = ECSTRING(common,aceteam); + ammo = "ACE_IEDLandBig_Range_Ammo"; + displayName = CSTRING(Module_IEDLandBig_Range_DisplayName); + }; + class IEDUrbanSmall_F; + class ACE_IEDUrbanSmall_Range: IEDUrbanSmall_F { + author = ECSTRING(common,aceteam); + ammo = "ACE_IEDUrbanSmall_Range_Ammo"; + displayName = CSTRING(Module_IEDUrbanSmall_Range_DisplayName); + }; + class IEDLandSmall_F; + class ACE_IEDLandSmall_Range: IEDLandSmall_F { + author = ECSTRING(common,aceteam); + ammo = "ACE_IEDLandSmall_Range_Ammo"; + displayName = CSTRING(Module_IEDLandSmall_Range_DisplayName); + }; + + // Zeus placed mines + class ModuleMine_F; + class ModuleMine_SLAMDirectionalMine_F: ModuleMine_F { + displayName = CSTRING(Module_SLAMSideAttack_DisplayName); + }; + class ACE_ModuleMine_SLAMBottomMine: ModuleMine_SLAMDirectionalMine_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_SLAMBottomAttack_DisplayName); + explosive = "ACE_SLAMDirectionalMine_Magnetic_Ammo"; + icon = "iconExplosiveGP"; + }; + class ModuleExplosive_IEDUrbanBig_F; + class ACE_ModuleExplosive_IEDUrbanBig_Range: ModuleExplosive_IEDUrbanBig_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_IEDUrbanBig_Range_DisplayName); + explosive = "ACE_IEDUrbanBig_Range_Ammo"; + }; + class ModuleExplosive_IEDLandBig_F; + class ACE_ModuleExplosive_IEDLandBig_Range: ModuleExplosive_IEDLandBig_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_IEDLandBig_Range_DisplayName); + explosive = "ACE_IEDLandBig_Range_Ammo"; + }; + class ModuleExplosive_IEDUrbanSmall_F; + class ACE_ModuleExplosive_IEDUrbanSmall_Range: ModuleExplosive_IEDUrbanSmall_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_IEDUrbanSmall_Range_DisplayName); + explosive = "ACE_IEDUrbanSmall_Range_Ammo"; + }; + class ModuleExplosive_IEDLandSmall_F; + class ACE_ModuleExplosive_IEDLandSmall_Range: ModuleExplosive_IEDLandSmall_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_IEDLandSmall_Range_DisplayName); + explosive = "ACE_IEDLandSmall_Range_Ammo"; + }; }; diff --git a/addons/explosives/CfgWeapons.hpp b/addons/explosives/CfgWeapons.hpp index f6ee8ec65e..cd900b2da3 100644 --- a/addons/explosives/CfgWeapons.hpp +++ b/addons/explosives/CfgWeapons.hpp @@ -13,8 +13,9 @@ class CfgWeapons { descriptionShort = CSTRING(clacker_description); picture = PATHTOF(Data\UI\Clacker.paa); model = QUOTE(PATHTOF(data\ace_m57.p3d)); - ACE_Range = 250; - ACE_Detonator = 1; + GVAR(Range) = 250; + GVAR(Detonator) = 1; + GVAR(triggerType) = "Command"; class ItemInfo: ACE_ExplosiveItem { mass = 3; @@ -22,9 +23,10 @@ class CfgWeapons { }; }; class ACE_M26_Clacker: ACE_Clacker { - displayName = CSTRING(M26_displayName); + displayName = CSTRING(M152_Clacker_displayName); picture = PATHTOF(Data\UI\MK26_Transmitter_ca.paa); - ACE_Range = 5000; + GVAR(Range) = 5000; + GVAR(triggerType) = "MK16_Transmitter"; }; class ACE_DefusalKit: ACE_ItemCore { scope = 2; @@ -44,8 +46,9 @@ class CfgWeapons { descriptionShort = CSTRING(DeadManSwitch_description); picture = PATHTOF(Data\UI\DeadmanSwitch.paa); model = "\A3\weapons_F\ammo\mag_univ.p3d"; - ACE_Range = 100; - ACE_Detonator = 1; + GVAR(Range) = 100; + GVAR(Detonator) = 1; + GVAR(triggerType) = "DeadManSwitch"; class ItemInfo: ACE_ExplosiveItem { mass = 2; @@ -58,8 +61,9 @@ class CfgWeapons { descriptionShort = CSTRING(cellphone_description); picture = PATHTOF(Data\UI\Cellphone_UI.paa); model = "\A3\weapons_F\ammo\mag_univ.p3d"; - ACE_Range = 15000; - ACE_Detonator = 1; + GVAR(Range) = 15000; + GVAR(Detonator) = 1; + GVAR(triggerType) = "Cellphone"; class ItemInfo: ACE_ExplosiveItem { mass = 2; diff --git a/addons/explosives/XEH_PREP.hpp b/addons/explosives/XEH_PREP.hpp new file mode 100644 index 0000000000..b3686a986f --- /dev/null +++ b/addons/explosives/XEH_PREP.hpp @@ -0,0 +1,46 @@ + +PREP(addCellphoneIED); +PREP(addClacker); +PREP(addDetonateActions); +PREP(addExplosiveActions); +PREP(addToSpeedDial); +PREP(addTransmitterActions); +PREP(addTriggerActions); +PREP(canDefuse); +PREP(canDetonate); +PREP(connectExplosive); +PREP(defuseExplosive); +PREP(detonateExplosive); +PREP(detonateExplosiveAll); +PREP(dialPhone); +PREP(dialingPhone); + +PREP(handleScrollWheel); + +PREP(hasExplosives); +PREP(hasPlacedExplosives); + +PREP(interactEH); + +PREP(getDetonators); +PREP(getPlacedExplosives); +PREP(getSpeedDialExplosive); + +PREP(module); + +PREP(onIncapacitated); +PREP(onInventoryChanged); + +PREP(openTimerSetUI); + +PREP(placeExplosive); +PREP(removeFromSpeedDial); + +PREP(scriptedExplosive); +PREP(selectTrigger); +PREP(setupExplosive); +PREP(setPosition); +PREP(setSpeedDial); +PREP(startDefuse); +PREP(startTimer); +PREP(triggerType); diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index af105b5879..651f704a6a 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -36,6 +36,16 @@ GVAR(Setup) = objNull; GVAR(pfeh_running) = false; GVAR(CurrentSpeedDial) = 0; +// Properly angle preplaced bottom-attack SLAMs +{ + if (local _x) then { + switch (typeOf _x) do { + case ("ACE_SLAMDirectionalMine_Magnetic_Ammo"): { + [_x, getDir _x, 90] call FUNC(setPosition); + }; + }; + }; +} forEach allMines; ["interactMenuOpened", { //Cancel placement if interact menu opened diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index 470cae661d..8ec4fa3817 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -17,47 +17,6 @@ ADDON = false; -PREP(addCellphoneIED); -PREP(addClacker); -PREP(addDetonateActions); -PREP(addExplosiveActions); -PREP(addToSpeedDial); -PREP(addTransmitterActions); -PREP(addTriggerActions); -PREP(canDefuse); -PREP(canDetonate); -PREP(defuseExplosive); -PREP(detonateExplosive); -PREP(dialPhone); -PREP(dialingPhone); - -PREP(handleScrollWheel); - -PREP(hasExplosives); -PREP(hasPlacedExplosives); - -PREP(interactEH); - -PREP(getDetonators); -PREP(getPlacedExplosives); -PREP(getSpeedDialExplosive); - -PREP(module); - -PREP(onIncapacitated); -PREP(onInventoryChanged); - -PREP(openTimerSetUI); - -PREP(placeExplosive); -PREP(removeFromSpeedDial); - -PREP(selectTrigger); -PREP(setupExplosive); -PREP(setPosition); -PREP(setSpeedDial); -PREP(startDefuse); -PREP(startTimer); -PREP(triggerType); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/explosives/XEH_preStart.sqf b/addons/explosives/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/explosives/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index 99544213d3..3fc047fa6a 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -2,7 +2,7 @@ class CfgPatches { class ADDON { - units[] = {}; + units[] = {"ACE_ModuleMine_SLAMBottomMine", "ACE_ModuleExplosive_IEDUrbanBig_Range", "ACE_ModuleExplosive_IEDLandBig_Range", "ACE_ModuleExplosive_IEDUrbanSmall_Range", "ACE_ModuleExplosive_IEDLandSmall_Range"}; weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch", "ACE_Cellphone"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; @@ -37,7 +37,7 @@ class CfgActions { class CfgMineTriggers { class RangeTrigger; - class MagneticTrigger: RangeTrigger { + class ACE_MagneticTrigger: RangeTrigger { mineMagnetic = 1; mineTriggerRange = 1; }; diff --git a/addons/explosives/functions/fnc_addDetonateActions.sqf b/addons/explosives/functions/fnc_addDetonateActions.sqf index 04e78f0f82..f88abc29d3 100644 --- a/addons/explosives/functions/fnc_addDetonateActions.sqf +++ b/addons/explosives/functions/fnc_addDetonateActions.sqf @@ -19,18 +19,21 @@ params ["_unit", "_detonator"]; TRACE_2("params",_unit,_detonator); -private ["_result", "_item", "_children", "_range", "_required"]; +private ["_result", "_item", "_children", "_range", "_required","_explosivesList"]; -_range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range"); +_range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> QGVAR(Range)); _result = [_unit] call FUNC(getPlacedExplosives); _children = []; +_explosivesList = []; { if (!isNull(_x select 0)) then { _required = getArray (ConfigFile >> "ACE_Triggers" >> (_x select 4) >> "requires"); if (_detonator in _required) then { _item = ConfigFile >> "CfgMagazines" >> (_x select 3); + _explosivesList pushBack _x; + _children pushBack [ [ @@ -40,13 +43,111 @@ _children = []; {(_this select 2) call FUNC(detonateExplosive);}, {true}, {}, - [ACE_player,_range,_x] + [_unit,_range,_x] ] call EFUNC(interact_menu,createAction), [], - ACE_Player + _unit ]; }; }; } forEach _result; +if (_detonator != "ACE_DeadManSwitch") then { + // Add action to detonate all explosives tied to the detonator + if (count _explosivesList > 0) then { + _children pushBack [ + [ + "Explosive_All", + localize LSTRING(DetonateAll), + getText(ConfigFile >> "CfgWeapons" >> _detonator >> "picture"), + {(_this select 2) call FUNC(detonateExplosiveAll);}, + {true}, + {}, + [_unit,_range,_explosivesList] + ] call EFUNC(interact_menu,createAction), + [], + _unit + ]; + }; +} else { + //Add action to detonate all explosives (including the inventory explosive): + _children pushBack [ + [ + "Explosive_All_Deadman", + localize LSTRING(DetonateAll), + getText(ConfigFile >> "CfgWeapons" >> _detonator >> "picture"), + {[_player] call FUNC(onIncapacitated)}, + {true} + ] call EFUNC(interact_menu,createAction), + [], + _unit + ]; + + //Adds actions for the explosives you can connect to the deadman switch. + private _connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""]; + if ((_connectedInventoryExplosive != "") && {!(_connectedInventoryExplosive in (magazines _unit))}) then { + TRACE_1("set, but missing in inventory",_connectedInventoryExplosive); + _unit setVariable [QGVAR(deadmanInvExplosive), "", true]; + }; + + _connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""]; + if (_connectedInventoryExplosive != "") then { + //Add the disconect action + private _magConfig = configFile >> "CfgMagazines" >> _connectedInventoryExplosive; + private _name = if ((getText (_magConfig >> "displayNameShort")) != "") then { + getText (_magConfig >> "displayNameShort") + } else { + getText(_magConfig >> "displayName") + }; + private _picture = getText (_magConfig >> "picture"); + + _children pushBack [ + ([ + "Deadman_disconnect", + format ["%1 %2", localize "str_disp_disconnect", _name], + _picture, + { + params ["_player"]; + TRACE_1("clear",_player); + _player setVariable [QGVAR(deadmanInvExplosive), "", true]; + }, + {true} + ] call EFUNC(interact_menu,createAction)), [], _unit]; + + } else { + //Add all magazines that would work with the deadman switch + private _procressedMags = []; + { + private _mag = _x; + if (!(_mag in _procressedMags)) then { + _procressedMags pushBack _x; + private _magConfig = configFile >> "CfgMagazines" >> _mag; + private _supportedTriggers = getArray (_magConfig >> "ACE_Triggers" >> "SupportedTriggers"); + if (({_x == "DeadmanSwitch"} count _supportedTriggers) == 1) then { //case insensitive search + private _name = if ((getText (_magConfig >> "displayNameShort")) != "") then { + getText (_magConfig >> "displayNameShort") + } else { + getText(_magConfig >> "displayName") + }; + private _picture = getText (_magConfig >> "picture"); + + _children pushBack [ + ([ + format ["Deadman_exp_%1", _mag], + format [localize LSTRING(connectInventoryExplosiveToDeadman), _name], + _picture, + { + params ["_player", "", "_mag"]; + TRACE_2("set new",_player,_mag); + _player setVariable [QGVAR(deadmanInvExplosive), _mag, true]; + }, + {(_this select 2) in (magazines _player)}, + {}, + (_mag) + ] call EFUNC(interact_menu,createAction)), [], _unit]; + }; + }; + } forEach (magazines _unit); + }; +}; _children diff --git a/addons/explosives/functions/fnc_addExplosiveActions.sqf b/addons/explosives/functions/fnc_addExplosiveActions.sqf index fa00fdd207..e744af6bce 100644 --- a/addons/explosives/functions/fnc_addExplosiveActions.sqf +++ b/addons/explosives/functions/fnc_addExplosiveActions.sqf @@ -22,7 +22,7 @@ _list = []; _itemCount = []; { _item = ConfigFile >> "CfgMagazines" >> _x; - if (getNumber(_item >> "ACE_Placeable") == 1) then { + if (getNumber(_item >> QGVAR(Placeable)) == 1) then { _index = _list find _item; if (_index != -1) then { _itemCount set [_index, (_itemCount select _index) + 1]; diff --git a/addons/explosives/functions/fnc_addTransmitterActions.sqf b/addons/explosives/functions/fnc_addTransmitterActions.sqf index 40ec8581d4..4397e743a0 100644 --- a/addons/explosives/functions/fnc_addTransmitterActions.sqf +++ b/addons/explosives/functions/fnc_addTransmitterActions.sqf @@ -33,10 +33,10 @@ _children = []; {}, {true}, {(_this select 2) call FUNC(addDetonateActions);}, - [ACE_player,_x] + [_unit,_x] ] call EFUNC(interact_menu,createAction), [], - ACE_Player + _unit ]; } forEach _detonators; diff --git a/addons/explosives/functions/fnc_connectExplosive.sqf b/addons/explosives/functions/fnc_connectExplosive.sqf new file mode 100644 index 0000000000..aab7ca2c4d --- /dev/null +++ b/addons/explosives/functions/fnc_connectExplosive.sqf @@ -0,0 +1,27 @@ +/* + * Author: VKing + * Add preplaced explosives to a unit's detonator. + * + * Arguments: + * 0: Unit + * 1: Explosive object + * 2: Detonator type + * + * Return Value: + * None + * + * Example: + * [player, claymore1, "ACE_Clacker"] call ace_explosives_fnc_connectExplosive + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_object", "_detonator"]; +TRACE_3("Params",_unit,_object,_detonator); + +private _detonatorConfig = getText (configFile >> "CfgWeapons" >> _detonator >> QGVAR(triggerType)); + +private _magazineClass = getText (configFile >> "CfgAmmo" >> typeOf _object >> QGVAR(magazine)); + +[_unit, _object, _magazineClass, [configFile >> "ACE_Triggers" >> _detonatorConfig]] call FUNC(addClacker); diff --git a/addons/explosives/functions/fnc_defuseExplosive.sqf b/addons/explosives/functions/fnc_defuseExplosive.sqf index 0af28788b3..147d722987 100644 --- a/addons/explosives/functions/fnc_defuseExplosive.sqf +++ b/addons/explosives/functions/fnc_defuseExplosive.sqf @@ -19,9 +19,11 @@ params ["_unit", "_explosive"]; TRACE_2("params",_unit,_explosive); -if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse"))}) exitWith { +if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> QGVAR(explodeOnDefuseChance)))}) exitWith { TRACE_1("exploding on defuse",_explosive); [_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive); + [QGVAR(explodeOnDefuse), [_explosive, _unit]] call EFUNC(common,globalEvent); }; _unit action ["Deactivate", _unit, _explosive]; +[QGVAR(defuse), [_explosive, _unit]] call EFUNC(common,globalEvent); diff --git a/addons/explosives/functions/fnc_detonateExplosive.sqf b/addons/explosives/functions/fnc_detonateExplosive.sqf index d204ad7bad..a01f181635 100644 --- a/addons/explosives/functions/fnc_detonateExplosive.sqf +++ b/addons/explosives/functions/fnc_detonateExplosive.sqf @@ -33,7 +33,7 @@ if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRA if (getNumber (ConfigFile >> "CfgAmmo" >> typeOf (_item select 0) >> "TriggerWhenDestroyed") == 0) then { private ["_exp", "_previousExp"]; _previousExp = _item select 0; - _exp = getText (ConfigFile >> "CfgAmmo" >> typeOf (_previousExp) >> "ACE_Explosive"); + _exp = getText (ConfigFile >> "CfgAmmo" >> typeOf (_previousExp) >> QGVAR(Explosive)); if (_exp != "") then { _exp = createVehicle [_exp, [0,0,15001], [], 0, "NONE"]; _exp setDir (getDir _previousExp); diff --git a/addons/explosives/functions/fnc_detonateExplosiveAll.sqf b/addons/explosives/functions/fnc_detonateExplosiveAll.sqf new file mode 100644 index 0000000000..377dc0b93a --- /dev/null +++ b/addons/explosives/functions/fnc_detonateExplosiveAll.sqf @@ -0,0 +1,27 @@ +/* + * Author: VKing + * Causes the unit to detonate all passed explosives. + * + * Arguments: + * 0: Unit + * 1: Range (-1 to ignore) + * 2: Explosives to detonate + * 0: Explosive + * 1: Fuse time + * + * Return Value: + * None + * + * Example: + * [player, -1, [[c4,0.5]]] call ACE_Explosives_fnc_detonateExplosiveAll; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_range", "_explosivesList"]; +TRACE_3("Params",_unit,_range,_explosivesList); + +{ + [_unit,_range,_x] call FUNC(detonateExplosive); +} forEach _explosivesList; diff --git a/addons/explosives/functions/fnc_getDetonators.sqf b/addons/explosives/functions/fnc_getDetonators.sqf index 54c942e9de..d8c095e6f0 100644 --- a/addons/explosives/functions/fnc_getDetonators.sqf +++ b/addons/explosives/functions/fnc_getDetonators.sqf @@ -19,16 +19,7 @@ params ["_unit"]; TRACE_1("params",_unit); -private ["_items", "_result", "_config"]; - -_items = (items _unit); -_result = []; - -{ - _config = ConfigFile >> "CfgWeapons" >> _x; - if (getNumber (_config >> "ACE_Detonator") == 1 && {!(_x in _result)}) then { - _result pushBack _x; - }; -} forEach _items; +private _result = (items _unit) select {getNumber (ConfigFile >> "CfgWeapons" >> _x >> QGVAR(Detonator)) == 1}; +_result = _result arrayIntersect _result; _result diff --git a/addons/explosives/functions/fnc_hasExplosives.sqf b/addons/explosives/functions/fnc_hasExplosives.sqf index 4a626e9c63..c9da5e59d1 100644 --- a/addons/explosives/functions/fnc_hasExplosives.sqf +++ b/addons/explosives/functions/fnc_hasExplosives.sqf @@ -23,7 +23,7 @@ private ["_result", "_magazines"]; _result = false; _magazines = magazines _unit; { - if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> "ACE_Placeable") == 1) exitWith { + if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> QGVAR(Placeable)) == 1) exitWith { _result = true; }; } count _magazines; diff --git a/addons/explosives/functions/fnc_onIncapacitated.sqf b/addons/explosives/functions/fnc_onIncapacitated.sqf index 963f106979..6bbf6152d3 100644 --- a/addons/explosives/functions/fnc_onIncapacitated.sqf +++ b/addons/explosives/functions/fnc_onIncapacitated.sqf @@ -25,3 +25,24 @@ _deadman = [_unit, "DeadManSwitch"] call FUNC(getPlacedExplosives); { [_unit, -1, _x, true] call FUNC(detonateExplosive); } forEach _deadman; + +//Handle deadman connected to explosive in inventory +private _connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""]; +if (_connectedInventoryExplosive != "") then { + if (!(_connectedInventoryExplosive in (magazines _unit))) exitWith {}; + + //Remove mag and reset variable + _unit removeMagazine _connectedInventoryExplosive; + _unit setVariable [QGVAR(deadmanInvExplosive), "", true]; + + private _ammo = getText (configFile >> "CfgMagazines" >> _connectedInventoryExplosive >> "ammo"); + TRACE_2("deadman inventory",_connectedInventoryExplosive,_ammo); + private _magazineTrigger = configFile >> "CfgMagazines" >> _connectedInventoryExplosive >> "ACE_Triggers" >> "DeadmanSwitch"; + if (isText (_magazineTrigger >> "ammo")) then { + _ammo = getText (_magazineTrigger >> "ammo"); + }; + + private _explosive = createVehicle [_ammo, (getPos _unit), [], 0, "NONE"]; + _explosive setPosASL (getPosASL _unit); + [_unit, -1, [_explosive, -1]] call FUNC(detonateExplosive); //Explode, ignoring range, with a random 0-1 second delay +}; diff --git a/addons/explosives/functions/fnc_onInventoryChanged.sqf b/addons/explosives/functions/fnc_onInventoryChanged.sqf index 127cd8c105..889e9e2186 100644 --- a/addons/explosives/functions/fnc_onInventoryChanged.sqf +++ b/addons/explosives/functions/fnc_onInventoryChanged.sqf @@ -26,7 +26,7 @@ private ["_config", "_detonators"]; if (_receiver != ace_player) exitWith {}; _config = ConfigFile >> "CfgWeapons" >> _item; -if (isClass _config && {getNumber(_config >> "ACE_Detonator") == 1}) then { +if (isClass _config && {getNumber(_config >> QGVAR(Detonator)) == 1}) then { private ["_clackerItems"]; _clackerItems = _giver getVariable [QGVAR(Clackers), []]; _receiver setVariable [QGVAR(Clackers), (_receiver getVariable [QGVAR(Clackers), []]) + _clackerItems, true]; diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf index e1cdbcd80c..83cdb2fef8 100644 --- a/addons/explosives/functions/fnc_placeExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -94,7 +94,7 @@ if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_tr _pitch = getNumber (_magazineTrigger >> "pitch"); -//Globaly set the position angle: -[QGVAR(place), [_explosive, _dir, _pitch]] call EFUNC(common,globalEvent); +//Globaly set the position and angle: +[QGVAR(place), [_explosive, _dir, _pitch, _unit]] call EFUNC(common,globalEvent); _explosive diff --git a/addons/explosives/functions/fnc_scriptedExplosive.sqf b/addons/explosives/functions/fnc_scriptedExplosive.sqf new file mode 100644 index 0000000000..b4abb204b3 --- /dev/null +++ b/addons/explosives/functions/fnc_scriptedExplosive.sqf @@ -0,0 +1,27 @@ +/* + * Author: VKing + * Detonate explosives via script, for use in triggers or mission scripts to + * detonate editor-placed explosives. + * + * Arguments: + * 0: Explosives objects to detonate + * 1: Fuze delay (for each explosive; use negative number for random time up to value) + * + * Return Value: + * None + * + * Example: + * [[charge1, charge2, charge3], -1] call ACE_Explosives_fnc_scriptedExplosive; + * [[claymore1, claymore2]] call ACE_Explosives_fnc_scriptedExplosive; + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_explosiveArr",["_fuzeTime",0]]; + +private _detTime; +{ + _detTime = if (_fuzeTime < 0) then {random abs _fuzeTime} else {_fuzeTime}; + [objNull, -1, [_x, _detTime]] call FUNC(detonateExplosive); +} forEach _explosiveArr; diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index b104761fac..b1fdf7216b 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -27,12 +27,12 @@ TRACE_3("params",_vehicle,_unit,_magClassname); private["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"]; //Get setup object vehicle and model: -_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> "ACE_SetupObject"); +_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> QGVAR(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); +[_unit, "forceWalk", "ACE_Explosives", true] call EFUNC(common,statusEffect_set); //Show mouse buttons: [localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); @@ -152,7 +152,7 @@ GVAR(TweakedAngle) = 0; [_pfID] call CBA_fnc_removePerFrameHandler; GVAR(pfeh_running) = false; - [_unit, "ACE_Explosives", false] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_Explosives", false] call EFUNC(common,statusEffect_set); [] 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); diff --git a/addons/explosives/functions/fnc_startDefuse.sqf b/addons/explosives/functions/fnc_startDefuse.sqf index 2c394a997a..84d7274069 100644 --- a/addons/explosives/functions/fnc_startDefuse.sqf +++ b/addons/explosives/functions/fnc_startDefuse.sqf @@ -28,8 +28,8 @@ _fnc_DefuseTime = { TRACE_2("defuseTime",_specialist,_target); private ["_defuseTime"]; _defuseTime = 5; - if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then { - _defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime"); + if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime))) then { + _defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime)); }; if (!_specialist && {GVAR(PunishNonSpecialists)}) then { _defuseTime = _defuseTime * 1.5; diff --git a/addons/explosives/script_component.hpp b/addons/explosives/script_component.hpp index 17de3516a5..86eefd72b6 100644 --- a/addons/explosives/script_component.hpp +++ b/addons/explosives/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_EXPLOSIVES #define DEBUG_MODE_FULL diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 6cf03d7be2..bcccb1f601 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -14,28 +14,37 @@ Взрывчатка - Place >> - Platzieren >> - Colocar >> - Umieść >> - Placer >> - Položit >> - Piazza >> - Elhelyezés >> - Colocar >> - Установить >> + Place + Platzieren + Colocar + Umieść + Placer + Položit + Piazza + Elhelyezés + Colocar + Установить - Detonate >> - Zünden >> - Detonar >> - Detonuj >> - Mise à feu >> - Odpálit >> - Detona >> - Robbantás >> - Detonar >> - Подрыв >> + Detonate + Zünden + Detonar + Detonuj + Mise à feu + Odpálit + Detona + Robbantás + Detonar + Подрыв + + + Detonate All + Alle Zünden + Detonar Todo + Подрыв всех + Odpálit VŠE + Detonuj wszystkie + Detona Tutti Explosive code: %1 @@ -80,6 +89,7 @@ Заблокировано Blokováno Zablokowany + Bloccato Cancel @@ -177,19 +187,19 @@ Usado para acionar explosivos remotamente Используется для удаленной детонации зарядов - - M26 Firing Device - M26 Zündvorrichtung - Dispositivo de detonación MK26 - Zapalnik M26 - Dispositif de mise à feu M26 - Odpalovací zařízení M26 - Detonatore M26 - M26 Gyújtóeszköz - M26 Dispositivo de Detonação - Взрыватель M26 + + M152 Firing Device + M152 Zündvorrichtung + Dispositivo de detonación M152 + Zapalnik M152 + Dispositif de mise à feu M152 + Odpalovací zařízení M152 + Detonatore M152 + M152 Gyújtóeszköz + M152 Dispositivo de Detonação + Взрыватель M152 - + M152 RAMS M152 RAMS M152 RAMS @@ -303,7 +313,7 @@ Menú de detonación Menu detonacji Menu de mise à feux - Menu Detonace + Menu detonace Menù di detonazione Robbantási menü Menu de detonação @@ -315,7 +325,7 @@ Menú de colocación Menu umieszczania Menu de placement - Menu Umístění + Menu umístění Menù di collocamento Elhelyezési menü Menu de posicionamento @@ -375,7 +385,7 @@ Configurar tiempo Ustaw czas Régler minuteur - Nastavit Čas + Nastavit čas Modifica il conto alla rovescia Idő beállítása Configurar Tempo @@ -387,7 +397,7 @@ Seleccionar un detonador Wybierz zapalnik Sélectionner une mise à feu - Zvolit Detonátor + Zvolit detonátor Seleziona un attivatore Gyújtóeszköz kiválasztása Selecionar um Gatilho @@ -445,7 +455,7 @@ No triggers available for %1 Brak dostępnych zapalników dla %1 No hay detonadores disponibles para %1 - Keine Auslöser vorhanden für %1 + Keine Auslöser für %1 vorhanden Pas de mise à feu disponible pour %1 Žádný detonátor k dispozici pro %1 Nessun attivatore disponibile per %1 @@ -535,6 +545,7 @@ Module explosifs Robbanóanyag-rendszer Взрывные устройства + Sistema Esplosivi Require specialists? @@ -546,6 +557,7 @@ Requiert un spécialiste? Specialisták igénylése? Требуется специалист? + Richiedi specialisti? Require explosive specialists to disable explosives? Default: No @@ -557,6 +569,7 @@ 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 Требуется ли специалист по минному делу для обезвреживания взрывчатки? По-умолчанию: Нет + Richiedi specialisti esplosivi per disabilitare esplosivi? Default: No Punish non-specialists? @@ -568,6 +581,7 @@ Punir les non-spécialistes? Nem-specialisták büntetése? Штраф не-специалистам? + Punisci non-specialisti? Increase the time it takes to complete actions for non-specialists? Default: Yes @@ -579,6 +593,7 @@ 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 Увеличивать время завершения действий для не-специалистов? По-умолчанию: Нет + Aumenta il tempo richiesto per completare azioni per non-specialisti? Default: Si Explode on defusal? @@ -590,6 +605,7 @@ Explosion si désamorçage? Robbanás hatástalanításkor? Взрыв при разминир.? + Fai esplodere quando disarmato? Enable certain explosives to explode on defusal? Default: Yes @@ -601,6 +617,7 @@ 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 Разрешить определенным взрывным устройствам взрываться при разминировании? По-умолчанию: Да + Abilita alcuni esplosivi per esplosione al disarmo? Default: Si This module adjusts the settings related to explosives. @@ -612,6 +629,91 @@ Ez a modul a robbanóanyagokhoz kötött beállításokat szabályozza. Этот модуль управляет настройками, связанными со взрывными устройствами Este módulo ajusta las configuraciones relacionadas con explosivos. + Questo modulo cambia le impostazioni relative agli esplosivi + + + M6 SLAM Mine (Bottom Attack) + + + M6-SLAM-Mine (Bodenangriff) + + + + + + Mina M6 SLAM (atak od dołu) + + + M6 SLAM Mine (Side Attack) + + + M6-SLAM-Mine (Seitenangriff) + + + + + + Mina M6 SLAM (atak od boku) + + + Large IED (Urban, Pressure Plate) + + + Große USBV (Stadt, Druckplatte) + + + + + + Duży IED (miejski, płyta naciskowa) + + + Large IED (Dug-in, Pressure Plate) + + + Große USBV (Eingegraben, Druckplatte) + + + + + + Duży IED (zakopany, płyta naciskowa) + + + Small IED (Urban, Pressure Plate) + + + Kleine USBV (Stadt, Druckplatte) + + + + + + Mały IED (miejski, płyta naciskowa) + + + Small IED (Dug-in, Pressure Plate) + + + Kleine USBV (Eingegraben, Druckplatte) + + + + + + Mały IED (zakopany, płyta naciskowa) + + + Connect to %1 + Conectar a %1 + Подключиться к %1 + Verbinde mit %1 + Připojit k %1 + Podłącz do %1 + Connecter %1 + Csatlakozás %1 + Collega a %1 + Conectar à %1 diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index ab41fa904b..b477f93d6a 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -76,36 +82,3 @@ class Extended_Respawn_EventHandlers { }; }; }; - -class Extended_FiredBIS_EventHandlers { - class Tank { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class Car { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class Helicopter { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class Plane { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class Ship_F { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class StaticWeapon { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; -}; diff --git a/addons/fcs/CfgOptics.hpp b/addons/fcs/CfgOptics.hpp index 91f83dd6f6..aa68a6f68a 100644 --- a/addons/fcs/CfgOptics.hpp +++ b/addons/fcs/CfgOptics.hpp @@ -123,7 +123,7 @@ class RscInGameUI { }; }; class Rsc_ACE_Helo_UI_Turret: RscUnitInfo { - onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; + onLoad = "[""onLoad"",_this,""RscUnitInfo"",'IGUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; class CA_IGUI_elements_group: RscControlsGroup { class controls { MACRO_RANGEFINDER diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp index f1b896c612..45051c912d 100644 --- a/addons/fcs/CfgVehicles.hpp +++ b/addons/fcs/CfgVehicles.hpp @@ -8,7 +8,7 @@ class CfgVehicles { class NewTurret { GVAR(Enabled) = 0; GVAR(MinDistance) = 200; - GVAR(MaxDistance) = 9990; + GVAR(MaxDistance) = 5500; GVAR(DistanceInterval) = 5; class Turrets; }; @@ -86,9 +86,14 @@ class CfgVehicles { class MRAP_01_base_F: Car_F {}; class MRAP_01_gmg_base_F: MRAP_01_base_F { - /*class Turrets: Turrets { - class MainTurret: MainTurret {}; - };*/ + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F { @@ -104,9 +109,14 @@ class CfgVehicles { class MRAP_02_base_F: Car_F {}; class MRAP_02_hmg_base_F: MRAP_02_base_F { - /*class Turrets: Turrets { - class MainTurret: MainTurret {}; - };*/ + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; class MRAP_02_gmg_base_F: MRAP_02_hmg_base_F { @@ -120,16 +130,24 @@ class CfgVehicles { }; class MRAP_03_base_F: Car_F { - /*class Turrets: Turrets { - class CommanderTurret: MainTurret {}; - };*/ + class Turrets: Turrets { + class CommanderTurret: MainTurret { + GVAR(Enabled) = 0; + }; + }; }; class MRAP_03_hmg_base_F: MRAP_03_base_F { - /*class Turrets: Turrets { - class MainTurret: MainTurret {}; - class CommanderTurret: CommanderTurret {}; - };*/ + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0;}; + class CommanderTurret: CommanderTurret { + GVAR(Enabled) = 0; + }; + }; }; class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F { @@ -162,13 +180,16 @@ class CfgVehicles { }; class APC_Wheeled_02_base_F: Wheeled_APC_F { - /*class Turrets: Turrets { + class Turrets: Turrets { class MainTurret: MainTurret { - class Turrets; + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; }; - class CommanderOptics: CommanderOptics {}; - };*/ + // class CommanderOptics: CommanderOptics {}; + }; }; class APC_Wheeled_03_base_F: Wheeled_APC_F { @@ -210,7 +231,10 @@ class CfgVehicles { class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F { class Turrets: Turrets { class MainTurret: MainTurret { - GVAR(Enabled) = 0; + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; }; class CommanderOptics: CommanderOptics {}; }; @@ -294,14 +318,36 @@ class CfgVehicles { class B_MBT_01_cannon_F: B_MBT_01_base_F {}; + class B_MBT_01_TUSK_F: B_MBT_01_cannon_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + }; + class MBT_01_arty_base_F: MBT_01_base_F { class Turrets: Turrets { class MainTurret: MainTurret { GVAR(Enabled) = 0; - /*class Turrets: Turrets { - class CommanderOptics: CommanderOptics {}; - };*/ + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; }; }; @@ -337,9 +383,14 @@ class CfgVehicles { class MainTurret: MainTurret { GVAR(Enabled) = 0; - /*class Turrets: Turrets { - class CommanderOptics: CommanderOptics {}; - };*/ + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; }; }; @@ -361,25 +412,8 @@ class CfgVehicles { }; }; - class B_MBT_01_TUSK_F: B_MBT_01_cannon_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - - class Turrets: Turrets { - class CommanderOptics: CommanderOptics { - GVAR(Enabled) = 1; - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - }; - // SHIPS - /*class Ship: AllVehicles { + class Ship: AllVehicles { class Turrets { class MainTurret; }; @@ -391,17 +425,20 @@ class CfgVehicles { class Boat_Armed_01_base_F: Boat_F { class Turrets: Turrets { - class FrontTurret; - class RearTurret: FrontTurret {}; + class FrontTurret: NewTurret { + GVAR(enabled) = 1; + GVAR(minDistance) = 100; + GVAR(maxDistance) = 2000; + GVAR(distanceInterval) = 5; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + class RearTurret: FrontTurret { + discreteDistance[] = {100,200,300,400,600,800,1000,1200}; // Originally inherited from FrontTurret + discreteDistanceInitIndex = 4; + }; }; - };*/ - - /*class Boat_Armed_01_minigun_base_F: Boat_Armed_01_base_F { - class Turrets: Turrets { - class FrontTurret: FrontTurret {}; - class RearTurret: RearTurret {}; - }; - };*/ + }; // AIR VEHICLES class Air: AllVehicles {}; @@ -529,8 +566,24 @@ class CfgVehicles { class Turrets: Turrets { class MainTurret: MainTurret { GVAR(Enabled) = 1; - GVAR(MinDistance) = 100; - GVAR(MaxDistance) = 1500; + GVAR(MinDistance) = 200; + GVAR(MaxDistance) = 2000; + GVAR(DistanceInterval) = 5; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + + class StaticGrenadeLauncher: StaticWeapon {}; + class GMG_TriPod: StaticGrenadeLauncher {}; + + class GMG_01_base_F: GMG_TriPod { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + GVAR(MinDistance) = 200; + GVAR(MaxDistance) = 2000; GVAR(DistanceInterval) = 5; discreteDistance[] = {}; discreteDistanceInitIndex = 0; diff --git a/addons/fcs/XEH_PREP.hpp b/addons/fcs/XEH_PREP.hpp new file mode 100644 index 0000000000..be505b95fe --- /dev/null +++ b/addons/fcs/XEH_PREP.hpp @@ -0,0 +1,16 @@ + +PREP(adjustRange); +PREP(calculateSolution); +PREP(canResetFCS); +PREP(canUseFCS); +PREP(canUseRangefinder); +PREP(firedEH); +PREP(getAngle); +PREP(getRange); +PREP(handleAirBurstAmmunitionPFH); +PREP(onForceUpdate); +PREP(keyDown); +PREP(keyUp); +PREP(reset); +PREP(updateRangeHUD); +PREP(vehicleInit); diff --git a/addons/fcs/XEH_postInit.sqf b/addons/fcs/XEH_postInit.sqf index 8a8b379318..25fd09ba8c 100644 --- a/addons/fcs/XEH_postInit.sqf +++ b/addons/fcs/XEH_postInit.sqf @@ -15,5 +15,9 @@ if (!hasInterface) exitWith {}; }; }] call EFUNC(common,addEventHandler); +// Register fire event handler +["firedPlayerVehicle", DFUNC(firedEH)] call EFUNC(common,addEventHandler); +["firedPlayerVehicleNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + // Register event for global updates -[QGVAR(forceUpdate), {ACE_player call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler); +[QGVAR(forceUpdate), {[ACE_player] call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler); diff --git a/addons/fcs/XEH_preInit.sqf b/addons/fcs/XEH_preInit.sqf index 2bcda4f464..a7feade1c3 100644 --- a/addons/fcs/XEH_preInit.sqf +++ b/addons/fcs/XEH_preInit.sqf @@ -2,19 +2,6 @@ ADDON = false; -PREP(adjustRange); -PREP(canResetFCS); -PREP(canUseFCS); -PREP(canUseRangefinder); -PREP(firedEH); -PREP(getAngle); -PREP(getRange); -PREP(handleAirBurstAmmunitionPFH); -PREP(onForceUpdate); -PREP(keyDown); -PREP(keyUp); -PREP(reset); -PREP(updateRangeHUD); -PREP(vehicleInit); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/fcs/XEH_preStart.sqf b/addons/fcs/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/fcs/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/fcs/functions/fnc_calculateSolution.sqf b/addons/fcs/functions/fnc_calculateSolution.sqf new file mode 100644 index 0000000000..9908832824 --- /dev/null +++ b/addons/fcs/functions/fnc_calculateSolution.sqf @@ -0,0 +1,74 @@ +/* + * Author: VKing + * Calculate FCS solution + * + * Arguments: + * 0: Vehicle + * 1: Turret + * 2: Target distance + * 3: Azimuth offset + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" +params ["_vehicle","_turret","_distance","_angleTarget"]; + +private _FCSMagazines = []; +private _FCSElevation = []; +private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); + +{ + private _magazine = _x; + private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); + + private _bulletSimulation = getText (configFile >> "CfgAmmo" >> _ammo >> "simulation"); + if !(_bulletSimulation == "shotMissile") then { + private _maxElev = getNumber (_turretConfig >> "maxElev"); + private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); + private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction"); + + { + private _weapon = _x; + private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); + private _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); + + { + if (_x != "this") then { + _weaponMagazines append getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); + }; + false + } count _muzzles; + + // Fix the `in` operator being case sensitive and BI fucking up the spelling of their own classnames + private _weaponMagazinesCheck = _weaponMagazines apply {toLower _x}; + + // Another BIS fix: ShotBullet simulation uses weapon initSpeed, others ignore it + if (toLower _magazine in _weaponMagazinesCheck && {_bulletSimulation == "shotBullet"}) exitWith { + private _initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed"); + + if (_initSpeedCoef < 0) then { + _initSpeed = _initSpeed * -_initSpeedCoef; + }; + + if (_initSpeedCoef > 0) then { + _initSpeed = _initSpeedCoef; + }; + }; + false + } count (_vehicle weaponsTurret _turret); + + private _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance]; + _offset = parseNumber _offset; + + _FCSMagazines pushBack _magazine; + _FCSElevation pushBack _offset; + }; + false +} count (_vehicle magazinesTurret _turret); + +[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic); diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 237aed8ac1..a9f4975780 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -1,9 +1,9 @@ /* * Author: KoffeinFlummi - * Adjusts the direction of a shell. + * Adjusts the direction of a shell. Called from the unified fired EH only if the gunner is a player. * * Arguments: - * -> arguments of the FiredBIS EH + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -12,13 +12,8 @@ */ #include "script_component.hpp" -params ["_vehicle", "_weapon", "", "", "_ammo", "_magazine", "_projectile"]; - -private _gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); -private _turret = _gunner call EFUNC(common,getTurretIndex); - -// Exit if the unit isn't a player -if !([_gunner] call EFUNC(common,isPlayer)) exitWith {}; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); private _FCSMagazines = _vehicle getVariable [format ["%1_%2", QGVAR(Magazines), _turret], []]; private _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret]; @@ -36,7 +31,7 @@ private _offset = 0; [_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection); -// Remove the platform velocity +// Remove the platform velocity if (vectorMagnitude velocity _vehicle > 2) then { private _sumVelocity = (velocity _projectile) vectorDiff (velocity _vehicle); diff --git a/addons/fcs/functions/fnc_getRange.sqf b/addons/fcs/functions/fnc_getRange.sqf index 51cdf564df..64619241c4 100644 --- a/addons/fcs/functions/fnc_getRange.sqf +++ b/addons/fcs/functions/fnc_getRange.sqf @@ -3,7 +3,10 @@ * Read laser distance measurement from engine. * * Argument: - * None + * 0: Measurement Accuracy (default: 1) + * 1: Maximum measure distance (default: 5000) + * 2: Minimum measure distance (default: 0) + * 3: Blank display on range error (default: false) * * Return value: * Measured distance @@ -12,7 +15,34 @@ */ #include "script_component.hpp" +params [["_accuracy",1], ["_maxDistance",5000], ["_minDistance",0], ["_blank",false]]; + disableSerialization; private _dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]; -parseNumber ctrlText (_dlgRangefinder displayCtrl 151); +private _distance = parseNumber ctrlText (_dlgRangefinder displayCtrl 151); + +if (_distance == 0) then { + _distance = _this call EFUNC(common,getTargetDistance); +} else { + // Is distance out of bound? + _distance = _distance min _maxDistance; + _distance = _distance max _minDistance; + + // If don't let accuracy be less than 1 + _accuracy = _accuracy max 1; + _distance = (round (_distance/_accuracy)) * _accuracy; +}; + +// Change the display if the range is out of bounds +if (_distance >= _maxDistance || _distance <= _minDistance) then { + if (_blank) then { + (_dlgRangefinder displayCtrl 1713151) ctrlSetText "----"; + } else { + (_dlgRangefinder displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber) + "*"; + }; +} else { + (_dlgRangefinder displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber); +}; + +_distance diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index a34233bc91..e61baed136 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -15,17 +15,22 @@ params ["_vehicle", "_turret"]; -private _distance = call FUNC(getRange); -call (updateRangeHUD); +private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); + +// Update display for infantry rangefinders +if (_vehicle == ACE_player) exitWith {[5,5500,25,true] call FUNC(getRange)}; + +private _distance = [ + getNumber (_turretConfig >> QGVAR(DistanceInterval)), + getNumber (_turretConfig >> QGVAR(MaxDistance)), + getNumber (_turretConfig >> QGVAR(MinDistance)) +] call FUNC(getRange); if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {}; GVAR(Enabled) = true; GVAR(time) = ACE_time; -if (_distance == 0) then { - _distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision -}; private _weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets @@ -38,3 +43,5 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr }; GVAR(Position) = (getPosASL _vehicle) vectorAdd (_weaponDirection vectorMultiply _distance); + +[_vehicle,_turret,_distance,0] call FUNC(calculateSolution); diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index ebbd6e3a06..919ac3a58e 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -17,20 +17,15 @@ params ["_vehicle", "_turret", "_distance", ["_showHint", false], ["_playSound", private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); -call (updateRangeHUD); - if (isNil "_distance") then { - _distance = call FUNC(getRange); - - if (_distance == 0) then { - _distance = [ - getNumber (_turretConfig >> QGVAR(DistanceInterval)), - getNumber (_turretConfig >> QGVAR(MaxDistance)), - getNumber (_turretConfig >> QGVAR(MinDistance)) - ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision - }; + _distance = [ + getNumber (_turretConfig >> QGVAR(DistanceInterval)), + getNumber (_turretConfig >> QGVAR(MaxDistance)), + getNumber (_turretConfig >> QGVAR(MinDistance)) + ] call FUNC(getRange); }; +// MOVING TARGETS private _weapon = _vehicle currentWeaponTurret _turret; private _weaponDirection = _vehicle weaponDirection _weapon; // @todo doesn't work for sub turrets @@ -44,7 +39,6 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr private _angleTarget = asin (_weaponDirection select 2); -// MOVING TARGETS private _movingAzimuth = 0; if (ACE_time - GVAR(time) > 1 && GVAR(time) != -1 && isNil {_this select 2}) then { @@ -60,13 +54,17 @@ if (ACE_time - GVAR(time) > 1 && GVAR(time) != -1 && isNil {_this select 2}) the private _timeToLive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "timeToLive"); private _simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammo >> "simulationStep"); private _initSpeedCoef = getNumber (configFile >> "CfgWeapons" >> _weapon >> "initSpeed"); + private _simulationType = getText (configFile >> "CfgAmmo" >> _ammo >> "simulation"); - if (_initSpeedCoef < 0) then { - _initSpeed = _initSpeed * - _initSpeedCoef; - }; + // More BIS fix + if (_simulationType == "shotBullet") then { + if (_initSpeedCoef < 0) then { + _initSpeed = _initSpeed * - _initSpeedCoef; + }; - if (_initSpeedCoef > 0) then { - _initSpeed = _initSpeedCoef; + if (_initSpeedCoef > 0) then { + _initSpeed = _initSpeedCoef; + }; }; if (_simulationStep != 0) then { @@ -109,61 +107,11 @@ if (_viewDiff != 0) then { _FCSAzimuth = (atan (_distance / _viewDiff) - (abs _viewDiff / _viewDiff) * 90) + _movingAzimuth; }; -// CALCULATE OFFSET -private _FCSMagazines = []; -private _FCSElevation = []; - -{ - private _magazine = _x; - private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); - - if !(getText (configFile >> "CfgAmmo" >> _ammo >> "simulation") == "shotMissile") then { - private _maxElev = getNumber (_turretConfig >> "maxElev"); - private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); - private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction"); - - { - private ["_weapon", "_muzzles", "_weaponMagazines", "_muzzleMagazines"]; - _weapon = _x; - _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); - _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); - - { - if (_x != "this") then { - _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); - _weaponMagazines append _muzzleMagazines; - }; - false - } count _muzzles; - - if (_magazine in _weaponMagazines) exitWith { - _initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed"); - - if (_initSpeedCoef < 0) then { - _initSpeed = _initSpeed * -_initSpeedCoef; - }; - - if (_initSpeedCoef > 0) then { - _initSpeed = _initSpeedCoef; - }; - }; - false - } count (_vehicle weaponsTurret _turret); - - private _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance]; - _offset = parseNumber _offset; - - _FCSMagazines pushBack _magazine; - _FCSElevation pushBack _offset; - }; - false -} count (_vehicle magazinesTurret _turret); - -[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic); -[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic); -[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic); [_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth] call EFUNC(common,setVariablePublic); +// CALCULATE SOLUTION +[_vehicle,_turret,_distance,_angleTarget] call FUNC(calculateSolution); + if (_playSound) then { playSound "ACE_Sound_Click"; }; @@ -171,11 +119,3 @@ if (_playSound) then { if (_showHint) then { [format ["%1: %2", localize LSTRING(ZeroedTo), _distance]] call EFUNC(common,displayTextStructured); }; - -//Update the hud's distance display to the new value or "----" if out of range -//(10m fudge because of EFUNC(common,getTargetDistance)) -if (_distance + 10 >= getNumber (_turretConfig >> QGVAR(MaxDistance))) then { - ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText "----"; -} else { - ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber); -}; diff --git a/addons/fcs/functions/fnc_onForceUpdate.sqf b/addons/fcs/functions/fnc_onForceUpdate.sqf index 005a0d7801..1bf1f0d701 100644 --- a/addons/fcs/functions/fnc_onForceUpdate.sqf +++ b/addons/fcs/functions/fnc_onForceUpdate.sqf @@ -7,7 +7,7 @@ private _vehicle = vehicle _unit; if !([_unit, _vehicle, []] call EFUNC(common,canInteractWith)) exitWith {false}; if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; -private _turret = _unit call EFUNC(common,getTurretIndex); +private _turret = [_unit] call EFUNC(common,getTurretIndex); -[_vehicle, _turret, -1, false] call FUNC(keyDown); -[_vehicle, _turret, -1, false, false] call FUNC(keyUp); +[_vehicle, _turret] call FUNC(keyDown); +[_vehicle, _turret] call FUNC(keyUp); diff --git a/addons/fcs/script_component.hpp b/addons/fcs/script_component.hpp index 8ada0f7a71..e3f9181526 100644 --- a/addons/fcs/script_component.hpp +++ b/addons/fcs/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT fcs #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FCS #define DEBUG_MODE_FULL #endif diff --git a/addons/fcs/stringtable.xml b/addons/fcs/stringtable.xml index 4970f9b10e..035d9d7a36 100644 --- a/addons/fcs/stringtable.xml +++ b/addons/fcs/stringtable.xml @@ -30,7 +30,7 @@ Entfernung des FLS erhöhen Zwiększ zasięg SKO Ajustar distancia del FCS (arriba) - Nastavit FCS Náměr (nahoru) + Nastavit FCS Náměr (Nahoru) Augmenter la distance du SCT FCS tartomány állítása (Fel) Ajustar distância do FCS (Acima) @@ -42,7 +42,7 @@ Entfernung des FLS verringern Zmniejsz zasięg SKO Ajustar distancia del FCS (abajo) - Nastavit FCS Náměr (dolů) + Nastavit FCS Náměr (Dolů) Réduire la distance du SCT FCS tartomány állítása (Le) Ajustar distância do FCS (Abaixo) @@ -74,4 +74,4 @@ СУО обнулен. - + \ No newline at end of file diff --git a/addons/finger/CfgEventHandlers.hpp b/addons/finger/CfgEventHandlers.hpp index 917a0acbd7..becf395052 100644 --- a/addons/finger/CfgEventHandlers.hpp +++ b/addons/finger/CfgEventHandlers.hpp @@ -1,8 +1,16 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + 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/finger/XEH_PREP.hpp b/addons/finger/XEH_PREP.hpp new file mode 100644 index 0000000000..6965917bd8 --- /dev/null +++ b/addons/finger/XEH_PREP.hpp @@ -0,0 +1,5 @@ + +PREP(incomingFinger); +PREP(keyPress); +PREP(moduleSettings); +PREP(perFrameEH); diff --git a/addons/finger/XEH_preInit.sqf b/addons/finger/XEH_preInit.sqf index e7e68cf8ec..a7feade1c3 100644 --- a/addons/finger/XEH_preInit.sqf +++ b/addons/finger/XEH_preInit.sqf @@ -2,9 +2,6 @@ ADDON = false; -PREP(incomingFinger); -PREP(keyPress); -PREP(moduleSettings); -PREP(perFrameEH); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/finger/XEH_preStart.sqf b/addons/finger/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/finger/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/finger/script_component.hpp b/addons/finger/script_component.hpp index ae96943943..edaf93a942 100644 --- a/addons/finger/script_component.hpp +++ b/addons/finger/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT finger #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FINGER #define DEBUG_MODE_FULL #endif diff --git a/addons/finger/stringtable.xml b/addons/finger/stringtable.xml index 1a11bf246a..e5cd57eaf9 100644 --- a/addons/finger/stringtable.xml +++ b/addons/finger/stringtable.xml @@ -1,62 +1,82 @@ - + Show pointing indicator to self + Zeigersymbol einem selbst anzeigen Индикатор пальца для показывающего 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 + Zobrazit ukázání směru pro sebe + Mostra puntatore per te stesso Render the indicator for the pointing player. This option doesn't affect whether the other players would see the indicator + Zeigt das eigene Zeigersymbol an. Diese Einstellung beeinflusst jedoch nicht andere Spieler, welche das Zeigersymbol sehen können. Отображать индикатор указания пальцем для показывающего игрока. Эта настройка не влияет на то, будут ли другие игроки видеть индикатор 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 + Zobrazit infikátor, když ukážete prstem. Tato volba nemá vliv, zda ostatní hráči uvidí indikátor nebo ne. + Mostra puntatore per il giocatore indicato. Questa opzione non influisce la possibilità che gli altri giocatori vedano il puntatore Pointing indicator + Zeigersymbol Индикатор указания пальцем Indicateur de pointage Indykator palca Ujj-indikátor Indicador de apontamento Indicador de señalado + Ukazování směru + Indicatore di puntamento Color of the pointing indicator circle + Farbe des Zeigersymbols (Kreis) + Farbe des Zeigersymbols Цвет индикатора указания пальцем 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 + Barva kruhu pro ukázání směru + Colore del cerchio dell'indicatore di puntamento Action "point a finger at" + Aktion: "Zeige Finger auf" Действие "показать пальцем на" 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" + Akce "ukázat prstem na" + Azione "punta il dito a" Points, and shows a virtual marker of where you are looking to nearby units. Can be held down. + Zeigt in der Nähe befindlichen Spielern die eigene Blickrichtung mit Hilfe eines Kreissymbols an. 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. + Ukazuje virtuální značku kruhu ve směru, kterým se díváte pro všechny blízké jednotky. + Punta e mostra un marker virtuale di dove stai guardando alle unità vicine. Può essere tenuto premuto. Pointing Settings + Zeigen Einstellungen Option "Montrer du doigt" Ustawienia wskazywania palcem Ujj beállításai @@ -64,9 +84,11 @@ Настройки указания пальцем Ajustes de señalado Nastavení ukázování směru + Impostazioni puntamento Pointing Enabled + Zeigen aktiviert Activer "Montrer du doigt" Aktywuj wskazywanie Mutatás engedélyezése @@ -74,9 +96,11 @@ Указание пальцем включено Señalado habilitado Ukazování povoleno + Puntamento abilitato Pointing Max Range + Maximale Zeigerreichweite Distance maximale du pointage Maks. zasięg wskazywania Ujj maximum hatótávja @@ -84,9 +108,11 @@ Макс. дальность Distancia máxima de señalado Maximální dosah pro ukazování směru + Raggio massimo puntamento Max range between players to show the pointing indicator [default: 4 meters] + Maximale Reichweite zwischen Spielern, welche das Zeigesymbol des jeweils anderen sehen können. (Standart: 4 Meter) 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] @@ -94,6 +120,7 @@ Максимальная дальность между игроками для отображения индикатора указания пальцем [по-умолчанию: 4 метра] Distancia máxima entre los jugadores para mostrar el indicador que señala [por defecto: 4 metros] Maximální vzdálenost mezi hráči pro ukázání směru [výchozí: 4 metry] + Distanza massima tra giocatori per mostrare l'indicatore di puntamento [default: 4 metri] - \ No newline at end of file + diff --git a/addons/flashlights/CfgEventHandlers.hpp b/addons/flashlights/CfgEventHandlers.hpp index d5f49bd5c3..30381d7200 100644 --- a/addons/flashlights/CfgEventHandlers.hpp +++ b/addons/flashlights/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PostInit_EventHandlers { class ADDON { clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) ); diff --git a/addons/flashlights/script_component.hpp b/addons/flashlights/script_component.hpp index ba740c22fc..90a91c3b72 100644 --- a/addons/flashlights/script_component.hpp +++ b/addons/flashlights/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT flashlights #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FLASHLIGHTS #define DEBUG_MODE_FULL #endif diff --git a/addons/flashlights/stringtable.xml b/addons/flashlights/stringtable.xml index bc6908ab97..46d88a4313 100644 --- a/addons/flashlights/stringtable.xml +++ b/addons/flashlights/stringtable.xml @@ -1,53 +1,65 @@ - + Fulton MX-991 + Fulton MX-991 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. + Taschenlampe mit rotem Filter zum Kartenlesen. 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. + Torcia con filtro rosso. Da usare in mappa. Maglite XL50 + Maglite XL50 Maglite XL50 Maglite XL50 Maglite XL50 Maglite XL50 Maglite XL50 + Maglite XL50 White mini flashlight. For use on map. + Mini-Taschenlampe mit weißem Licht zum Kartenlesen. 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. + Mini-torcia bianca. Da usare in mappa. KSF-1 + KSF-1 KSF-1 KSF-1 KSF-1 KSF-1 KSF-1 + KSF-1 Flashlight with red filter. For use on map. + Tachenlampe mit rotem Filter zum Kartenlesen. 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. + Torcia con filtro rosso. Da usare in mappa. diff --git a/addons/flashsuppressors/CfgWeapons.hpp b/addons/flashsuppressors/CfgWeapons.hpp index 198fec7316..ae957ba4b0 100644 --- a/addons/flashsuppressors/CfgWeapons.hpp +++ b/addons/flashsuppressors/CfgWeapons.hpp @@ -1,3 +1,34 @@ +class asdg_MuzzleSlot; +class asdg_MuzzleSlot_338: asdg_MuzzleSlot { // for .338 universal mount suppressors + class compatibleItems { + ACE_muzzle_mzls_338 = 1; + }; +}; +class asdg_MuzzleSlot_762: asdg_MuzzleSlot { // for 7.62x51 universal mount suppressors + class compatibleItems { + ACE_muzzle_mzls_B = 1; + }; +}; +class asdg_MuzzleSlot_93x64: asdg_MuzzleSlot { // for 9.3x64 universal mount suppressors + class compatibleItems { + ACE_muzzle_mzls_93mmg = 1; + }; +}; +class asdg_MuzzleSlot_9MM_SMG: asdg_MuzzleSlot { // for 9x19mm universal mount SMG suppressors + class compatibleItems { + ACE_muzzle_mzls_smg_02 = 1; + }; +}; +class asdg_MuzzleSlot_556: asdg_MuzzleSlot { // for 5.56x45 universal mount suppressors + class compatibleItems { + ACE_muzzle_mzls_L = 1; + }; +}; +class asdg_MuzzleSlot_45ACP_SMG: asdg_MuzzleSlot { // for .45ACP universal mount SMG suppressors + class compatibleItems { + ACE_muzzle_mzls_smg_01 = 1; + }; +}; class MuzzleSlot; @@ -46,14 +77,6 @@ class CfgWeapons { class WeaponSlotsInfo; }; - class EBR_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_B"}; - }; - }; - }; - class DMR_01_base_F: Rifle_Long_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { class MuzzleSlot: MuzzleSlot { @@ -62,54 +85,6 @@ class CfgWeapons { }; }; - class DMR_02_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_338"}; - }; - }; - }; - - class DMR_03_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_B"}; - }; - }; - }; - - class DMR_05_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_93mmg"}; - }; - }; - }; - - class DMR_06_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_B"}; - }; - }; - }; - - class MMG_01_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_93mmg"}; - }; - }; - }; - - class MMG_02_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_338"}; - }; - }; - }; - class LMG_Mk200_F: Rifle_Long_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { class MuzzleSlot: MuzzleSlot { @@ -126,53 +101,6 @@ class CfgWeapons { }; }; - - /* Assault Rifles */ - - class Tavor_base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_L"}; - }; - }; - }; - - class mk20_base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_L"}; - }; - }; - }; - - - /* SMGs */ - - class pdw2000_base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; - }; - }; - }; - - class SMG_01_Base: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_smg_01"}; - }; - }; - }; - - class SMG_02_base_F: Rifle_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; - }; - }; - }; - - /* Pistols */ class Pistol; diff --git a/addons/flashsuppressors/script_component.hpp b/addons/flashsuppressors/script_component.hpp index bb1a7c8f0c..cb61bb6007 100644 --- a/addons/flashsuppressors/script_component.hpp +++ b/addons/flashsuppressors/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT flashsuppressors #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FLASHSUPPRESSORS #define DEBUG_MODE_FULL #endif diff --git a/addons/flashsuppressors/stringtable.xml b/addons/flashsuppressors/stringtable.xml index f075f1aa34..5f6a0ebc86 100644 --- a/addons/flashsuppressors/stringtable.xml +++ b/addons/flashsuppressors/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/fonts/script_component.hpp b/addons/fonts/script_component.hpp index a8029b7105..3a7589b72a 100644 --- a/addons/fonts/script_component.hpp +++ b/addons/fonts/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT fonts #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FONTS #define DEBUG_MODE_FULL #endif diff --git a/addons/frag/ACE_Settings.hpp b/addons/frag/ACE_Settings.hpp index 84bba326f0..3e1c83839b 100644 --- a/addons/frag/ACE_Settings.hpp +++ b/addons/frag/ACE_Settings.hpp @@ -1,30 +1,42 @@ class ACE_Settings { class GVAR(Enabled) { + category = CSTRING(Module_DisplayName); displayName = CSTRING(EnableFrag); description = CSTRING(EnableFrag_Desc); typeName = "BOOL"; value = 1; }; class GVAR(SpallEnabled) { + category = CSTRING(Module_DisplayName); displayName = CSTRING(EnableSpall); description = CSTRING(EnableSpall_Desc); typeName = "BOOL"; value = 0; }; + class GVAR(ReflectionsEnabled) { + category = CSTRING(Module_DisplayName); + displayName = CSTRING(EnableReflections); + description = CSTRING(EnableReflections_Desc); + typeName = "BOOL"; + value = 0; + }; class GVAR(maxTrack) { + category = CSTRING(Module_DisplayName); displayName = CSTRING(MaxTrack); description = CSTRING(MaxTrack_Desc); typeName = "SCALAR"; value = 500; }; class GVAR(MaxTrackPerFrame) { + category = CSTRING(Module_DisplayName); displayName = CSTRING(MaxTrackPerFrame); description = CSTRING(MaxTrackPerFrame_Desc); typeName = "SCALAR"; value = 50; }; - + class GVAR(EnableDebugTrace) { + category = CSTRING(Module_DisplayName); displayName = CSTRING(EnableDebugTrace); description = CSTRING(EnableDebugTrace_Desc); typeName = "BOOL"; diff --git a/addons/frag/CfgEventhandlers.hpp b/addons/frag/CfgEventhandlers.hpp index df7eaeacd1..415e205fba 100644 --- a/addons/frag/CfgEventhandlers.hpp +++ b/addons/frag/CfgEventhandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -9,9 +16,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class AllVehicles { - ADDON = QUOTE(_this call FUNC(fired)); - }; -}; diff --git a/addons/frag/XEH_PREP.hpp b/addons/frag/XEH_PREP.hpp new file mode 100644 index 0000000000..926cbaab0c --- /dev/null +++ b/addons/frag/XEH_PREP.hpp @@ -0,0 +1,27 @@ + +PREP(doSpall); +PREP(fired); +PREP(frago); +PREP(spallTrack); + +// * Other */ +PREP(addBlackList); +PREP(addTrack); +PREP(drawTraces); +PREP(removeTrack); +PREP(spallHP); +PREP(startTracing); +PREP(stopTracing); +PREP(trackTrace); + +// New tracking mechanisms +PREP(masterPFH); +PREP(pfhRound); +PREP(addPfhRound); +PREP(removePfhRound); // THIS SHOULD ABE USED SPARINGLY + +// Explosive Reflection +GVAR(replacedBisArtyWrapper) = true; +PREP(findReflections); +PREP(doExplosions); +PREP(doReflections); diff --git a/addons/frag/XEH_postInit.sqf b/addons/frag/XEH_postInit.sqf index af3464c2b6..977866e24e 100644 --- a/addons/frag/XEH_postInit.sqf +++ b/addons/frag/XEH_postInit.sqf @@ -9,4 +9,22 @@ if(isServer) then { [QGVAR(frag_eh), { _this call FUNC(frago); }] call EFUNC(common,addEventHandler); }; -[FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; \ No newline at end of file +["SettingsInitialized", { + //If not enabled, exit + if (!GVAR(enabled)) exitWith {}; + + // Register fire event handler + ["firedPlayer", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedPlayerNonLocal", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedNonPlayer", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedPlayerVehicle", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedPlayerVehicleNonLocal", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedNonPlayerVehicle", DFUNC(fired)] call EFUNC(common,addEventHandler); + + [FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; + +}] call EFUNC(common,addEventHandler); + +//Cache for ammo type configs +GVAR(cacheRoundsTypesToTrack) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; +GVAR(cacheRoundsTypesToTrack) setText QGVAR(cacheRoundsTypesToTrack); diff --git a/addons/frag/XEH_preInit.sqf b/addons/frag/XEH_preInit.sqf index cdd9342ffd..1de9a467eb 100644 --- a/addons/frag/XEH_preInit.sqf +++ b/addons/frag/XEH_preInit.sqf @@ -2,10 +2,7 @@ ADDON = false; -PREP(doSpall); -PREP(fired); -PREP(frago); -PREP(spallTrack); +#include "XEH_PREP.hpp" GVAR(blackList) = []; GVAR(traceFrags) = false; @@ -20,29 +17,6 @@ GVAR(traceID) = -1; GVAR(traces) = []; GVAR(tracesStarted) = false; -// * Other Shit */ -PREP(addBlackList); -PREP(addTrack); -PREP(drawTraces); -PREP(removeTrack); -PREP(spallHP); -PREP(startTracing); -PREP(stopTracing); -PREP(trackTrace); - -// New tracking mechanisms -PREP(masterPFH); -PREP(pfhRound); -PREP(addPfhRound); -PREP(removePfhRound); // THIS SHOULD ABE USED SPARINGLY - -// Explosive Reflection -GVAR(replacedBisArtyWrapper) = true; -PREP(findReflections); -PREP(doExplosions); -PREP(doReflections); - - GVAR(lastIterationIndex) = 0; GVAR(objects) = []; GVAR(objectTypes) = []; diff --git a/addons/frag/XEH_preStart.sqf b/addons/frag/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/frag/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/frag/functions/fnc_findReflections.sqf b/addons/frag/functions/fnc_findReflections.sqf index 7f8fd2a13c..5e069ddd58 100644 --- a/addons/frag/functions/fnc_findReflections.sqf +++ b/addons/frag/functions/fnc_findReflections.sqf @@ -3,6 +3,7 @@ private ["_split", "_radi", "_params", "_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_indirectHitRange", "_indirectHit", "_distanceCount", "_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos", "_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp", "_rand", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec", "_zAng"]; +BEGIN_COUNTER(fnc_findReflections); _params = _this select 0; _pos = _params select 0; _explosiveInfo = _params select 1; @@ -124,3 +125,4 @@ if(_zIndex < 5) then { [DFUNC(doExplosions), 0, [_explosions, 0]] call CBA_fnc_addPerFrameHandler; [(_this select 1)] call CBA_fnc_removePerFrameHandler; }; +END_COUNTER(fnc_findReflections); diff --git a/addons/frag/functions/fnc_fired.sqf b/addons/frag/functions/fnc_fired.sqf index 693b85eb3d..dbe1ab6347 100644 --- a/addons/frag/functions/fnc_fired.sqf +++ b/addons/frag/functions/fnc_fired.sqf @@ -1,8 +1,55 @@ +/* + * Author: nou, jaynus, PabstMirror + * Called from the unified fired EH for all. + * If spall is not enabled (default), then cache and only track those that will actually trigger fragmentation. + * + * Arguments: + * None. Parameters inherited from EFUNC(common,firedEH) + * + * Return Value: + * Nothing + * + * Example: + * [clientFiredBIS-XEH] call ace_frag_fnc_fired + * + * Public: No + */ +// #define DEBUG_ENABLED_FRAG #include "script_component.hpp" -private["_gun", "_type", "_round"]; -_gun = _this select 0; -_type = _this select 4; -_round = _this select 6; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -[_gun, _type, _round] call FUNC(addPfhRound); +private _shouldAdd = GVAR(cacheRoundsTypesToTrack) getVariable _ammo; +if (isNil "_shouldAdd") then { + TRACE_1("no cache for round",_ammo); + + if (!EGVAR(common,settingsInitFinished)) exitWith { + //Just incase fired event happens before settings init, don't want to set cache wrong if spall setting changes + TRACE_1("Settings not init yet - exit without setting cache",_ammo); + _shouldAdd = false; + }; + + if (GVAR(SpallEnabled)) exitWith { + //Always want to run whenever spall is enabled? + _shouldAdd = true; + TRACE_2("SettingCache[spallEnabled]",_ammo,_shouldAdd); + GVAR(cacheRoundsTypesToTrack) setVariable [_ammo, _shouldAdd]; + }; + + //Read configs and test if it would actually cause a frag, using same logic as FUNC(pfhRound) + private _skip = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(skip)); + private _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive"); + private _indirectRange = getNumber (configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange"); + private _force = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(force)); + private _fragPower = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirecthit")*(sqrt((getNumber (configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange")))); + + _shouldAdd = (_skip == 0) && {(_force == 1) || {_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}}}; + TRACE_6("SettingCache[willFrag?]",_skip,_explosive,_indirectRange,_force,_fragPower,_shouldAdd); + GVAR(cacheRoundsTypesToTrack) setVariable [_ammo, _shouldAdd]; +}; + +if (_shouldAdd) then { + TRACE_3("Running Frag Tracking",_unit,_ammo,_projectile); + [_unit, _ammo, _projectile] call FUNC(addPfhRound); +}; diff --git a/addons/frag/functions/fnc_frago.sqf b/addons/frag/functions/fnc_frago.sqf index 3507a7ab6e..8c72ae8bac 100644 --- a/addons/frag/functions/fnc_frago.sqf +++ b/addons/frag/functions/fnc_frago.sqf @@ -8,6 +8,7 @@ if(!isServer) exitWith { }; +BEGIN_COUNTER(frago); // _startTime = ACE_diagTime; private ["_startTime", "_round", "_lastPos", "_lastVel", "_shellType", "_gun", "_fragTypes", "_warn", "_atlPos", "_isArmed", "_fuseDist", "_indirectHitRange", "_fragRange", "_c", "_m", "_k", "_gC", "_fragPower", "_fragPowerRandom", "_manObjects", "_objects", "_crew", "_fragCount", "_fragArcs", "_doRandom", "_boundingBox", "_targetPos", "_distance", "_add", "_bbX", "_bbY", "_bbZ", "_cubic", "_targetVel", "_baseVec", "_dir", "_currentCount", "_count", "_vecVar", "_vec", "_fp", "_vel", "_fragType", "_fragObj", "_randomCount", "_sectorSize", "_sectorOffset", "_i", "_randomDir", "_endTime", "_target"]; @@ -108,7 +109,9 @@ _fragArcs set[360, 0]; #endif _doRandom = true; if(_isArmed && (count _objects) > 0) then { - [_lastPos, _shellType] call FUNC(doReflections); + if (GVAR(ReflectionsEnabled)) then { + [_lastPos, _shellType] call FUNC(doReflections); + }; { //if(random(1) > 0.5) then { _target = _x; @@ -212,3 +215,4 @@ if(_isArmed && (count _objects) > 0) then { // ACE_player sideChat format["tracks: %1", (count GVAR(trackedObjects))]; // #endif // _endTime = ACE_diagTime; +END_COUNTER(frago); \ No newline at end of file diff --git a/addons/frag/script_component.hpp b/addons/frag/script_component.hpp index 78e13c7863..1faa440294 100644 --- a/addons/frag/script_component.hpp +++ b/addons/frag/script_component.hpp @@ -2,6 +2,10 @@ #include "\z\ace\addons\main\script_mod.hpp" //#define DEBUG_ENABLED_FRAG +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_FRAG #define DEBUG_MODE_FULL diff --git a/addons/frag/stringtable.xml b/addons/frag/stringtable.xml index bba8f1dae9..9fb2c26f04 100644 --- a/addons/frag/stringtable.xml +++ b/addons/frag/stringtable.xml @@ -1,27 +1,41 @@ + + Fragmentation Simulation + Symulacja fragmentacji + Simulación de fragmentación + Splittersimulation + Simulace fragmentů + Simulação de fragmentação + Simulation de la fragmentation + Repesz-szimuláció + Симуляция осколков + Simulazione Frammentazione + Fragmentation Simulation Symulacja fragmentacji Simulación de fragmentación Splittersimulation - Simulace fragmentace + Simulace fragmentů Simulação de fragmentação Simulation de la fragmentation Repesz-szimuláció Симуляция осколков + Simulazione Frammentazione Enable the ACE Fragmentation Simulation Activa la simulación de fragmentación ACE Aktywuje symulację fragmentacji ACE Aktiviere die ACE-Splittersimulation - Povolit ACE simulaci fragmentace + Povolit ACE simulaci fragmentů 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 + Abilita la Simulazione Frammentazione di ACE Spalling Simulation @@ -33,6 +47,7 @@ Simulation d'éclat Pattogzás-szimuláció Симуляция обломков + Simulazione Spalling Enable the ACE Spalling Simulation @@ -44,6 +59,17 @@ Active la simulation d'éclat ACE Az ACE pattogzás-szimuláció engedélyezése Включить симуляцию обломков ACE + Abilita la Simulazione Spalling di ACE + + + Explosion Reflections Simulation + Symulacja odbicia eksplozji + Simulazione Riflessi Esplosioni + + + Enable the ACE Explosion Reflection Simulation + Włącz symulację odbicia eksplozji ACE + Abilita la Simulazione Riflessi Esplosioni di ACE Maximum Projectiles Tracked @@ -55,6 +81,7 @@ Nombre maximum de projectile suivis Maximum követett repeszek Макс. количество отслеживаемых снарядов + Numero massimo di Proiettili Tracciati 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) @@ -66,17 +93,19 @@ 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 одновременно летящих снарядов) + Questo parametro controlla il numero massimo di proiettili che la frammentazione e il sistema di spalling tracciano in ogni momento. Se più proiettili sono sparati, non verranno tracciati. Abbassa questo parametro se non vuoi cali di FPS in scenari con molti proiettili (>200 proiettili in aria contemporaneamente) Maximum Projectiles Per Frame Máximos proyectiles por cuadro Maximale Anzahl an Projektilen pro Frame Maks. liczba pocisków na klatkę - Maximální počet projektilů ze jeden snímek + Maximální počet projektilů za jeden snímek Projéteis máximos por quadro Nombre maximal de projectile par image Maximum repesz/képkocka Макс. количество снарядов за кадр + Numero massimo di proiettili per Frame 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. @@ -88,6 +117,7 @@ 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. + Il numero di calcoli per tracciamento di spalling ad ogni frame. Questo aiuta a distribuire l'impatto del tracciamento dello spalling su più frame, limitando ancora di più l'impatto. (SP Only) Frag/Spall Debug Tracing @@ -99,6 +129,7 @@ (SP uniquement) Fragmentation/éclat debug (Csak SP) Repesz/Pattogzás debug követés (Только для одиночной игры) Отслеживаение/отладка осколков + (Solo SP) Debug Tracciamento Frag/Spall (SP Only) Requires a mission/editor restart. Enables visual tracing of fragmentation and spalling rounds in SP game mode only. @@ -110,6 +141,7 @@ (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. (Только для одиночной игры) Требует перезапуска миссии/редактора. Включает визуальные следы от осколков и обломков в режиме одиночной игры. + (Solo SP) Richiede un restart editor/missione. Abilita il tracciamento visivo di schegge da frammentazione/spalling in modalità Giocatore Singolo. diff --git a/addons/gestures/CfgEventHandlers.hpp b/addons/gestures/CfgEventHandlers.hpp index 7b003bbe8c..e2b5ef729b 100644 --- a/addons/gestures/CfgEventHandlers.hpp +++ b/addons/gestures/CfgEventHandlers.hpp @@ -1,6 +1,13 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; @@ -9,3 +16,9 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_DisplayLoad_EventHandlers { + class RscDisplayMission { + ADDON = QUOTE(_this call COMPILE_FILE(XEH_mainDislayLoad)); + }; +}; diff --git a/addons/gestures/CfgVehicles.hpp b/addons/gestures/CfgVehicles.hpp index 6ada84c736..d3c7b5ca21 100644 --- a/addons/gestures/CfgVehicles.hpp +++ b/addons/gestures/CfgVehicles.hpp @@ -127,7 +127,7 @@ class CfgVehicles { }; class class GVAR(Hi) { - displayName = CSTRING(Gestures_Hi); + displayName = CSTRING(Hi); condition = QUOTE(canStand _target); statement = QUOTE(_target playActionNow ([ARR_3('gestureHi','gestureHiB','gestureHiC')] select floor random 3);); showDisabled = 1; diff --git a/addons/gestures/XEH_PREP.hpp b/addons/gestures/XEH_PREP.hpp new file mode 100644 index 0000000000..dba0c4d0cc --- /dev/null +++ b/addons/gestures/XEH_PREP.hpp @@ -0,0 +1,2 @@ + +PREP(playSignal); diff --git a/addons/gestures/XEH_mainDislayLoad.sqf b/addons/gestures/XEH_mainDislayLoad.sqf new file mode 100644 index 0000000000..4b5c2ca63b --- /dev/null +++ b/addons/gestures/XEH_mainDislayLoad.sqf @@ -0,0 +1,35 @@ +#include "script_component.hpp" + +disableSerialization; + +params ["_display"]; + +// reload mutex, you can't play signal while reloading +GVAR(ReloadMutex) = true; + +_display displayAddEventHandler ["KeyDown", { + if ((_this select 1) in actionKeys "ReloadMagazine") then { + if (isNull ACE_player || {!alive ACE_player}) exitWith {false}; + + private _weapon = currentWeapon ACE_player; + + if (_weapon != "") then { + GVAR(ReloadMutex) = false; + + private _gesture = getText (configfile >> "CfgWeapons" >> _weapon >> "reloadAction"); + private _isLauncher = _weapon isKindOf ["Launcher", configFile >> "CfgWeapons"]; + private _config = ["CfgGesturesMale", "CfgMovesMaleSdr"] select _isLauncher; + private _duration = getNumber (configfile >> _config >> "States" >> _gesture >> "speed"); + + if (_duration != 0) then { + _duration = if (_duration < 0) then { abs _duration } else { 1 / _duration }; + } else { + _duration = 3; + }; + + TRACE_2("Reloading, blocking gestures",_weapon,_duration); + [{GVAR(ReloadMutex) = true;}, [], _duration] call EFUNC(common,waitAndExecute); + }; + }; + false +}]; diff --git a/addons/gestures/XEH_postInit.sqf b/addons/gestures/XEH_postInit.sqf index fec57ab111..d9cfc74e04 100644 --- a/addons/gestures/XEH_postInit.sqf +++ b/addons/gestures/XEH_postInit.sqf @@ -3,36 +3,3 @@ if (!hasInterface) exitWith {}; #include "key.sqf" - -// reload mutex, you can't play signal while reloading -GVAR(ReloadMutex) = true; - -// Event for main display to be loaded: -["mainDisplayLoaded", { - // handle reloading - (findDisplay 46) displayAddEventHandler ["KeyDown", { - if ((_this select 1) in actionKeys "ReloadMagazine") then { - if ((isNull ACE_player) || {!alive ACE_player}) exitWith {false}; - private _weapon = currentWeapon ACE_player; - - if (_weapon != "") then { - GVAR(ReloadMutex) = false; - - private _gesture = getText (configfile >> "CfgWeapons" >> _weapon >> "reloadAction"); - private _isLauncher = _weapon isKindOf ["Launcher", (configFile >> "CfgWeapons")]; - private _config = ["CfgGesturesMale", "CfgMovesMaleSdr"] select _isLauncher; - private _duration = getNumber (configfile >> _config >> "States" >> _gesture >> "speed"); - - if (_duration != 0) then { - _duration = if (_duration < 0) then { abs _duration } else { 1 / _duration }; - } else { - _duration = 3; - }; - - TRACE_2("Reloading, blocking gestures",_weapon,_duration); - [{GVAR(ReloadMutex) = true;}, [], _duration] call EFUNC(common,waitAndExecute); - }; - }; - false - }]; -}] call EFUNC(common,addEventHandler); diff --git a/addons/gestures/XEH_preInit.sqf b/addons/gestures/XEH_preInit.sqf index 7fd2bb47f2..a7feade1c3 100644 --- a/addons/gestures/XEH_preInit.sqf +++ b/addons/gestures/XEH_preInit.sqf @@ -2,6 +2,6 @@ ADDON = false; -PREP(playSignal); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/gestures/XEH_preStart.sqf b/addons/gestures/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/gestures/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/gestures/script_component.hpp b/addons/gestures/script_component.hpp index 06650c6ba8..96ca2cf680 100644 --- a/addons/gestures/script_component.hpp +++ b/addons/gestures/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT Gestures #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_GESTURES #define DEBUG_MODE_FULL #endif diff --git a/addons/gestures/stringtable.xml b/addons/gestures/stringtable.xml index 0d21846d58..cc2e581fd4 100644 --- a/addons/gestures/stringtable.xml +++ b/addons/gestures/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -113,10 +113,12 @@ Stop Stop - Stop + Halt Stop Стоп Parar + Stop + Stop @@ -139,6 +141,8 @@ Zbiórka Собраться Reagrupar + Přeskupit + Raggruppare @@ -148,14 +152,19 @@ Naprzód Вперед Mover em frente + Kupředu + Muovere avanti Engage + Angriff Engager Atak Открыть огонь Engajar + Útok + Ingaggiare @@ -165,6 +174,8 @@ Wskaż Показать направление Ponta + Ukázat + Puntare @@ -174,6 +185,8 @@ Wstrzymać Ждать Esperar + Čekej + Mantenere @@ -183,6 +196,8 @@ Uwaga Внимание Aviso + Pozor + Attenzione Hi @@ -210,15 +225,31 @@ Show Gestures On Interaction Menu + Zeige Gesten im Interaktionsmenü + Zobrazit posunky v interakčním menu + Pokaż gesty w menu interakcji + Mostra Gesti su Menù Interazione Show gestures on the self interaction menu, or just use keybinds, or disable completely + Zeige Gesten im Selbst-Interkationsmenü, lege sie auf Schnelltasten, oder deaktiviere sie vollständig. + Zobrazit posunky pro vlastní interakční menu, nebo prostě použít klávesové zkratky, nebo to zakázat úplně + Pokaż listę gestów w menu własnej interakcji, użyj tylko skrótów na klawiaturze lub wyłącz całkowicie + Mostra Gesti nel Menù Interazione Personale, o usa solamente Hotkey, o disabilita completamente Just Keybinds + Nur Schnelltasten + Pouze klávesové zkratky + Tylko skróty klaw. + Solo Hotkey Keybinds + Interaction Menu + Schnelltasten+ Interaktionsmenü + Klávesové zkratky + interakční menu + Skróty klaw. + menu interakcji + Hotkey + Menù Interazione \ No newline at end of file diff --git a/addons/gforces/CfgEventHandlers.hpp b/addons/gforces/CfgEventHandlers.hpp index eefe61652b..f82caf47dd 100644 --- a/addons/gforces/CfgEventHandlers.hpp +++ b/addons/gforces/CfgEventHandlers.hpp @@ -1,12 +1,18 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + 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) ); + clientInit = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/gforces/XEH_PREP.hpp b/addons/gforces/XEH_PREP.hpp new file mode 100644 index 0000000000..1d3d8dac05 --- /dev/null +++ b/addons/gforces/XEH_PREP.hpp @@ -0,0 +1,2 @@ + +PREP(pfhUpdateGForces); diff --git a/addons/gforces/XEH_postInit.sqf b/addons/gforces/XEH_postInit.sqf index a97822be8c..23abe8e826 100644 --- a/addons/gforces/XEH_postInit.sqf +++ b/addons/gforces/XEH_postInit.sqf @@ -12,4 +12,4 @@ GVAR(GForces_CC) ppEffectCommit 0.4; GVAR(lastUpdateTime) = 0; GVAR(oldVel) = [0,0,0]; -[FUNC(pfhUpdateGForces), 0, []] call CBA_fnc_addPerFrameHandler; +[DFUNC(pfhUpdateGForces), 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/gforces/XEH_preInit.sqf b/addons/gforces/XEH_preInit.sqf index 1d249ff6a0..99e6461c54 100644 --- a/addons/gforces/XEH_preInit.sqf +++ b/addons/gforces/XEH_preInit.sqf @@ -2,7 +2,7 @@ ADDON = false; -PREP(pfhUpdateGForces); +#include "XEH_PREP.hpp" GVAR(GForces) = []; GVAR(GForces_Index) = 0; diff --git a/addons/gforces/XEH_preStart.sqf b/addons/gforces/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/gforces/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf index ee1bc8ca4a..dd569781e7 100644 --- a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf +++ b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf @@ -13,34 +13,18 @@ */ #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); - -// Update the g-forces at constant game time intervals -if (_interval < INTERVAL) exitWith {}; - -if (isNull ACE_player) exitWith {}; - -if !(alive ACE_player) exitWith {}; - +// Update the g-forces at constant mission time intervals (taking accTime into account) +if ((ACE_time - GVAR(lastUpdateTime)) < INTERVAL) exitWith {}; GVAR(lastUpdateTime) = ACE_time; -/*if !(vehicle ACE_player isKindOf "Air") exitWith { - GVAR(GForces) = []; - GVAR(GForces_Index) = 0; - waitUntil {sleep 5; (vehicle _player isKindOf "Air") or ((getPos _player select 2) > 5)}; -};*/ - -_newVel = velocity (vehicle ACE_player); - -_accel = ((_newVel vectorDiff GVAR(oldVel)) vectorMultiply (1 / INTERVAL)) vectorAdd [0, 0, 9.8]; -_currentGForce = (_accel vectorDotProduct vectorUp (vehicle ACE_player)) / 9.8; +if (isNull ACE_player || !(alive ACE_player)) exitWith {}; +private _newVel = velocity (vehicle ACE_player); +private _accel = ((_newVel vectorDiff GVAR(oldVel)) vectorMultiply (1 / INTERVAL)) vectorAdd [0, 0, 9.8]; // Cap maximum G's to +- 10 to avoid g-effects when the update is low fps. -_currentGForce = (_currentGForce max -10) min 10; +private _currentGForce = (((_accel vectorDotProduct vectorUp (vehicle ACE_player)) / 9.8) max -10) min 10; GVAR(GForces) set [GVAR(GForces_Index), _currentGForce]; GVAR(GForces_Index) = (GVAR(GForces_Index) + 1) % round (AVERAGEDURATION / INTERVAL); @@ -63,31 +47,27 @@ GVAR(oldVel) = _newVel; * Effects and camera shake start 30% the limit value, and build gradually */ -_average = 0; -if (count GVAR(GForces) > 0) then { - _sum = 0; - { - _sum = _sum + _x; - } forEach GVAR(GForces); - _average = _sum / (count GVAR(GForces)); +private _average = 0; +private _count = { + _average = _average + _x; + true +} count GVAR(GForces); + +if (_count > 0) then { + _average = _average / _count; }; -_classCoef = ACE_player getVariable ["ACE_GForceCoef", - getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "ACE_GForceCoef")]; -_suitCoef = if ((uniform ACE_player) != "") then { - getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef") +private _classCoef = (ACE_player getVariable ["ACE_GForceCoef", + getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "ACE_GForceCoef")]) max 0.001; +private _suitCoef = if ((uniform ACE_player) != "") then { + (getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef")) max 0.001 } else { 1 }; -//Fix "Error Zero divisor" -if (_classCoef == 0) then {_classCoef = 0.001}; -if (_suitCoef == 0) then {_suitCoef = 0.001}; +private _gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG; -_gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG; -_gRedOut = MINVIRTUALG / _classCoef; - -// @todo: Sort the interaction with medical +// Unconsciousness 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); }; @@ -96,12 +76,14 @@ GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[10,10,0,0, if !(ACE_player getVariable ["ACE_isUnconscious", false]) then { if (_average > 0.30 * _gBlackOut) then { - _strength = ((_average - 0.30 * _gBlackOut) / (0.70 * _gBlackOut)) max 0; + private _strength = ((_average - 0.30 * _gBlackOut) / (0.70 * _gBlackOut)) max 0; GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[2*(1-_strength),2*(1-_strength),0,0,0,0.1,0.5]]; addCamShake [_strength, 1, 15]; } else { + private _gRedOut = MINVIRTUALG / _classCoef; + if (_average < -0.30 * _gRedOut) then { - _strength = ((abs _average - 0.30 * _gRedOut) / (0.70 * _gRedOut)) max 0; + private _strength = ((abs _average - 0.30 * _gRedOut) / (0.70 * _gRedOut)) max 0; GVAR(GForces_CC) ppEffectAdjust [1,1,0,[1,0.2,0.2,1],[0,0,0,0],[1,1,1,1],[2*(1-_strength),2*(1-_strength),0,0,0,0.1,0.5]]; addCamShake [_strength / 1.5, 1, 15]; }; diff --git a/addons/gforces/script_component.hpp b/addons/gforces/script_component.hpp index ab3289842d..c017eb4a62 100644 --- a/addons/gforces/script_component.hpp +++ b/addons/gforces/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT gforces #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_GFORCES #define DEBUG_MODE_FULL #endif diff --git a/addons/goggles/CfgEventHandlers.hpp b/addons/goggles/CfgEventHandlers.hpp index 67f17fda18..578b4ebebb 100644 --- a/addons/goggles/CfgEventHandlers.hpp +++ b/addons/goggles/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -14,15 +20,7 @@ class Extended_PostInit_EventHandlers { 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)}); + clientKilled = QUOTE(_this call FUNC(handleKilled)); }; }; }; @@ -30,7 +28,7 @@ class Extended_Fired_EventHandlers { class Extended_Explosion_EventHandlers { class CAManBase { class ADDON { - explosion = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleExplosion)}); + clientExplosion = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleExplosion)}); }; }; }; diff --git a/addons/goggles/XEH_PREP.hpp b/addons/goggles/XEH_PREP.hpp new file mode 100644 index 0000000000..ba198439b5 --- /dev/null +++ b/addons/goggles/XEH_PREP.hpp @@ -0,0 +1,26 @@ + +// effects +PREP(applyDirtEffect); +PREP(applyDustEffect); +PREP(applyGlassesEffect); +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); diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index a4872f6a3f..832c961178 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -131,3 +131,6 @@ private _fnc_checkGoggles = { END_COUNTER(goggles); }, 0.5, []] call CBA_fnc_addPerFrameHandler; + +// Register fire event handler +["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); diff --git a/addons/goggles/XEH_preInit.sqf b/addons/goggles/XEH_preInit.sqf index ba5fa2373e..a7feade1c3 100644 --- a/addons/goggles/XEH_preInit.sqf +++ b/addons/goggles/XEH_preInit.sqf @@ -2,30 +2,6 @@ ADDON = false; -// effects -PREP(applyDirtEffect); -PREP(applyDustEffect); -PREP(applyGlassesEffect); -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); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/goggles/XEH_preStart.sqf b/addons/goggles/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/goggles/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index 85776fb0d6..06c6cec407 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -15,6 +15,9 @@ */ #include "script_component.hpp" +// Handle the ThreeDen Editor Camera +if ((!isNil {is3DEN}) && {is3DEN}) exitWith {true}; + if (GVAR(showInThirdPerson)) then { cameraView in ["GROUP"] || EFUNC(common,isFeatureCameraActive) } else { diff --git a/addons/goggles/functions/fnc_handleFired.sqf b/addons/goggles/functions/fnc_handleFired.sqf index 793849822f..dcfcc51bec 100644 --- a/addons/goggles/functions/fnc_handleFired.sqf +++ b/addons/goggles/functions/fnc_handleFired.sqf @@ -1,10 +1,9 @@ /* * Author: Garth 'L-H' de Wet, commy2 - * Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. + * Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. Called from the unified fired EH only for the local player. * * Arguments: - * 0: Unit - * 1: Weapon + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Function is handled? @@ -13,9 +12,8 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon"]; - -if (_unit != ACE_player) exitWith {true}; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // no dust in rain if (rain > 0.1) exitWith {true}; diff --git a/addons/goggles/script_component.hpp b/addons/goggles/script_component.hpp index 711a314160..23dc4f428f 100644 --- a/addons/goggles/script_component.hpp +++ b/addons/goggles/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT goggles #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_GOGGLES #define DEBUG_MODE_FULL #endif diff --git a/addons/goggles/stringtable.xml b/addons/goggles/stringtable.xml index ce337760d7..6b5a623715 100644 --- a/addons/goggles/stringtable.xml +++ b/addons/goggles/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/grenades/CfgEventHandlers.hpp b/addons/grenades/CfgEventHandlers.hpp index d93f8469bc..becf395052 100644 --- a/addons/grenades/CfgEventHandlers.hpp +++ b/addons/grenades/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -10,11 +16,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - firedBIS = QUOTE(_this call FUNC(throwGrenade)); - }; - }; -}; diff --git a/addons/grenades/XEH_PREP.hpp b/addons/grenades/XEH_PREP.hpp new file mode 100644 index 0000000000..b95c0d6961 --- /dev/null +++ b/addons/grenades/XEH_PREP.hpp @@ -0,0 +1,6 @@ + +PREP(flare); +PREP(flashbangExplosionEH); +PREP(flashbangThrownFuze); +PREP(nextMode); +PREP(throwGrenade); diff --git a/addons/grenades/XEH_postInit.sqf b/addons/grenades/XEH_postInit.sqf index 54c2b06e8b..d4cc01f06f 100644 --- a/addons/grenades/XEH_postInit.sqf +++ b/addons/grenades/XEH_postInit.sqf @@ -15,10 +15,16 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; // Conditions: canInteract if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false}; + if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false}; // Statement [] call FUNC(nextMode); }, {false}, [9, [false, false, false]], false] call CBA_fnc_addKeybind; //8 Key + + +// Register fire event handler +["firedPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); +["firedPlayerNonLocal", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); +["firedNonPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); diff --git a/addons/grenades/XEH_preInit.sqf b/addons/grenades/XEH_preInit.sqf index 631cecca85..a7feade1c3 100644 --- a/addons/grenades/XEH_preInit.sqf +++ b/addons/grenades/XEH_preInit.sqf @@ -2,10 +2,6 @@ ADDON = false; -PREP(flare); -PREP(flashbangExplosionEH); -PREP(flashbangThrownFuze); -PREP(nextMode); -PREP(throwGrenade); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/grenades/XEH_preStart.sqf b/addons/grenades/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/grenades/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/grenades/functions/fnc_flare.sqf b/addons/grenades/functions/fnc_flare.sqf index bf1d571640..74360e39b9 100644 --- a/addons/grenades/functions/fnc_flare.sqf +++ b/addons/grenades/functions/fnc_flare.sqf @@ -20,8 +20,7 @@ params ["_projectile", "_color", "_intensity", "_timeToLive"]; -private "_light"; -_light = "#lightpoint" createVehicleLocal position _projectile; +private _light = "#lightpoint" createVehicleLocal position _projectile; _light setLightColor _color; _light setLightAmbient _color; diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index 0ac6502284..c708f3a3cf 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -3,120 +3,139 @@ * Creates the flashbang effect and knock out AI units. * * Arguments: - * 0: The grenade + * 0: The flashBang position ASL * * Return Value: * None * * Example: - * [theGrenade] call ace_grenades_fnc_flashbangExplosionEH + * [[0,0,0]] call ace_grenades_fnc_flashbangExplosionEH * * Public: No */ #include "script_component.hpp" -params ["_grenade"]; +params ["_grenadePosASL"]; +TRACE_1("params",_grenadePosASL); -private ["_affected", "_strength", "_posGrenade", "_eyePos", "_losCount", "_eyeDir", "_dirToUnitVector", "_angleDiff", "_light"]; +// Create flash to illuminate environment +if (hasInterface) then { + private _light = "#lightpoint" createVehicleLocal ASLtoAGL _grenadePosASL; + _light setPosASL _grenadePosASL; -_affected = _grenade nearEntities ["CAManBase", 20]; + _light setLightBrightness 20; + _light setLightAmbient [1,1,1]; + _light setLightColor [1,1,1]; + _light setLightDayLight true; + // Reduce the light after 0.1 seconds + [{ + params ["_light"]; + _light setLightBrightness 5; + // Delete the light after 0.2 more seconds + [{ + params ["_light"]; + deleteVehicle _light; + }, [_light], 0.2] call EFUNC(common,waitAndExecute); + }, [_light], 0.1] call EFUNC(common,waitAndExecute); +}; + +// Affect local AI +// @todo: Affect units in static weapons, turned out, etc +private _affected = (ASLtoAGL _grenadePosASL) nearEntities ["CAManBase", 20]; +_affected = _affected - [ACE_player]; { if (local _x && {alive _x}) then { + private _strength = 1 - (((getPosASL _x) vectorDistance _grenadePosASL) min 20) / 20; - _strength = 1 - ((_x distance _grenade) min 15) / 15; + TRACE_3("FlashBangEffect Start",_x,((getPosASL _x) vectorDistance _grenadePosASL),_strength); - TRACE_3("FlashBangEffect Start",_x,(_x distance _grenade),_strength); + [_x, true] call EFUNC(common,disableAI); - 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 ["_unit"]; - - //Make sure we don't enable AI for unconscious units - 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); - } else { - //Do effects for player - // is there line of sight to the grenade? - _posGrenade = getPosASL _grenade; - _eyePos = eyePos ACE_player; //PositionASL - _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground - - //Check for line of sight (check 4 points in case grenade is stuck in an object or underground) - _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); - }; - - // account for people looking away by slightly - // reducing the effect for visual effects. - _eyeDir = (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); - _dirToUnitVector = _eyePos vectorFromTo _posGrenade; - _angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector); - - // 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); - }; - - // create flash to illuminate environment - _light = "#lightpoint" createVehicleLocal (getPos _grenade); - _light setLightBrightness 200; - _light setLightAmbient [1,1,1]; - _light setLightColor [1,1,1]; - _light setLightDayLight true; - - // delete the light after 0.1 seconds - [{ - params ["_light"]; - deleteVehicle _light; - }, [_light], 0.1] call EFUNC(common,waitAndExecute); - - // blind player - 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 time - [{ - 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] call EFUNC(common,waitAndExecute); - - //FULLRECOVERY - end effect - [{ - GVAR(flashbangPPEffectCC) ppEffectEnable false; - }, [], 17 * _strength] call EFUNC(common,waitAndExecute); - }; + if (_strength > 0.2) then { + _x setVectorDir ((getPosASL _x) vectorDiff _grenadePosASL); }; + + [{ + params ["_unit"]; + + //Make sure we don't enable AI for unconscious units + 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); }; - true } count _affected; + +// Affect local player, independently of distance +if (hasInterface && {!isNull ACE_player} && {alive ACE_player}) then { + // Do effects for player + // is there line of sight to the grenade? + private _eyePos = eyePos ACE_player; //PositionASL + _grenadePosASL set [2, (_grenadePosASL select 2) + 0.2]; // compensate for grenade glitching into ground + + private _strength = 1 - ((_eyePos vectorDistance _grenadePosASL) min 20) / 20; + + // Check for line of sight (check 4 points in case grenade is stuck in an object or underground) + private _losCoefficient = 1; + private _losCount = { + !lineIntersects [_grenadePosASL vectorAdd _x, _eyePos, 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 { + _losCoefficient = 0.1; + }; + _strength = _strength * _losCoefficient; + + // Add ace_hearing ear ringing sound effect + if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") && {_strength > 0}) then { + [40 * _strength] call EFUNC(hearing,earRinging); + }; + + // add ace_medical pain effect: + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {_strength > 0.1}) then { + [ACE_player, _strength / 2] call EFUNC(medical,adjustPainLevel); + }; + + // Effect on vision has a wider range, with a higher falloff + _strength = 1 - (((_eyePos vectorDistance _grenadePosASL) min 25) / 25) ^ 0.4; + _strength = _strength * _losCoefficient; + // Account for people looking away by slightly reducing the effect for visual effects. + private _eyeDir = ((AGLtoASL positionCameraToWorld [0,0,1]) vectorDiff (AGLtoASL positionCameraToWorld [0,0,0])); + private _dirToUnitVector = _eyePos vectorFromTo _grenadePosASL; + private _angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector); + TRACE_2("",_angleDiff,((1 - (_angleDiff - 45) / (120 - 45)) max 0)); + // from 0-45deg, full effect + if (_angleDiff > 45) then { + _strength = _strength * ((1 - (_angleDiff - 45) / (120 - 45)) max 0); + }; + + // Blind player + if (_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 time + [{ + 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] call EFUNC(common,waitAndExecute); + + //FULLRECOVERY - end effect + [{ + GVAR(flashbangPPEffectCC) ppEffectEnable false; + }, [], 17 * _strength] call EFUNC(common,waitAndExecute); + }; + + if (_strength > 0.2) then { + ACE_player setVectorDir (_eyePos vectorDiff _grenadePosASL); + }; +}; +true diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index ae50e96e39..73c10997ba 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -16,11 +16,10 @@ #include "script_component.hpp" params ["_projectile"]; +TRACE_1("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 = _projectile nearEntities ["CAManBase", 20]; - - ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); + ["flashbangExplosion", [getPosASL _projectile]] call EFUNC(common,globalEvent); }; diff --git a/addons/grenades/functions/fnc_nextMode.sqf b/addons/grenades/functions/fnc_nextMode.sqf index 7789e12ac4..99149f5185 100644 --- a/addons/grenades/functions/fnc_nextMode.sqf +++ b/addons/grenades/functions/fnc_nextMode.sqf @@ -15,9 +15,7 @@ */ #include "script_component.hpp" -private ["_mode", "_hint"]; - -_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; +private _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode == 4) then { _mode = 0; @@ -30,13 +28,13 @@ if (_mode == 3) then { _mode = 4; }; -_hint = [ -localize LSTRING(NormalThrow), -localize LSTRING(HighThrow), -localize LSTRING(PreciseThrow), -localize LSTRING(RollGrenade), -localize LSTRING(DropGrenade) -] select _mode; +private _hint = localize ([ + LSTRING(NormalThrow), + LSTRING(HighThrow), + LSTRING(PreciseThrow), + LSTRING(RollGrenade), + LSTRING(DropGrenade) +] select _mode); [_hint] call EFUNC(common,displayTextStructured); diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index 9439aef4bd..284c573c2e 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -1,15 +1,9 @@ /* * Author: commy2 - * Adjust the grenades throwing direction and speed to the selected throwing mode. + * Adjust the grenades throwing direction and speed to the selected throwing mode. Called from the unified fired EH only for CAManBase * * Arguments: - * 0: unit - Object the event handler is assigned to - * 1: weapon - Fired weapon - * 2: muzzle - Muzzle that was used - * 3: mode - Current mode of the fired weapon - * 4: ammo - Ammo used - * 5: magazine - magazine name which was used - * 6: projectile - Object of the projectile that was shot + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -21,7 +15,8 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); if (_weapon != "Throw") exitWith {}; @@ -30,24 +25,22 @@ if (isNull _projectile) then { _projectile = nearestObject [_unit, _ammo]; }; +private _config = configFile >> "CfgAmmo" >> _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"); + if (getNumber (_config >> QGVAR(flashbang)) == 1) then { + private _fuzeTime = getNumber (_config >> "explosionTime"); - [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute); + [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime] 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; +if (getNumber (_config >> QGVAR(flare)) == 1) then { + private _fuzeTime = getNumber (_config >> "explosionTime"); + private _timeToLive = getNumber (_config >> "timeToLive"); + private _color = getArray (_config >> QGVAR(color)); + private _intensity = _color deleteAt 3; [FUNC(flare), [_projectile, _color, _intensity, _timeToLive], _fuzeTime, 0] call EFUNC(common,waitAndExecute); }; @@ -55,12 +48,10 @@ if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(flare)) == 1) then { // handle throw modes if (_unit != ACE_player) exitWith {}; -private "_mode"; -_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; +private _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode != 0) then { - private "_velocity"; - _velocity = velocity _projectile; + private _velocity = velocity _projectile; switch (_mode) do { //high throw diff --git a/addons/grenades/script_component.hpp b/addons/grenades/script_component.hpp index f3d89216ba..67a958b27e 100644 --- a/addons/grenades/script_component.hpp +++ b/addons/grenades/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_GRENADES #define DEBUG_MODE_FULL diff --git a/addons/grenades/stringtable.xml b/addons/grenades/stringtable.xml index 44d9e7ad47..a05f6635cd 100644 --- a/addons/grenades/stringtable.xml +++ b/addons/grenades/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/headless/$PBOPREFIX$ b/addons/headless/$PBOPREFIX$ new file mode 100644 index 0000000000..553c595da0 --- /dev/null +++ b/addons/headless/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\headless diff --git a/addons/headless/ACE_Settings.hpp b/addons/headless/ACE_Settings.hpp new file mode 100644 index 0000000000..6c8246a06b --- /dev/null +++ b/addons/headless/ACE_Settings.hpp @@ -0,0 +1,20 @@ +class ACE_Settings { + class GVAR(Enabled) { + value = 0; + typeName = "BOOL"; + displayName = ECSTRING(common,Enabled); + description = CSTRING(EnabledDesc); + }; + class GVAR(Delay) { + value = DELAY_DEFAULT; + typeName = "SCALAR"; + displayName = CSTRING(Delay); + description = CSTRING(DelayDesc); + }; + class GVAR(Log) { + value = 0; + typeName = "BOOL"; + displayName = CSTRING(Log); + description = CSTRING(LogDesc); + }; +}; diff --git a/addons/headless/CfgEventHandlers.hpp b/addons/headless/CfgEventHandlers.hpp new file mode 100644 index 0000000000..b9c2681558 --- /dev/null +++ b/addons/headless/CfgEventHandlers.hpp @@ -0,0 +1,26 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +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_InitPost_EventHandlers { + class AllVehicles { + class ADDON { + serverInit = QUOTE(_this call FUNC(handleInitPost)); + }; + }; +}; diff --git a/addons/headless/CfgVehicles.hpp b/addons/headless/CfgVehicles.hpp new file mode 100644 index 0000000000..aa3837f6ae --- /dev/null +++ b/addons/headless/CfgVehicles.hpp @@ -0,0 +1,37 @@ +class CfgVehicles { + class ACE_Module; + class GVAR(module): ACE_Module { + author = ECSTRING(common,ACETeam); + category = "ACE_missionModules"; + displayName = CSTRING(Module); + function = QFUNC(moduleInit); + scope = 2; + isGlobal = 1; // Global + isTriggerActivated = 0; + isDisposable = 0; + icon = QUOTE(PATHTOF(UI\Icon_Module_Headless_ca.paa)); + class Arguments { + class Enabled { + displayName = ECSTRING(common,Enabled); + description = CSTRING(EnabledDesc); + typeName = "BOOL"; + defaultValue = 0; + }; + class Delay { + displayName = CSTRING(Delay); + description = CSTRING(DelayDesc); + typeName = "NUMBER"; + defaultValue = DELAY_DEFAULT; + }; + class Log { + displayName = CSTRING(Log); + description = CSTRING(LogDesc); + typeName = "BOOL"; + defaultValue = 0; + }; + }; + class ModuleDescription { + description = CSTRING(ModuleDesc); + }; + }; +}; diff --git a/addons/headless/README.md b/addons/headless/README.md new file mode 100644 index 0000000000..ab3d1ef403 --- /dev/null +++ b/addons/headless/README.md @@ -0,0 +1,16 @@ +ace_headless +============ + +Adds automatic passing of AI groups to (up to 3) Headless Clients. +- Automatic Headless Client recognition +- Event-based transferring (on unit spawn, Headless Client connect and disconnect) +- Round-robin transferring when more than 1 Headless Client is present +- Mission makers can use the following to prevent a group from transferring to a Headless Client: + `this setVariable ["ace_headless_blacklist", true, true];` + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Jonpas](http://github.com/jonpas) diff --git a/addons/headless/UI/Icon_Module_Headless_ca.paa b/addons/headless/UI/Icon_Module_Headless_ca.paa new file mode 100644 index 0000000000..a3e23a8537 Binary files /dev/null and b/addons/headless/UI/Icon_Module_Headless_ca.paa differ diff --git a/addons/headless/XEH_PREP.hpp b/addons/headless/XEH_PREP.hpp new file mode 100644 index 0000000000..8d2aaa2cfb --- /dev/null +++ b/addons/headless/XEH_PREP.hpp @@ -0,0 +1,7 @@ + +PREP(handleConnectHC); +PREP(handleDisconnect); +PREP(handleInitPost); +PREP(moduleInit); +PREP(rebalance); +PREP(transferGroups); diff --git a/addons/headless/XEH_postInit.sqf b/addons/headless/XEH_postInit.sqf new file mode 100644 index 0000000000..7b8a4615dc --- /dev/null +++ b/addons/headless/XEH_postInit.sqf @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +// Exit on player clients that are not hosts +if (hasInterface && !isServer) exitWith {}; + +["SettingsInitialized", { + if (isServer) then { + // Add disconnect EH if HC transferring enabled + if (GVAR(Enabled)) then { + addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}]; + }; + } else { + // Register HC (this part happens on HC only) + ["ACE_HeadlessClientJoined", [player]] call EFUNC(common,globalEvent); + }; +}] call EFUNC(common,addEventHandler); diff --git a/addons/headless/XEH_preInit.sqf b/addons/headless/XEH_preInit.sqf new file mode 100644 index 0000000000..2455c9f999 --- /dev/null +++ b/addons/headless/XEH_preInit.sqf @@ -0,0 +1,13 @@ +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +if (isServer) then { + GVAR(headlessClients) = []; + GVAR(inRebalance) = false; + ["ACE_HeadlessClientJoined", FUNC(handleConnectHC)] call EFUNC(common,addEventHandler); +}; + +ADDON = true; diff --git a/addons/headless/XEH_preStart.sqf b/addons/headless/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/headless/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/headless/config.cpp b/addons/headless/config.cpp new file mode 100644 index 0000000000..9c4c6b9120 --- /dev/null +++ b/addons/headless/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[]= {"Jonpas"}; + authorUrl = "https://github.com/jonpas"; + VERSION_CONFIG; + }; +}; + +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/headless/functions/fnc_handleConnectHC.sqf b/addons/headless/functions/fnc_handleConnectHC.sqf new file mode 100644 index 0000000000..19293e9229 --- /dev/null +++ b/addons/headless/functions/fnc_handleConnectHC.sqf @@ -0,0 +1,36 @@ +/* + * Author: Jonpas + * Registers connected Headless Client for use. + * + * Arguments: + * 0: Headless Client + * + * Return Value: + * None + * + * Example: + * [headlessClient] call ace_headless_handleConnectHC; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_headlessClient"]; + +// Delay until settings are initialized (for checking if HC trasnferring is enabled) +if (!EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(handleConnectHC), _this]; +}; + +// Exit if HC transferring disabled or HC already registered +if (!GVAR(Enabled) || {_headlessClient in GVAR(headlessClients)}) exitWith {}; + +// Register for use +GVAR(headlessClients) pushBack _headlessClient; + +if (GVAR(Log)) then { + ACE_LOGINFO_1("Registered HC: %1",_headlessClient); +}; + +// Rebalance +[true] call FUNC(rebalance); diff --git a/addons/headless/functions/fnc_handleDisconnect.sqf b/addons/headless/functions/fnc_handleDisconnect.sqf new file mode 100644 index 0000000000..dc20379458 --- /dev/null +++ b/addons/headless/functions/fnc_handleDisconnect.sqf @@ -0,0 +1,34 @@ +/* + * Author: Jonpas + * Removes Headless Client from use. + * + * Arguments: + * 0: Object + * + * Return Value: + * Transfer To Server + * + * Example: + * [unit] call ace_headless_handleDisconnect; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_object"]; + +// Exit if not HC +if !(_object in GVAR(headlessClients)) exitWith {}; + +// Remove HC +GVAR(headlessClients) deleteAt (GVAR(headlessClients) find _object); + +if (GVAR(Log)) then { + ACE_LOGINFO_1("Removed HC: %1",_object); +}; + +// Rebalance +[true] call FUNC(rebalance); + +// Prevent transferring of HC to server +false diff --git a/addons/headless/functions/fnc_handleInitPost.sqf b/addons/headless/functions/fnc_handleInitPost.sqf new file mode 100644 index 0000000000..fd75367ce7 --- /dev/null +++ b/addons/headless/functions/fnc_handleInitPost.sqf @@ -0,0 +1,31 @@ +/* + * Author: Jonpas + * Request a rebalance. + * + * Arguments: + * 0: Object + * + * Return Value: + * None + * + * Example: + * [object] call ace_headless_handleInitPost; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_object"]; + +TRACE_1("InitPost",_object); + +// Delay until settings are initialized (for checking if HC trasnferring is enabled) +if (!EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(handleInitPost), _this]; +}; + +// Exit if HC transferring disabled or object not a unit (including unit inside vehicle) or is player +if (!GVAR(Enabled) || {!(_object in allUnits)} || {isPlayer _object}) exitWith {}; + +// Rebalance +[false] call FUNC(rebalance); diff --git a/addons/headless/functions/fnc_moduleInit.sqf b/addons/headless/functions/fnc_moduleInit.sqf new file mode 100644 index 0000000000..dc06d95b3b --- /dev/null +++ b/addons/headless/functions/fnc_moduleInit.sqf @@ -0,0 +1,27 @@ +/* + * Author: Jonpas + * Initializes the Headless module. + * + * Arguments: + * 0: The module logic + * 1: Units (Unused) + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +if (!isServer) exitWith {}; + +params ["_logic", "", "_activated"]; + +if (!_activated) exitWith {}; + +[_logic, QGVAR(Enabled), "Enabled"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(Delay), "Delay"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(Log), "Log"] call EFUNC(common,readSettingFromModule); + +ACE_LOGINFO("Headless Module Initialized."); diff --git a/addons/headless/functions/fnc_rebalance.sqf b/addons/headless/functions/fnc_rebalance.sqf new file mode 100644 index 0000000000..1c792ff94a --- /dev/null +++ b/addons/headless/functions/fnc_rebalance.sqf @@ -0,0 +1,29 @@ +/* + * Author: Jonpas + * Rebalance AI groups accross HCs. + * + * Arguments: + * 0: Force + * + * Return Value: + * None + * + * Example: + * [false] call ace_headless_rebalance; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_force"]; + +TRACE_3("Rebalance",GVAR(inRebalance),GVAR(headlessClients),_force); + +// Exit if waiting for rebalance or no HCs present +if (GVAR(inRebalance) || {GVAR(headlessClients) isEqualTo []}) exitWith {}; + +// Transfer after rebalance delay +[FUNC(transferGroups), [_force], GVAR(Delay)] call EFUNC(common,waitAndExecute); + +// Currently in rebalance flag +GVAR(inRebalance) = true; diff --git a/addons/headless/functions/fnc_transferGroups.sqf b/addons/headless/functions/fnc_transferGroups.sqf new file mode 100644 index 0000000000..892e9b58ff --- /dev/null +++ b/addons/headless/functions/fnc_transferGroups.sqf @@ -0,0 +1,144 @@ +/* + * Author: Jonpas + * Transfers AI groups to Headess Client(s). + * + * Arguments: + * 0: Force + * + * Return Value: + * None + * + * Example: + * [false] call ace_headless_fnc_transferGroups; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_force"]; + +GVAR(headlessClients) params [ + ["_HC1", objNull, [objNull] ], + ["_HC2", objNull, [objNull] ], + ["_HC3", objNull, [objNull] ] +]; + +if (GVAR(Log)) then { + ACE_LOGINFO_2("Present HCs: %1 - Full Rebalance: %2",GVAR(headlessClients),_force); +}; + + +// Enable round-robin load balancing if more than one HC is present +private _loadBalance = [false, true] select (count GVAR(headlessClients) > 1); + + +// Get IDs and determine first HC to start with +private _idHC1 = -1; +private _idHC2 = -1; +private _idHC3 = -1; +private _currentHC = 0; + +if (!local _HC1) then { + _idHC1 = owner _HC1; + _currentHC = 1; +}; + +if (!local _HC2) then { + _idHC2 = owner _HC2; + + if (_currentHC == 0) then { + _currentHC = 2; + }; +}; + +if (!local _HC3) then { + _idHC3 = owner _HC3; + + if (_currentHC == 0) then { + _currentHC = 3; + }; +}; + + +// Prepare statistics +private _numTransferredHC1 = 0; +private _numTransferredHC2 = 0; +private _numTransferredHC3 = 0; + + +// Transfer AI groups +{ + // No transfer if empty group + private _transfer = !(_x isEqualTo []); + + if (_transfer) then { + { + // No transfer if already transferred + if (!_force && {(owner _x) in [_idHC1, _idHC2, _idHC3]}) exitWith { + _transfer = false; + }; + + // No transfer if player in this group + if (isPlayer _x) exitWith { + _transfer = false; + }; + + // No transfer if any unit in group is blacklisted + if (_x getVariable [QGVAR(blacklist), false]) exitWith { + _transfer = false; + }; + + // No transfer if vehicle unit is in or crew in that vehicle is blacklisted + if (vehicle _x != _x && {(vehicle _x) getVariable [QGVAR(blacklist), false]}) exitWith { + _transfer = false; + }; + } forEach (units _x); + }; + + + // Round robin between HCs if load balance enabled, else pass all to one HC + if (_transfer) then { + switch (_currentHC) do { + case 1: { + private _transferred = _x setGroupOwner _idHC1; + if (_loadBalance) then { + _currentHC = [3, 2] select (!local _HC2); + }; + if (_transferred) then { + _numTransferredHC1 = _numTransferredHC1 + 1; + }; + }; + case 2: { + private _transferred = _x setGroupOwner _idHC2; + if (_loadBalance) then { + _currentHC = [1, 3] select (!local _HC3); + }; + if (_transferred) then { + _numTransferredHC2 = _numTransferredHC2 + 1; + }; + }; + case 3: { + private _transferred = _x setGroupOwner _idHC3; + if (_loadBalance) then { + _currentHC = [2, 1] select (!local _HC1); + }; + if (_transferred) then { + _numTransferredHC3 = _numTransferredHC3 + 1; + }; + }; + default { + TRACE_1("No Valid HC to transfer to",_currentHC); + }; + }; + }; +} forEach allGroups; + + +if (GVAR(Log)) then { + private _numTransferredTotal = _numTransferredHC1 + _numTransferredHC2 + _numTransferredHC3; + ACE_LOGINFO_4("Groups Transferred: Total: %1 - HC1: %2 - HC2: %3 - HC3: %4",_numTransferredTotal,_numTransferredHC1,_numTransferredHC2,_numTransferredHC3); +}; + + +// Allow rebalance flag +GVAR(inRebalance) = false; diff --git a/addons/headless/functions/script_component.hpp b/addons/headless/functions/script_component.hpp new file mode 100644 index 0000000000..a38efad3a9 --- /dev/null +++ b/addons/headless/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\headless\script_component.hpp" diff --git a/addons/headless/script_component.hpp b/addons/headless/script_component.hpp new file mode 100644 index 0000000000..c69bd780c9 --- /dev/null +++ b/addons/headless/script_component.hpp @@ -0,0 +1,15 @@ +#define COMPONENT headless +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_HEADLESS + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_HEADLESS + #define DEBUG_SETTINGS DEBUG_SETTINGS_HEADLESS +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + + +#define DELAY_DEFAULT 15 diff --git a/addons/headless/stringtable.xml b/addons/headless/stringtable.xml new file mode 100644 index 0000000000..8d60e485e3 --- /dev/null +++ b/addons/headless/stringtable.xml @@ -0,0 +1,47 @@ + + + + + Headless + Headless + Headless + Headless + + + This module allows you to setup automatic transferring of AI to Headless Clients. (Default: No) + Dieses Modul erlaubt es dir, die KI automatisch auf einen Headless Client zu transferieren. (Standard: Nein) + Moduł ten pozwala ustawić automatyczne przenoszenie AI do Headless Clientów. (Domyślnie: Nie) + Questo modulo ti consente di impostare il trasferimento automatico di IA all'Headless Client (Default: No) + + + Enables transferring of AI to Headless Clients. + Aktiviert den Transfer der KI auf Headless Clients. + Aktywuje przenoszenie AI do Headless Clientów + Abilita trasferimento di IA a Headless Client + + + Delay + Verzögerung + Opóźnienie + Ritardo + + + Minimal delay between transfers, in seconds. (Default: 15) + Minimale Verzögerung zwischen Transfers in Sekunden. (Standard: 15) + Minimalne opóźnienie w sekundach pomiędzy transferami. (Domyślnie: 15) + Ritardo minimo tra trasferimenti, in secondi. (Default: 15) + + + Log + Protokolldatei anlegen + Dziennik + Log + + + Log transfer statistics and Headless Client (dis)connections to RPT. (Default: No) + Zeichnet Transferstatistiken, Verbindungen und Verbindungsabbrüche in einer RPT-Datei auf. (Standard: Nein) + Zapisuj statystyki transferów oraz status Headless Clienta do RPT. (Domyślnie: Nie) + Logga statistiche trasferimenti e (dis)connessioni di Headless Client su RPT. (Default: No) + + + \ No newline at end of file diff --git a/addons/hearing/ACE_Settings.hpp b/addons/hearing/ACE_Settings.hpp index 13f445a987..dcae85fa25 100644 --- a/addons/hearing/ACE_Settings.hpp +++ b/addons/hearing/ACE_Settings.hpp @@ -1,31 +1,38 @@ class ACE_Settings { class GVAR(EnableCombatDeafness) { + category = CSTRING(Module_DisplayName); value = 1; typeName = "BOOL"; - displayName = CSTRING(CombatDeafness_DisplayName); - description = CSTRING(CombatDeafness_Description); + displayName = CSTRING(EnableCombatDeafness_DisplayName); + description = CSTRING(EnableCombatDeafness_Description); }; class GVAR(EarplugsVolume) { + category = CSTRING(Module_DisplayName); value = 0.5; typeName = "SCALAR"; }; class GVAR(UnconsciousnessVolume) { + category = CSTRING(Module_DisplayName); value = 0.4; typeName = "SCALAR"; }; class GVAR(DisableEarRinging) { + category = CSTRING(Module_DisplayName); value = 0; typeName = "BOOL"; isClientSettable = 1; - displayName = CSTRING(DisableEarRinging); + displayName = CSTRING(DisableEarRinging_DisplayName); + description = CSTRING(DisableEarRinging_Description); }; class GVAR(enabledForZeusUnits) { + category = CSTRING(Module_DisplayName); value = 1; typeName = "BOOL"; displayName = CSTRING(enabledForZeusUnits_DisplayName); description = CSTRING(enabledForZeusUnits_Description); }; class GVAR(autoAddEarplugsToUnits) { + category = CSTRING(Module_DisplayName); value = 1; typeName = "BOOL"; displayName = CSTRING(autoAddEarplugsToUnits_DisplayName); diff --git a/addons/hearing/CfgEventHandlers.hpp b/addons/hearing/CfgEventHandlers.hpp index e31501d1c3..352f802435 100644 --- a/addons/hearing/CfgEventHandlers.hpp +++ b/addons/hearing/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/hearing/CfgSounds.hpp b/addons/hearing/CfgSounds.hpp index 2d757041be..7afdae88cb 100644 --- a/addons/hearing/CfgSounds.hpp +++ b/addons/hearing/CfgSounds.hpp @@ -11,9 +11,21 @@ class CfgSounds { sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_heavy.wav)),8,1.7}; titles[] = {}; }; - class ACE_Combat_Deafness { + class ACE_Combat_Deafness_Heavy { + sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),8,1}; + titles[] = {}; + }; + class ACE_Combat_Deafness_Medium { sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),3,1}; titles[] = {}; + }; + class ACE_Combat_Deafness_Heavy_NoRing { + sound[] = {QUOTE(PATHTOF(sounds\deafness_noring.ogg)),8,1}; + titles[] = {}; + }; + class ACE_Combat_Deafness_Medium_NoRing { + sound[] = {QUOTE(PATHTOF(sounds\deafness_noring.ogg)),3,1}; + titles[] = {}; }; class ACE_Ring_Backblast { sound[] = {QUOTE(PATHTOF(sounds\backblast_ring.ogg)),1,1}; diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp index 3873377052..17dec1641b 100644 --- a/addons/hearing/CfgVehicles.hpp +++ b/addons/hearing/CfgVehicles.hpp @@ -103,13 +103,14 @@ class CfgVehicles { icon = PATHTOF(UI\Icon_Module_Hearing_ca.paa); class Arguments { class EnableCombatDeafness { - displayName = CSTRING(CombatDeafness_DisplayName); - description = CSTRING(CombatDeafness_Description); + displayName = CSTRING(EnableCombatDeafness_DisplayName); + description = CSTRING(EnableCombatDeafness_Description); typeName = "BOOL"; defaultValue = 1; }; class DisableEarRinging { - displayName = CSTRING(DisableEarRinging); + displayName = CSTRING(DisableEarRinging_DisplayName); + description = CSTRING(DisableEarRinging_Description); typeName = "NUMBER"; class values { class DoNotForce { diff --git a/addons/hearing/CfgWeapons.hpp b/addons/hearing/CfgWeapons.hpp index 7e1c932f62..af7b7d4cb3 100644 --- a/addons/hearing/CfgWeapons.hpp +++ b/addons/hearing/CfgWeapons.hpp @@ -18,36 +18,27 @@ class CfgWeapons { GVAR(protection) = 1; GVAR(lowerVolume) = 0.80; }; - class H_HelmetCrew_0: H_HelmetCrew_B {}; - class H_HelmetCrew_I: H_HelmetCrew_B {}; class H_CrewHelmetHeli_B: H_HelmetB { GVAR(protection) = 0.85; GVAR(lowerVolume) = 0.75; }; - class H_CrewHelmetHeli_O: H_CrewHelmetHeli_B {}; - class H_CrewHelmetHeli_I: H_CrewHelmetHeli_B {}; class H_PilotHelmetHeli_B: H_HelmetB { GVAR(protection) = 0.85; GVAR(lowerVolume) = 0.75; }; - class H_PilotHelmetHeli_O: H_PilotHelmetHeli_B {}; - class H_PilotHelmetHeli_I: H_PilotHelmetHeli_B {}; class H_PilotHelmetFighter_B: H_HelmetB { GVAR(protection) = 1; GVAR(lowerVolume) = 0.80; }; - class H_PilotHelmetFighter_O: H_PilotHelmetFighter_B {}; - class H_PilotHelmetFighter_I: H_PilotHelmetFighter_B {}; class HelmetBase; class H_Cap_headphones: HelmetBase { GVAR(protection) = 0.5; GVAR(lowerVolume) = 0.60; }; - class H_Cap_marshal: H_Cap_headphones {}; class H_HelmetB_light: H_HelmetB { GVAR(protection) = 0.8; diff --git a/addons/hearing/XEH_PREP.hpp b/addons/hearing/XEH_PREP.hpp new file mode 100644 index 0000000000..e06fa5d56c --- /dev/null +++ b/addons/hearing/XEH_PREP.hpp @@ -0,0 +1,13 @@ + +PREP(addEarPlugs); +PREP(earRinging); +PREP(explosionNear); +PREP(firedNear); +PREP(handleRespawn); +PREP(hasEarPlugsIn); +PREP(moduleHearing); +PREP(putInEarPlugs); +PREP(removeEarPlugs); +PREP(updateHearingProtection); +PREP(updatePlayerVehAttenuation); +PREP(updateVolume); diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf index b8745acaaa..cbae40dee0 100644 --- a/addons/hearing/XEH_postInit.sqf +++ b/addons/hearing/XEH_postInit.sqf @@ -2,35 +2,40 @@ if (!hasInterface) exitWith {}; +GVAR(cacheAmmoLoudness) = call CBA_fnc_createNamespace; + GVAR(deafnessDV) = 0; GVAR(deafnessPrior) = 0; GVAR(volume) = 1; GVAR(playerVehAttenuation) = 1; - -GVAR(beep) = false; -GVAR(beep2) = false; -GVAR(time2) = 0; GVAR(time3) = 0; -GVAR(time4) = 0; +GVAR(damageCoefficent) = 1; +GVAR(volumeAttenuation) = 1; ["SettingsInitialized", { + TRACE_1("settingInit",GVAR(EnableCombatDeafness)); + // Only run PFEH and install event handlers if combat deafness is enabled + if (!GVAR(EnableCombatDeafness)) exitWith {}; + + // Update hearing protection now: + [] call FUNC(updateHearingProtection); + // Spawn volume updating process [FUNC(updateVolume), 1, [false]] call CBA_fnc_addPerFrameHandler; + + // Update veh attunation when player veh changes + ["playerVehicleChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler); + ["playerTurretChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler); + + // Reset deafness on respawn (or remote control player switch) + ["playerChanged", { + GVAR(deafnessDV) = 0; + GVAR(deafnessPrior) = 0; + ACE_player setVariable [QGVAR(deaf), false]; + GVAR(time3) = 0; + [] call FUNC(updateHearingProtection); + }] call EFUNC(common,addEventhandler); + + // Update protection on possible helmet change + ["playerInventoryChanged", {[] call FUNC(updateHearingProtection);}] call EFUNC(common,addEventhandler); }] call EFUNC(common,addEventHandler); - -//Update veh attunation when player veh changes -["playerVehicleChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler); -["playerTurretChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler); - -//Reset deafness on respawn (or remote control player switch) -["playerChanged", { - GVAR(deafnessDV) = 0; - GVAR(deafnessPrior) = 0; - ACE_player setVariable [QGVAR(deaf), false]; - - GVAR(beep) = false; - GVAR(beep2) = false; - GVAR(time2) = 0; - GVAR(time3) = 0; - GVAR(time4) = 0; -}] call EFUNC(common,addEventhandler); diff --git a/addons/hearing/XEH_preInit.sqf b/addons/hearing/XEH_preInit.sqf index 3355d0cff4..a7feade1c3 100644 --- a/addons/hearing/XEH_preInit.sqf +++ b/addons/hearing/XEH_preInit.sqf @@ -2,16 +2,6 @@ ADDON = false; -PREP(addEarPlugs); -PREP(earRinging); -PREP(explosionNear); -PREP(firedNear); -PREP(handleRespawn); -PREP(hasEarPlugsIn); -PREP(moduleHearing); -PREP(putInEarPlugs); -PREP(removeEarPlugs); -PREP(updatePlayerVehAttenuation); -PREP(updateVolume); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/hearing/XEH_preStart.sqf b/addons/hearing/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/hearing/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/hearing/functions/fnc_earRinging.sqf b/addons/hearing/functions/fnc_earRinging.sqf index f4db19e6ea..273fad8107 100644 --- a/addons/hearing/functions/fnc_earRinging.sqf +++ b/addons/hearing/functions/fnc_earRinging.sqf @@ -1,38 +1,25 @@ /* * Author: KoffeinFlummi, commy2, Rocko, Rommel, Ruthberg - * Ear ringing PFH + * Handle new sound souce near ace_player and apply hearing damage * * Arguments: - * 0: unit - * 1: strength of ear ringing (Number between 0 and 1) + * 0: strength of ear ringing * * Return Value: * None * * Example: - * [_unit, _strength] call ace_hearing_fnc_earRinging + * [_strength] call ace_hearing_fnc_earRinging * * Public: No */ #include "script_component.hpp" -params ["_unit", "_strength"]; +params ["_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; -}; +TRACE_2("adding",_strength * GVAR(damageCoefficent),GVAR(deafnessDV)); -//headgear hearing protection -if(headgear _unit != "") then { - private ["_protection"]; - _protection = (getNumber (configFile >> "CfgWeapons" >> (headgear _unit) >> QGVAR(protection))) min 1; - if(_protection > 0) then { - _strength = _strength * (1 - _protection); - }; -}; - -GVAR(deafnessDV) = GVAR(deafnessDV) + _strength; +GVAR(deafnessDV) = GVAR(deafnessDV) + (_strength * GVAR(damageCoefficent)); diff --git a/addons/hearing/functions/fnc_explosionNear.sqf b/addons/hearing/functions/fnc_explosionNear.sqf index 7e4d0b9bfc..799de52320 100644 --- a/addons/hearing/functions/fnc_explosionNear.sqf +++ b/addons/hearing/functions/fnc_explosionNear.sqf @@ -16,8 +16,8 @@ */ #include "script_component.hpp" -//Only run if deafness or ear ringing is enabled: -if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {}; +// Only run if combat deafness is enabled +if (!GVAR(EnableCombatDeafness)) exitWith {}; params ["_unit", "_damage"]; @@ -29,4 +29,5 @@ private ["_strength"]; _strength = (0 max _damage) * 30; if (_strength < 0.01) exitWith {}; -[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2] call EFUNC(common,waitAndExecute); +// Call inmediately, as it will get pick up later anyway by the update thread +[_strength] call FUNC(earRinging); diff --git a/addons/hearing/functions/fnc_firedNear.sqf b/addons/hearing/functions/fnc_firedNear.sqf index 1ee84a2dc8..f583ab0050 100644 --- a/addons/hearing/functions/fnc_firedNear.sqf +++ b/addons/hearing/functions/fnc_firedNear.sqf @@ -22,8 +22,8 @@ */ #include "script_component.hpp" -//Only run if deafness or ear ringing is enabled: -if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {}; +// Only run if combat deafness is enabled +if (!GVAR(EnableCombatDeafness)) exitWith {}; params ["_object", "_firer", "_distance", "_weapon", "", "", "_ammo"]; @@ -32,31 +32,28 @@ 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"]; +private _vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; +private _distance = 1 max _distance; -_vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; - -_distance = 1 max _distance; - -_silencer = switch (_weapon) do { +private _silencer = switch (_weapon) do { case (primaryWeapon _firer) : {(primaryWeaponItems _firer) select 0}; case (secondaryWeapon _firer) : {(secondaryWeaponItems _firer) select 0}; case (handgunWeapon _firer) : {(handgunItems _firer) select 0}; default {""}; }; -_audibleFireCoef = 1; +private _audibleFireCoef = 1; if (_silencer != "") then { _audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire"); }; -_weaponMagazines = missionNamespace getVariable [format[QEGVAR(common,weaponMagazines_%1),_weapon], []]; -if (count _weaponMagazines == 0) then { - _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); - _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); +private _loudness = GVAR(cacheAmmoLoudness) getVariable (format ["%1%2",_weapon,_ammo]); +if (isNil "_loudness") then { + private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); + private _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); { if (_x != "this") then { - _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); + private _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); _weaponMagazines append _muzzleMagazines; }; } count _muzzles; @@ -64,35 +61,41 @@ if (count _weaponMagazines == 0) then { _ammoType = getText(configFile >> "CfgMagazines" >> _x >> "ammo"); _weaponMagazines set [_forEachIndex, [_x, _ammoType]]; } forEach _weaponMagazines; - missionNamespace setVariable [format[QEGVAR(common,weaponMagazines_%1),_weapon], _weaponMagazines]; -}; -_magazine = ""; -{ - _x params ["_magazineType", "_ammoType"]; - if (_ammoType == _ammo) exitWith { - _magazine = _magazineType; + private _magazine = ""; + { + _x params ["_magazineType", "_ammoType"]; + if (_ammoType == _ammo) exitWith { + _magazine = _magazineType; + }; + } count _weaponMagazines; + + if (_magazine == "") then { + _loudness = 0; + TRACE_2("No mag for Weapon/Ammo??",_weapon,_ammo); + } else { + private _initSpeed = getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); + private _caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_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) / 5; + TRACE_6("building cache",_weapon,_ammo,_magazine,_initSpeed,_caliber,_loudness); }; -} count _weaponMagazines; - -if (_magazine == "") exitWith {}; - -_initSpeed = getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); -_ammoConfig = (configFile >> "CfgAmmo" >> _ammo); -_caliber = getNumber(_ammoConfig >> "ACE_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 }; + GVAR(cacheAmmoLoudness) setVariable [(format ["%1%2",_weapon,_ammo]), _loudness]; }; -_loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) * _audibleFireCoef / 5; -_strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off -//systemChat format["%1 : %2", _strength, _initSpeed]; -//systemChat format["%1 : %2 : %3", _weapon, _magazine, _initSpeed]; +_loudness = _loudness * _audibleFireCoef; +private _strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off + +TRACE_1("result",_strength); if (_strength < 0.01) exitWith {}; -[{_this call FUNC(earRinging)}, [ACE_player, _strength], 0.2] call EFUNC(common,waitAndExecute); +// Call inmediately, as it will get pick up later anyway by the update thread +[_strength] call FUNC(earRinging); diff --git a/addons/hearing/functions/fnc_handleRespawn.sqf b/addons/hearing/functions/fnc_handleRespawn.sqf index 527d5d6b16..5bad68761c 100644 --- a/addons/hearing/functions/fnc_handleRespawn.sqf +++ b/addons/hearing/functions/fnc_handleRespawn.sqf @@ -20,6 +20,9 @@ TRACE_2("params",_unit,typeOf _unit); if (!local _unit) exitWith {}; //XEH should only be called on local units +//Do not add or remove earplugs if gear should be preserved +if (missionNamespace getVariable [QEGVAR(respawn,SavePreDeathGear), false]) exitWith {}; + private _respawn = [0] call BIS_fnc_missionRespawnType; //if respawn is not Group or side: diff --git a/addons/hearing/functions/fnc_moduleHearing.sqf b/addons/hearing/functions/fnc_moduleHearing.sqf index 35836ddb0c..053bcb6d7f 100644 --- a/addons/hearing/functions/fnc_moduleHearing.sqf +++ b/addons/hearing/functions/fnc_moduleHearing.sqf @@ -12,13 +12,12 @@ params ["_logic"]; -[_logic, QGVAR(enableCombatDeafness), "EnableCombatDeafness"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(EnableCombatDeafness), "EnableCombatDeafness"] call EFUNC(common,readSettingFromModule); // Do Not Force - read module setting only non-default is set due to using SCALAR if ((_logic getVariable "DisableEarRinging") != -1) then { [_logic, QGVAR(DisableEarRinging), "DisableEarRinging"] call EFUNC(common,readSettingFromModule); }; - [_logic, QGVAR(enabledForZeusUnits), "enabledForZeusUnits"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(autoAddEarplugsToUnits), "autoAddEarplugsToUnits"] 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 8d5479c17b..90fe8d62ac 100644 --- a/addons/hearing/functions/fnc_putInEarplugs.sqf +++ b/addons/hearing/functions/fnc_putInEarplugs.sqf @@ -29,3 +29,5 @@ _player setVariable ["ACE_hasEarPlugsIn", true, true]; /*// No Earplugs in inventory, telling user [localize LSTRING(NoPlugs)] call EFUNC(common,displayTextStructured);*/ + +[] call FUNC(updateHearingProtection); diff --git a/addons/hearing/functions/fnc_removeEarplugs.sqf b/addons/hearing/functions/fnc_removeEarplugs.sqf index f5b5ca2442..3154230ecf 100644 --- a/addons/hearing/functions/fnc_removeEarplugs.sqf +++ b/addons/hearing/functions/fnc_removeEarplugs.sqf @@ -30,3 +30,5 @@ _player setVariable ["ACE_hasEarPlugsIn", false, true]; //Force an immediate fast volume update: [[true]] call FUNC(updateVolume); + +[] call FUNC(updateHearingProtection); diff --git a/addons/hearing/functions/fnc_updateHearingProtection.sqf b/addons/hearing/functions/fnc_updateHearingProtection.sqf new file mode 100644 index 0000000000..b1b7df48c5 --- /dev/null +++ b/addons/hearing/functions/fnc_updateHearingProtection.sqf @@ -0,0 +1,36 @@ +/* + * Author: PabstMirror + * Updates the hearing protection and volume attenuation for player on earbuds/helmet change + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_hearing_fnc_updateHearingProtection + * + * Public: No + */ +#include "script_component.hpp" + +TRACE_1("params",_this); + +if (isNull ACE_player) exitWith { + GVAR(damageCoefficent) = 0; + GVAR(volumeAttenuation) = 1; +}; + +// Handle Earplugs +private _hasEarPlugsIn = [ACE_player] call FUNC(hasEarPlugsIn); +GVAR(damageCoefficent) = [1, 0.25] select _hasEarPlugsIn; +GVAR(volumeAttenuation) = [1, GVAR(EarplugsVolume)] select _hasEarPlugsIn; + +// Handle Headgear +if (headgear ACE_player != "") then { + private _protection = (getNumber (configFile >> "CfgWeapons" >> (headgear ACE_player) >> QGVAR(protection))) min 1; + GVAR(damageCoefficent) = GVAR(damageCoefficent) * (1 - _protection); + private _attenuation = (getNumber (configFile >> "CfgWeapons" >> (headgear ACE_player) >> QGVAR(lowerVolume))) min 1; + GVAR(volumeAttenuation) = GVAR(volumeAttenuation) * (1 - _attenuation); +}; diff --git a/addons/hearing/functions/fnc_updateVolume.sqf b/addons/hearing/functions/fnc_updateVolume.sqf index e36151aea4..58eedc7b39 100644 --- a/addons/hearing/functions/fnc_updateVolume.sqf +++ b/addons/hearing/functions/fnc_updateVolume.sqf @@ -1,6 +1,6 @@ /* * Author: commy2 and esteldunedain and Ruthberg - * Updates and applys the current deafness. Called every 0.1 sec from a PFEH. + * Updates and applys the current deafness. Called every 1 sec from a PFEH. * * Arguments: * 0: Args @@ -16,83 +16,45 @@ */ #include "script_component.hpp" -//Only run if deafness or ear ringing is enabled: -if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {}; - -private["_volume", "_soundTransitionTime"]; (_this select 0) params ["_justUpdateVolume"]; - GVAR(deafnessDV) = (GVAR(deafnessDV) min 20) max 0; -GVAR(volume) = (1 - (GVAR(deafnessDV) / 20)) max 0; +GVAR(volume) = (1 - (GVAR(deafnessDV) / 20)) max 0.05; +TRACE_3("",GVAR(volume),GVAR(deafnessDV),GVAR(deafnessDV) - GVAR(deafnessPrior)); if (!_justUpdateVolume) then { - //If we got a big increase in the last second: - if ((GVAR(deafnessDV) - GVAR(deafnessPrior)) > 2) then { - if (ACE_time > GVAR(time3)) then { - GVAR(beep2) = false; - }; - if ((!GVAR(DisableEarRinging)) && {!GVAR(beep2)}) then { - playSound "ACE_Combat_Deafness"; - GVAR(beep2) = true; - GVAR(time3) = ACE_time + 5; + // Ring if we got a big increase in the last second or enough accumulated damage + if (GVAR(deafnessDV) - GVAR(deafnessPrior) > 1 || + GVAR(deafnessDV) > 10) then { + + if (ACE_time - GVAR(time3) < 3) exitWith {}; + GVAR(time3) = ACE_time; + + if (GVAR(deafnessDV) > 19.75) then { + playSound (["ACE_Combat_Deafness_Heavy", "ACE_Combat_Deafness_Heavy_NoRing"] select GVAR(DisableEarRinging)); + } else { + playSound (["ACE_Combat_Deafness_Medium", "ACE_Combat_Deafness_Medium_NoRing"] select GVAR(DisableEarRinging)); }; }; - GVAR(deafnessPrior) = GVAR(deafnessDV); - if (GVAR(deafnessDV) > 19.75) then { - ACE_player setVariable [QGVAR(deaf), true]; - if ((!GVAR(DisableEarRinging)) && {ACE_time > GVAR(time4)}) then { - playSound "ACE_Combat_Deafness"; - GVAR(beep2) = true; - GVAR(time3) = ACE_time + 10; - GVAR(time4) = ACE_time + 30; - }; - } else { - ACE_player setVariable [QGVAR(deaf), false]; - }; - - if (GVAR(deafnessDV) > 10) then { - //check if the ringing is already being played - if (ACE_time > GVAR(time2)) then { - GVAR(beep) = false; - }; - if ((!GVAR(DisableEarRinging)) && {!GVAR(beep)}) then { - playSound "ACE_Ring_Backblast"; - GVAR(time2) = ACE_time + 22; - GVAR(beep) = true; - }; - }; - // Hearing takes longer to return to normal after it hits rock bottom GVAR(deafnessDV) = (GVAR(deafnessDV) - (0.5 * (GVAR(volume) max 0.1))) max 0; }; -if ((missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false]) || {!GVAR(enableCombatDeafness)}) exitWith {}; +if (missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false]) exitWith {}; -_volume = GVAR(volume); +private _volume = GVAR(volume); -// Earplugs reduce hearing 50% -if ([ACE_player] call FUNC(hasEarPlugsIn)) then { - _volume = _volume min GVAR(EarplugsVolume); -}; - -// Headgear can reduce hearing -if(headgear ACE_player != "") then { - private ["_lowerVolume"]; - _lowerVolume = (getNumber (configFile >> "CfgWeapons" >> (headgear ACE_player) >> QGVAR(lowerVolume))) min 1; - if(_lowerVolume > 0) then { - _volume = _volume min (1 - _lowerVolume); - }; -}; +// Earplugs and headgear can attenuate hearing +_volume = _volume min GVAR(volumeAttenuation); // Reduce volume if player is unconscious if (ACE_player getVariable ["ACE_isUnconscious", false]) then { _volume = _volume min GVAR(UnconsciousnessVolume); }; -_soundTransitionTime = if (_justUpdateVolume) then {0.1} else {1}; +private _soundTransitionTime = if (_justUpdateVolume) then {0.1} else {1}; _soundTransitionTime fadeSound _volume; _soundTransitionTime fadeSpeech _volume; diff --git a/addons/hearing/script_component.hpp b/addons/hearing/script_component.hpp index 194e150375..de1ff267e4 100644 --- a/addons/hearing/script_component.hpp +++ b/addons/hearing/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_HEARING #define DEBUG_MODE_FULL diff --git a/addons/hearing/sounds/deafness_noring.ogg b/addons/hearing/sounds/deafness_noring.ogg new file mode 100644 index 0000000000..3427c16179 Binary files /dev/null and b/addons/hearing/sounds/deafness_noring.ogg differ diff --git a/addons/hearing/stringtable.xml b/addons/hearing/stringtable.xml index 71767a0cb0..0878e25379 100644 --- a/addons/hearing/stringtable.xml +++ b/addons/hearing/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -97,7 +97,7 @@ Nincs több hely Нет места в инвентаре - + Disable ear ringing Désactiver le bourdonnement Desactivar zumbido de oídos @@ -109,6 +109,10 @@ Disabilita i fischi nelle orecchie Desabilitar zumbido de ouvidos + + Remove tinnitus effect when the player takes hearing damage + Deaktiviert Ohrklingeln wenn der Spieler Hörschäden davonträgt. + Hearing Słuch @@ -119,26 +123,29 @@ Audition Hallás Слух + Udito - - Combat Deafness + + Enable Combat Deafness Wł. głuchotę bojową - ¿Habilitar sordera de combate? + 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? Оглушение + Sordità da combattimento - + Reduces the hearing ability as the player takes hearing damage Możliwość chwilowej utraty słuchu przy głośnych wystrzałach i jednoczesnym braku włożonych stoperów Habilita la sordera de combate - Aktiviere Taubheit im Gefecht? - Povolit ztrátu sluchu? + Verringert das Hörvermögen wenn der Spieler einen Hörschaden davonträg + Snižuje schopnost sluchu pokud dojde k jeho poškození hlasitou a blízkou střelbou Ativar surdez em combate? Уменьшает возможность игрока слышать звуки при повреждении органов слуха + Riduci l'abilità uditiva quando il giocatore riceve danno uditivo 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 @@ -150,6 +157,7 @@ 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 + Controlla la sordità da combattimento e fischio alle orecchie. Quando attivato, i giocatori possono essere assordati quando un'arma spara vicino o avviene un'esplosione senza protezione uditiva Effect Zeus RC @@ -158,7 +166,8 @@ Влияет на юнита Зевса Afeta Zeus CR Efecto Zeus RC - Ovlivnit Zeus RC + Vliv na Zeus RC + Effetto Zeus RC Allow zeus remote controlled units to be able to take hearing damage. @@ -168,18 +177,25 @@ 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. Aktivovat efekt ztráty sluchu pro vzdáleně ovládané jednotky. + Consenti alle unità controllate in remoto da Zeus di ricevere danni all'udito. Add earplugs to units + Füge Ohrenstöpsel zu Einheiten hinzu Dodaj stopery dla jednostek Добавлять юнитам беруши Adiciona protetores de ouvido as unidades + Přidat špunty jednotce + Aggiungi Tappi per Orecchie alle unità Add the `ACE_EarPlugs` item to all units that have loud weapons. Can disable if using custom loadouts. + Fügt die "ACE_EarPlugs" zu allen Einheiten mit lauten Waffen hinzu. Wird deaktiviert wenn eine eigene Inventarkonfiguration vorgenommen wurde. Dodaje `ACE_EarPlugs` - stopery - do wszystkich jednostek, które posiadają głośną broń. Można wyłaczyć w przypadku korzystania z niestandardowych loadoutów. Добавляет предмет `ACE_EarPlugs` всем юнитам, которые имеют громкое оружие. Можно отключить при ручной настройке снаряжения. Adicionar o item `ACE_EarPlugs` a todas as unidades que tenham armas barulhentas. Pode ser desabilitado com carregamentos customizados. + Přidat `ACE_EarPlugs` všem jednotkám které mají zbraň. Můžete vypnout, pokud používáte vlastní výbavu. + Aggiungi l'oggetto 'ACE_EarPlugs' a tutte le unità che hanno armi rumorose. Può essere disabilitato se vengono usati loadout personalizzati. - \ No newline at end of file + diff --git a/addons/hitreactions/CfgEventHandlers.hpp b/addons/hitreactions/CfgEventHandlers.hpp index 1eea968973..bb990cafea 100644 --- a/addons/hitreactions/CfgEventHandlers.hpp +++ b/addons/hitreactions/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/hitreactions/XEH_PREP.hpp b/addons/hitreactions/XEH_PREP.hpp new file mode 100644 index 0000000000..7701b8ef19 --- /dev/null +++ b/addons/hitreactions/XEH_PREP.hpp @@ -0,0 +1,3 @@ + +PREP(fallDown); +PREP(getRandomAnimation); diff --git a/addons/hitreactions/XEH_preInit.sqf b/addons/hitreactions/XEH_preInit.sqf index d3c0973ee7..a7feade1c3 100644 --- a/addons/hitreactions/XEH_preInit.sqf +++ b/addons/hitreactions/XEH_preInit.sqf @@ -2,6 +2,6 @@ ADDON = false; -PREP(fallDown); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/hitreactions/XEH_preStart.sqf b/addons/hitreactions/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/hitreactions/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/hitreactions/functions/fnc_fallDown.sqf b/addons/hitreactions/functions/fnc_fallDown.sqf index d93b99bd6b..9ed43ae14f 100644 --- a/addons/hitreactions/functions/fnc_fallDown.sqf +++ b/addons/hitreactions/functions/fnc_fallDown.sqf @@ -35,8 +35,7 @@ if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then { [_unit] call EFUNC(medical,playInjuredSound); }; -private "_vehicle"; -_vehicle = vehicle _unit; +private _vehicle = vehicle _unit; // handle static weapons if (_vehicle isKindOf "StaticWeapon") exitWith { @@ -53,61 +52,20 @@ if (_vehicle != _unit) exitWith {}; if !([_unit, _vehicle] call EFUNC(common,canInteractWith)) exitWith {}; // handle ladders -if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit >> "AGM_isLadder") == 1) exitWith { +if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit >> "ACE_isLadder") == 1) exitWith { _unit action ["LadderOff", nearestObject [position _unit, "House"]]; }; // only play animation when standing due to lack of animations, sry if !(stance _unit in ["CROUCH", "STAND"]) exitWith {}; -private "_velocity"; -_velocity = vectorMagnitude velocity _unit; +private _velocity = vectorMagnitude velocity _unit; // only fall when moving if (_velocity < 2) exitWith {}; // get correct animation by weapon -private "_anim"; - -call { - private "_weapon"; - _weapon = currentWeapon _unit; - - if (_weapon == "") exitWith { - _anim = "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon" - }; - - 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"; - }; - }; - - 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 = ""; -}; +private _anim = _unit call FUNC(getRandomAnimation); // exit if no animation for this weapon exists, i.e. binocular or rocket launcher if (_anim == "") exitWith {}; diff --git a/addons/hitreactions/functions/fnc_getRandomAnimation.sqf b/addons/hitreactions/functions/fnc_getRandomAnimation.sqf new file mode 100644 index 0000000000..996901a31e --- /dev/null +++ b/addons/hitreactions/functions/fnc_getRandomAnimation.sqf @@ -0,0 +1,51 @@ +/* + * Author: commy2 + * Get a random fall animation for the unit. + * + * Arguments: + * 0: unit + * + * Return Value: + * Fall animation + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +private _weapon = currentWeapon _unit; + +if (_weapon == "") exitWith { + "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon" +}; + +if (_weapon == primaryWeapon _unit) exitWith { + if (_unit call EFUNC(common,isPlayer)) then { + private _isRunning = _velocity > 4; + + [ + ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, + ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, + "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft", + "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright" + ] select floor random 4 + } else { + "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon" + }; +}; + +if (_weapon == handgunWeapon _unit) exitWith { + if (_unit call EFUNC(common,isPlayer)) then { + [ + "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", + "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", + "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft", + "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright" + ] select floor random 4 + } else { + "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon" + }; +}; + +"" diff --git a/addons/hitreactions/script_component.hpp b/addons/hitreactions/script_component.hpp index 011a3b6c31..f445ce3f8d 100644 --- a/addons/hitreactions/script_component.hpp +++ b/addons/hitreactions/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT hitreactions #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_HITREACTIONS #define DEBUG_MODE_FULL #endif diff --git a/addons/huntir/CfgEventhandlers.hpp b/addons/huntir/CfgEventhandlers.hpp index 308df09c1b..5da5fd0dc2 100644 --- a/addons/huntir/CfgEventhandlers.hpp +++ b/addons/huntir/CfgEventhandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); @@ -9,11 +16,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - clientFiredBIS = QUOTE(_this call FUNC(handleFired)); - }; - }; -}; \ No newline at end of file diff --git a/addons/huntir/XEH_PREP.hpp b/addons/huntir/XEH_PREP.hpp new file mode 100644 index 0000000000..52597f486c --- /dev/null +++ b/addons/huntir/XEH_PREP.hpp @@ -0,0 +1,6 @@ + +PREP(cam); +PREP(handleFired); +PREP(huntir); +PREP(huntirCompass); +PREP(keypressed); diff --git a/addons/huntir/XEH_postInit.sqf b/addons/huntir/XEH_postInit.sqf index c5526500ac..0c518dfcea 100644 --- a/addons/huntir/XEH_postInit.sqf +++ b/addons/huntir/XEH_postInit.sqf @@ -7,3 +7,8 @@ GVAR(TI) = 0; GVAR(cur_cam) = 0; GVAR(ROTATE) = 0; GVAR(ELEVAT) = 0.01; + +// Register fire event handler +// Don't run for non players, as they are too dumb to launch huntirs anyway +["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); +["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); diff --git a/addons/huntir/XEH_preInit.sqf b/addons/huntir/XEH_preInit.sqf index 0ae45c1540..a7feade1c3 100644 --- a/addons/huntir/XEH_preInit.sqf +++ b/addons/huntir/XEH_preInit.sqf @@ -2,10 +2,6 @@ ADDON = false; -PREP(cam); -PREP(handleFired); -PREP(huntir); -PREP(huntirCompass); -PREP(keypressed); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/huntir/XEH_preStart.sqf b/addons/huntir/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/huntir/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index 1919b4547c..551b9975b6 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -1,16 +1,10 @@ /* * Author: Norrin, Rocko, Ruthberg * - * Handles HuntIR projectiles + * Handles HuntIR projectiles. Called from the unified fired EH for all CAManBase. * * Arguments: - * 0: unit - Object the event handler is assigned to - * 1: weapon - Fired weapon - * 2: muzzle - Muzzle that was used - * 3: mode - Current mode of the fired weapon - * 4: ammo - Ammo used - * 5: magazine - magazine name which was used - * 6: projectile - Object of the projectile that was shot + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -19,10 +13,13 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); if (_ammo != "F_HuntIR") exitWith {}; +if (!hasInterface) exitWith {}; + [{ params ["_projectile"]; diff --git a/addons/huntir/script_component.hpp b/addons/huntir/script_component.hpp index 385c0985ae..5c99e04d46 100644 --- a/addons/huntir/script_component.hpp +++ b/addons/huntir/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_HUNTIR #define DEBUG_MODE_FULL diff --git a/addons/huntir/stringtable.xml b/addons/huntir/stringtable.xml index 5cb9729dd7..2331c3855c 100644 --- a/addons/huntir/stringtable.xml +++ b/addons/huntir/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -17,7 +17,7 @@ HuntIR Round HuntIR Granate Proyectil HuntIR - HuntIR Round + HuntIR náboj HuntIR снаряд HuntIR Round Nabój HuntIR @@ -101,7 +101,7 @@ Help Hilfe Ayuda - Pomoc + Nápověda Помощь Help Pomoc @@ -171,7 +171,7 @@ R - Reset camera - R - Reset + R - Kamera zurücksetzen R - Reiniciar camara R - Reset kamery R - Сбросить настройки камеры @@ -194,4 +194,4 @@ Esc - Sai do Ajuda - \ No newline at end of file + diff --git a/addons/interact_menu/CfgEventHandlers.hpp b/addons/interact_menu/CfgEventHandlers.hpp index 1301f022d3..fa53ccf57c 100644 --- a/addons/interact_menu/CfgEventHandlers.hpp +++ b/addons/interact_menu/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -6,7 +13,7 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); + clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); }; }; @@ -16,4 +23,10 @@ class Extended_InitPost_EventHandlers { init = QUOTE(_this call FUNC(compileMenu);_this call FUNC(compileMenuSelfAction)); }; }; -}; \ No newline at end of file +}; + +class Extended_DisplayLoad_EventHandlers { + class RscDiary { + ADDON = QUOTE(call COMPILE_FILE(XEH_displayLoad)); + }; +}; diff --git a/addons/interact_menu/XEH_PREP.hpp b/addons/interact_menu/XEH_PREP.hpp new file mode 100644 index 0000000000..b571b19162 --- /dev/null +++ b/addons/interact_menu/XEH_PREP.hpp @@ -0,0 +1,27 @@ + +PREP(addActionToClass); +PREP(addActionToObject); +PREP(addMainAction); +PREP(compileMenu); +PREP(compileMenuSelfAction); +PREP(compileMenuZeus); +PREP(collectActiveActionTree); +PREP(createAction); +PREP(ctrlSetParsedTextCached); +PREP(findActionNode); +PREP(handlePlayerChanged); +PREP(isSubPath); +PREP(keyDown); +PREP(keyUp); +PREP(removeActionFromClass); +PREP(removeActionFromObject); +PREP(render); +PREP(renderActionPoints); +PREP(renderBaseMenu); +PREP(renderIcon); +PREP(renderMenu); +PREP(renderSelector); +PREP(setupTextColors); +PREP(splitPath); +PREP(userActions_addHouseActions); +PREP(userActions_getHouseActions); diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index f5e8a57db5..4e4e6025a3 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -25,17 +25,6 @@ GVAR(ParsedTextCached) = []; //Add Actions to Houses: ["interactMenuOpened", {_this call FUNC(userActions_addHouseActions)}] call EFUNC(common,addEventHandler); -// 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)}; - - // Install the render EH on the map screen - ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", DFUNC(render)]; -}; - - ["ACE3 Common", QGVAR(InteractKey), (localize LSTRING(InteractKey)), { // Statement @@ -76,29 +65,3 @@ GVAR(ParsedTextCached) = []; if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);}; if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;}; }] 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_displayLoad.sqf b/addons/interact_menu/XEH_displayLoad.sqf new file mode 100644 index 0000000000..5d190e3d74 --- /dev/null +++ b/addons/interact_menu/XEH_displayLoad.sqf @@ -0,0 +1,9 @@ +#include "script_component.hpp" + +disableSerialization; + +params ["_display"]; + +if (ctrlIDD _display == 12) then { // RscDisplayMainMap + (_display displayCtrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(render)}]; +}; diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 73b543250e..ac3ee9b0f5 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -2,32 +2,7 @@ ADDON = false; -PREP(addActionToClass); -PREP(addActionToObject); -PREP(addMainAction); -PREP(compileMenu); -PREP(compileMenuSelfAction); -PREP(compileMenuZeus); -PREP(collectActiveActionTree); -PREP(createAction); -PREP(ctrlSetParsedTextCached); -PREP(findActionNode); -PREP(handlePlayerChanged); -PREP(isSubPath); -PREP(keyDown); -PREP(keyUp); -PREP(removeActionFromClass); -PREP(removeActionFromObject); -PREP(render); -PREP(renderActionPoints); -PREP(renderBaseMenu); -PREP(renderIcon); -PREP(renderMenu); -PREP(renderSelector); -PREP(setupTextColors); -PREP(splitPath); -PREP(userActions_addHouseActions); -PREP(userActions_getHouseActions); +#include "XEH_PREP.hpp" // Event handlers for all interact menu controls DFUNC(handleMouseMovement) = { @@ -74,11 +49,6 @@ GVAR(collectedActionPoints) = []; GVAR(foundActions) = []; GVAR(lastTimeSearchedActions) = -1000; - -// Init CAManBase menus -["CAManBase"] call FUNC(compileMenu); -["CAManBase"] call FUNC(compileMenuSelfAction); - // Init zeus menu [] call FUNC(compileMenuZeus); diff --git a/addons/interact_menu/XEH_preStart.sqf b/addons/interact_menu/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/interact_menu/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/interact_menu/functions/fnc_addActionToClass.sqf b/addons/interact_menu/functions/fnc_addActionToClass.sqf index f720903a6d..68efce4f2c 100644 --- a/addons/interact_menu/functions/fnc_addActionToClass.sqf +++ b/addons/interact_menu/functions/fnc_addActionToClass.sqf @@ -30,9 +30,8 @@ if (_typeNum == 0) then { [_objectType] call FUNC(compileMenuSelfAction); }; -private ["_varName","_actionTrees", "_parentNode"]; -_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; -_actionTrees = missionNamespace getVariable [_varName, []]; +private _varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; +private _actionTrees = missionNamespace getVariable [_varName, []]; if((count _actionTrees) == 0) then { missionNamespace setVariable [_varName, _actionTrees]; }; @@ -41,7 +40,7 @@ if (_parentPath isEqualTo ["ACE_MainActions"]) then { [_objectType, _typeNum] call FUNC(addMainAction); }; -_parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode); +private _parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode); 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); diff --git a/addons/interact_menu/functions/fnc_addActionToObject.sqf b/addons/interact_menu/functions/fnc_addActionToObject.sqf index 8cd2270d48..31e15ae7aa 100644 --- a/addons/interact_menu/functions/fnc_addActionToObject.sqf +++ b/addons/interact_menu/functions/fnc_addActionToObject.sqf @@ -23,10 +23,10 @@ if (!params [["_object", objNull, [objNull]], ["_typeNum", 0, [0]], ["_parentPat ERROR("Bad Params"); }; -private ["_varName","_actionList"]; -_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; -_actionList = _object getVariable [_varName, []]; -if((count _actionList) == 0) then { +private _varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; +private _actionList = _object getVariable [_varName, []]; + +if (_actionList isEqualTo []) then { _object setVariable [_varName, _actionList]; }; diff --git a/addons/interact_menu/functions/fnc_addMainAction.sqf b/addons/interact_menu/functions/fnc_addMainAction.sqf index cf2a3f51d4..161e12d6de 100644 --- a/addons/interact_menu/functions/fnc_addMainAction.sqf +++ b/addons/interact_menu/functions/fnc_addMainAction.sqf @@ -18,14 +18,12 @@ 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); +private _varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; +private _actionTrees = missionNamespace getVariable [_varName, []]; +private _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); + private _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_collectActiveActionTree.sqf b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf index 4da303f618..42fcf96cc7 100644 --- a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf +++ b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf @@ -6,6 +6,7 @@ * 0: Object * 1: Original action tree * 2: Parent path + * 3: Distance to base point (will be 0 for self/zeus/in-vehicle) * * Return value: * Active children @@ -14,13 +15,11 @@ */ #include "script_component.hpp" -params ["_object", "_origAction", "_parentPath"]; +params ["_object", "_origAction", "_parentPath", "_distanceToBasePoint"]; _origAction params ["_origActionData", "_origActionChildren"]; -private ["_target","_player","_fullPath","_activeChildren","_dynamicChildren","_action","_actionData","_x"]; - -_target = _object; -_player = ACE_player; +private _target = _object; +private _player = ACE_player; // Check if the function should be modified first if !((_origActionData select 10) isEqualTo {}) then { @@ -29,54 +28,62 @@ if !((_origActionData select 10) isEqualTo {}) then { [_target, ACE_player, _origActionData select 6, _origActionData] call (_origActionData select 10); }; +_origActionData params ["_actionName", "", "", "_statementCode", "_conditionCode", "_insertChildrenCode", "_customParams", "", "_distance"]; + // Return nothing if the action itself is not active -if !([_target, ACE_player, _origActionData select 6] call (_origActionData select 4)) exitWith { +if !([_target, ACE_player, _customParams] call _conditionCode) exitWith { [] }; -_fullPath = +_parentPath; -_fullPath pushBack (_origActionData select 0); -_activeChildren = []; +// Return nothing if the action is to far (including checking sub actions) [DISABLED FOR NOW ref #2196] +// if (_distanceToBasePoint > _distance) exitWith { + // [] +// }; + +private _fullPath = +_parentPath; +_fullPath pushBack _actionName; +private _activeChildren = []; // If there's a statement to dynamically insert children then execute it -if !({} isEqualTo (_origActionData select 5)) then { - _dynamicChildren = [_target, ACE_player, _origActionData select 6] call (_origActionData select 5); +if !({} isEqualTo _insertChildrenCode) then { + private _dynamicChildren = [_target, ACE_player, _customParams] call _insertChildrenCode; // Collect dynamic children class actions { - _action = [_x select 2, _x, _fullPath] call FUNC(collectActiveActionTree); + private _action = [_x select 2, _x, _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree); if ((count _action) > 0) then { _activeChildren pushBack _action; }; - } forEach _dynamicChildren; + nil + } count _dynamicChildren; }; // Collect children class actions { - _action = [_object, _x, _fullPath] call FUNC(collectActiveActionTree); + private _action = [_object, _x, _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree); if ((count _action) > 0) then { _activeChildren pushBack _action; }; -} forEach _origActionChildren; + nil +} count _origActionChildren; // Collect children object actions { - EXPLODE_2_PVT(_x,_actionData,_pPath); + _x params ["_actionData", "_pPath"]; // Check if the action is children of the original action - if (count _pPath == count _fullPath && - {_pPath isEqualTo _fullPath}) then { - - _action = [_object, [_actionData,[]], _fullPath] call FUNC(collectActiveActionTree); + if (_pPath isEqualTo _fullPath) then { + private _action = [_object, [_actionData,[]], _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree); if ((count _action) > 0) then { _activeChildren pushBack _action; }; }; -} forEach GVAR(objectActionList); + nil +} count GVAR(objectActionList); // If the original action has no statement, and no children, don't display it -if ((count _activeChildren) == 0 && ((_origActionData select 3) isEqualTo {})) exitWith { +if ((_activeChildren isEqualTo []) && {_statementCode isEqualTo {}}) exitWith { // @todo: Account for showDisabled? [] }; diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index d84130e21c..02941626d1 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -14,34 +14,31 @@ params ["_target"]; -private ["_objectType","_actionsVarName","_isMan"]; -_objectType = _target; -_isMan = false; +private _objectType = _target; if (_target isEqualType objNull) then { _objectType = typeOf _target; - _isMan = _target isKindOf "CAManBase"; }; -_actionsVarName = format [QGVAR(Act_%1), _objectType]; +private _actionsVarName = format [QGVAR(Act_%1), _objectType]; // Exit if the action menu is already compiled for this class if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {}; -private "_recurseFnc"; -_recurseFnc = { - private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_position", "_condition", "_showDisabled", "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; - params ["_actionsCfg"]; - _actions = []; +private _recurseFnc = { + params ["_actionsCfg", "_parentDistance"]; + private _actions = []; { - _entryCfg = _x; + private _entryCfg = _x; if(isClass _entryCfg) then { - _displayName = getText (_entryCfg >> "displayName"); - _distance = getNumber (_entryCfg >> "distance"); - _icon = getText (_entryCfg >> "icon"); - _statement = compile (getText (_entryCfg >> "statement")); + private _displayName = getText (_entryCfg >> "displayName"); + private _distance = _parentDistance; + if (isNumber (_entryCfg >> "distance")) then {_distance = getNumber (_entryCfg >> "distance");}; + // if (_distance < _parentDistance) then {ACE_LOGWARNING_3("[%1] distance %2 less than parent %3", configName _entryCfg, _distance, _parentDistance);}; + private _icon = getText (_entryCfg >> "icon"); + private _statement = compile (getText (_entryCfg >> "statement")); // If the position entry is present, compile it - _position = getText (_entryCfg >> "position"); + private _position = getText (_entryCfg >> "position"); if (_position != "") then { _position = compile _position; } else { @@ -55,7 +52,7 @@ _recurseFnc = { }; }; - _condition = getText (_entryCfg >> "condition"); + private _condition = getText (_entryCfg >> "condition"); if (_condition == "") then {_condition = "true"}; // Add canInteract (including exceptions) and canInteractWith to condition @@ -63,13 +60,13 @@ _recurseFnc = { _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; }; - _insertChildren = compile (getText (_entryCfg >> "insertChildren")); - _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); + private _insertChildren = compile (getText (_entryCfg >> "insertChildren")); + private _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); - _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; - _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; - _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; - _runOnHover = false; + private _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + private _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + private _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; + private _runOnHover = false; if (isText (_entryCfg >> "runOnHover")) then { _runOnHover = compile getText (_entryCfg >> "runOnHover"); } else { @@ -77,9 +74,9 @@ _recurseFnc = { }; _condition = compile _condition; - _children = [_entryCfg] call _recurseFnc; + private _children = [_entryCfg, _distance] call _recurseFnc; - _entry = [ + private _entry = [ [ configName _entryCfg, _displayName, @@ -97,19 +94,16 @@ _recurseFnc = { ]; _actions pushBack _entry; }; - } forEach (configProperties [_actionsCfg, "isClass _x", true]); + nil + } count (configProperties [_actionsCfg, "isClass _x", true]); _actions }; -private ["_actionsCfg","_actions"]; -_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions"; +private _actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions"; + +TRACE_1("Building ACE_Actions",_objectType); +private _actions = [_actionsCfg, 0] call _recurseFnc; -// If the classname inherits from CAManBase, just copy it's menu without recompiling a new one -_actions = if (_isMan) then { - + (missionNamespace getVariable QGVAR(Act_CAManBase)) -} else { - [_actionsCfg] call _recurseFnc -}; missionNamespace setVariable [_actionsVarName, _actions]; /* @@ -125,7 +119,7 @@ missionNamespace setVariable [_actionsVarName, _actions]; [], {[0,0,0]}, 1, - [false,false,false] + [false,false,false,false,false] ], [children actions] ] diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index 123f83110d..de1364ee84 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -14,46 +14,42 @@ params ["_target"]; -private ["_objectType","_actionsVarName","_isMan"]; -_objectType = _target; -_isMan = false; +private _objectType = _target; if (_target isEqualType objNull) then { _objectType = typeOf _target; - _isMan = _target isKindOf "CAManBase"; }; -_actionsVarName = format [QGVAR(SelfAct_%1), _objectType]; +private _actionsVarName = format [QGVAR(SelfAct_%1), _objectType]; // Exit if the action menu is already compiled for this class if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {}; -private "_recurseFnc"; -_recurseFnc = { - private ["_actions", "_displayName", "_icon", "_statement", "_condition", "_showDisabled", - "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; + +private _recurseFnc = { params ["_actionsCfg"]; - _actions = []; + + private _actions = []; { - _entryCfg = _x; + private _entryCfg = _x; if(isClass _entryCfg) then { - _displayName = getText (_entryCfg >> "displayName"); + private _displayName = getText (_entryCfg >> "displayName"); - _icon = getText (_entryCfg >> "icon"); - _statement = compile (getText (_entryCfg >> "statement")); + private _icon = getText (_entryCfg >> "icon"); + private _statement = compile (getText (_entryCfg >> "statement")); - _condition = getText (_entryCfg >> "condition"); + private _condition = getText (_entryCfg >> "condition"); if (_condition == "") then {_condition = "true"}; // Add canInteract (including exceptions) and canInteractWith to condition _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; - _insertChildren = compile (getText (_entryCfg >> "insertChildren")); - _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); + private _insertChildren = compile (getText (_entryCfg >> "insertChildren")); + private _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); - _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; - _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; - _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; - _runOnHover = true; + private _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + private _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + private _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; + private _runOnHover = true; if (isText (_entryCfg >> "runOnHover")) then { _runOnHover = compile getText (_entryCfg >> "runOnHover"); } else { @@ -61,9 +57,9 @@ _recurseFnc = { }; _condition = compile _condition; - _children = [_entryCfg] call _recurseFnc; + private _children = [_entryCfg] call _recurseFnc; - _entry = [ + private _entry = [ [ configName _entryCfg, _displayName, @@ -81,16 +77,15 @@ _recurseFnc = { ]; _actions pushBack _entry; }; - } forEach (configProperties [_actionsCfg, "isClass _x", true]); + nil + } count (configProperties [_actionsCfg, "isClass _x", true]); _actions }; -private ["_actionsCfg","_actions"]; -_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions"; +private _actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions"; -private ["_baseDisplayName", "_baseIcon"]; -_baseDisplayName = ""; -_baseIcon = ""; +private _baseDisplayName = ""; +private _baseIcon = ""; if (_objectType isKindOf "CAManBase") then { _baseDisplayName = localize LSTRING(SelfActionsRoot); _baseIcon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; @@ -107,12 +102,9 @@ if (_objectType isKindOf "CAManBase") then { }; }; -// If the classname inherits from CAManBase, just copy it's menu without recompiling a new one -_actions = if (_isMan) then { - + (missionNamespace getVariable QGVAR(SelfAct_CAManBase)) -} else { - // Create a master action to base on self action - [ +TRACE_1("Building ACE_SelfActions",_objectType); +// Create a master action to base on self action +private _actions = [ [ [ "ACE_SelfActions", @@ -127,11 +119,10 @@ _actions = if (_isMan) then { {}, "Spine3", 10, - [false,true,false] + [false,true,false,false,false] ], [_actionsCfg] call _recurseFnc ] - ] -}; + ]; missionNamespace setVariable [_actionsVarName, _actions]; diff --git a/addons/interact_menu/functions/fnc_compileMenuZeus.sqf b/addons/interact_menu/functions/fnc_compileMenuZeus.sqf index ef7c36abc9..6026735154 100644 --- a/addons/interact_menu/functions/fnc_compileMenuZeus.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuZeus.sqf @@ -15,41 +15,38 @@ // Exit if the action menu is already compiled for zeus if !(isNil {missionNamespace getVariable [QGVAR(ZeusActions), nil]}) exitWith {}; -private "_recurseFnc"; -_recurseFnc = { - private ["_actions", "_displayName", "_icon", "_statement", "_condition", "_showDisabled", - "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; +private _recurseFnc = { params ["_actionsCfg"]; - _actions = []; + private _actions = []; { - _entryCfg = _x; + private _entryCfg = _x; if(isClass _entryCfg) then { - _displayName = getText (_entryCfg >> "displayName"); + private _displayName = getText (_entryCfg >> "displayName"); - _icon = getText (_entryCfg >> "icon"); - _statement = compile (getText (_entryCfg >> "statement")); + private _icon = getText (_entryCfg >> "icon"); + private _statement = compile (getText (_entryCfg >> "statement")); - _condition = getText (_entryCfg >> "condition"); + private _condition = getText (_entryCfg >> "condition"); if (_condition == "") then {_condition = "true"}; - _insertChildren = compile (getText (_entryCfg >> "insertChildren")); - _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); + private _insertChildren = compile (getText (_entryCfg >> "insertChildren")); + private _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); - _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; - _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; - _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; - _runOnHover = true; + private _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + private _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + private _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; + private _runOnHover = true; if (isText (_entryCfg >> "runOnHover")) then { _runOnHover = compile getText (_entryCfg >> "runOnHover"); } else { _runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0; }; - _condition = compile _condition; - _children = [_entryCfg] call _recurseFnc; + private _condition = compile _condition; + private _children = [_entryCfg] call _recurseFnc; - _entry = [ + private _entry = [ [ configName _entryCfg, _displayName, @@ -60,7 +57,7 @@ _recurseFnc = { {}, [0,0,0], 10, //distace - [_showDisabled,_enableInside,_canCollapse,_runOnHover], + [_showDisabled,_enableInside,_canCollapse,_runOnHover,false], _modifierFunction ], _children @@ -71,8 +68,7 @@ _recurseFnc = { _actions }; -private ["_actionsCfg"]; -_actionsCfg = configFile >> "ACE_ZeusActions"; +private _actionsCfg = configFile >> "ACE_ZeusActions"; // Create a master action to base zeus actions on GVAR(ZeusActions) = [ @@ -87,7 +83,7 @@ GVAR(ZeusActions) = [ {}, {[0,0,0]}, 10, - [false,true,false] + [false,true,false,false,false] ], [_actionsCfg] call _recurseFnc ] diff --git a/addons/interact_menu/functions/fnc_createAction.sqf b/addons/interact_menu/functions/fnc_createAction.sqf index 0edef384d4..db31200c47 100644 --- a/addons/interact_menu/functions/fnc_createAction.sqf +++ b/addons/interact_menu/functions/fnc_createAction.sqf @@ -13,7 +13,7 @@ * 6: Action parameters (Optional) * 7: Position (Position array, Position code or Selection Name) , or (Optional) * 8: Distance (Optional) - * 9: Other parameters (Optional) + * 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] (Optional) * 10: Modifier function (Optional) * * Return value: @@ -26,6 +26,8 @@ */ #include "script_component.hpp" +// IGNORE_PRIVATE_WARNING(_actionName,_displayName,_icon,_statement,_condition,_insertChildren,_customParams,_position,_distance,_params,_modifierFunction); + params [ "_actionName", "_displayName", @@ -41,16 +43,16 @@ params [ ]; _position = if (_position isEqualType "") then { - // If the action is set to a selection, create the suitable code - compile format ["_target selectionPosition '%1'", _position]; + // If the action is set to a selection, create the suitable code - IGNORE_PRIVATE_WARNING(_target); + compile format ["_target selectionPosition '%1'", _position]; +} else { + if (_position isEqualType []) then { + // If the action is set to a array position, create the suitable code + compile format ["%1", _position]; } else { - if (_position isEqualType []) then { - // If the action is set to a array position, create the suitable code - compile format ["%1", _position]; - } else { - _position; - }; + _position; }; +}; [ _actionName, @@ -58,7 +60,6 @@ _position = if (_position isEqualType "") then { _icon, _statement, _condition, - _insertChildren, _customParams, _position, diff --git a/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf index 334fc13f25..1c4e535d66 100644 --- a/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf +++ b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf @@ -1,11 +1,24 @@ -// by commy2 +/* + * Author: commy2 + * Sets the controls structured text if it isn't already set. + * + * Argument: + * 0: Structured Text Ctrl + * 1: Index + * 2: Text + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp" params ["_ctrl", "_index", "_text"]; //systemChat str (_text != ARR_SELECT(GVAR(ParsedTextCached),_index,"-1")); -if (_text != ARR_SELECT(GVAR(ParsedTextCached),_index,"-1")) then { +if (_text != (GVAR(ParsedTextCached) param [_index,"-1"])) then { GVAR(ParsedTextCached) set [_index, _text]; _ctrl ctrlSetStructuredText parseText _text; }; diff --git a/addons/interact_menu/functions/fnc_findActionNode.sqf b/addons/interact_menu/functions/fnc_findActionNode.sqf index 41ab658a62..edd0cace04 100644 --- a/addons/interact_menu/functions/fnc_findActionNode.sqf +++ b/addons/interact_menu/functions/fnc_findActionNode.sqf @@ -11,7 +11,7 @@ * Action node or if not found * * Example: - * [_actionTree, ["ACE_TapShoulderRight","VulcanPinchAction"]] call ace_interact_menu_fnc_findActionNode; + * [actionTree, ["ACE_TapShoulderRight","VulcanPinchAction"]] call ace_interact_menu_fnc_findActionNode; * * Public: No */ @@ -19,18 +19,16 @@ params ["_actionTreeList", "_parentPath"]; -private ["_parentNode", "_foundParentNode", "_fnc_findFolder", "_actionTree"]; - // Hack to make this work on the root node too -if (count _parentPath == 0) exitWith { +if (_parentPath isEqualTo []) exitWith { [[],_actionTreeList] }; // Search the class action trees and find where to insert the entry -_parentNode = [[],_actionTreeList]; -_foundParentNode = false; +private _parentNode = [[],_actionTreeList]; +private _foundParentNode = false; -_fnc_findFolder = { +private _fnc_findFolder = { params ["_parentPath", "_level", "_actionNode"]; { diff --git a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf index a0962d7883..d8ad91c434 100644 --- a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf +++ b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf @@ -14,8 +14,7 @@ params ["_newUnit", "_oldUnit"]; // add to new unit -private "_ehid"; -_ehid = [_newUnit, "DefaultAction", {GVAR(openedMenuType) >= 0}, { +private _ehid = [_newUnit, "DefaultAction", {GVAR(openedMenuType) >= 0}, { if (!GVAR(actionOnKeyRelease) && GVAR(actionSelected)) then { [GVAR(openedMenuType),true] call FUNC(keyUp); }; diff --git a/addons/interact_menu/functions/fnc_isSubPath.sqf b/addons/interact_menu/functions/fnc_isSubPath.sqf index 0a02fe2ea7..53d88eb9d1 100644 --- a/addons/interact_menu/functions/fnc_isSubPath.sqf +++ b/addons/interact_menu/functions/fnc_isSubPath.sqf @@ -9,18 +9,20 @@ * Return value: * Bool * + * Example: + * [[["ACE_SelfActions", player],["ace_Gestures", player]], [["ACE_SelfActions", player]]] call ace_interact_menu_fnc_isSubPath + * * Public: No */ #include "script_component.hpp" params ["_longPath", "_shortPath"]; -private ["_isSubPath","_i"]; -_isSubPath = true; +private _isSubPath = true; if (count _shortPath > count _longPath) exitWith {false}; -for [{_i = 0},{_i < count _shortPath},{_i = _i + 1}] do { +for [{private _i = 0},{_i < count _shortPath},{_i = _i + 1}] do { if !((_longPath select _i) isEqualTo (_shortPath select _i)) exitWith { _isSubPath = false; }; diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index 56c0e6e19c..a8759a5007 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -65,7 +65,7 @@ if (GVAR(useCursorMenu)) then { // uiNamespace getVariable QGVAR(cursorMenuOpened); GVAR(cursorPos) = [0.5,0.5,0]; - _ctrl = (findDisplay 91919) ctrlCreate ["RscStructuredText", 9922]; + private _ctrl = (findDisplay 91919) ctrlCreate ["RscStructuredText", 9922]; _ctrl ctrlSetPosition [safeZoneX, safeZoneY, safeZoneW, safeZoneH]; _ctrl ctrlCommit 0; @@ -75,8 +75,7 @@ if (GVAR(useCursorMenu)) then { setMousePosition [0.5, 0.5]; }; -GVAR(selfMenuOffset) = ((positionCameraToWorld [0, 0, 2]) call EFUNC(common,positionToASL)) vectorDiff - ((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)); +GVAR(selfMenuOffset) = (AGLtoASL (positionCameraToWorld [0, 0, 2])) vectorDiff (AGLtoASL (positionCameraToWorld [0, 0, 0])); if (GVAR(menuAnimationSpeed) > 0) then { //Auto expand the first level when self, mounted vehicle or zeus (skips the first animation as there is only one choice) diff --git a/addons/interact_menu/functions/fnc_keyUp.sqf b/addons/interact_menu/functions/fnc_keyUp.sqf index 86580afa67..b6eae6f527 100644 --- a/addons/interact_menu/functions/fnc_keyUp.sqf +++ b/addons/interact_menu/functions/fnc_keyUp.sqf @@ -24,9 +24,8 @@ if (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then { if(GVAR(actionSelected)) then { this = GVAR(selectedTarget); - private ["_player","_target","_actionData"]; - _player = ACE_Player; - _target = GVAR(selectedTarget); + private _player = ACE_Player; + private _target = GVAR(selectedTarget); // Clear the conditions caches ["clearConditionCaches", []] call EFUNC(common,localEvent); @@ -35,7 +34,7 @@ if(GVAR(actionSelected)) then { if (!(GVAR(actionOnKeyRelease)) && !_calledByClicking) exitWith {}; // Check the action conditions - _actionData = GVAR(selectedAction) select 0; + private _actionData = GVAR(selectedAction) select 0; if ([_target, _player, _actionData select 6] call (_actionData select 4)) then { // Call the statement [_target, _player, _actionData select 6] call (_actionData select 3); diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 1f7cf8140b..7ca243817c 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -8,8 +8,12 @@ * Return value: * None * + * Example: + * [] call ace_interact_menu_fnc_render + * * Public: No */ +// #define ENABLE_PERFORMANCE_COUNTERS #include "script_component.hpp" BEGIN_COUNTER(fnc_render); @@ -42,7 +46,7 @@ if (GVAR(openedMenuType) >= 0) then { }; } forEach GVAR(currentOptions); - if(_closestSelection == -1) exitWith {}; + if (_closestSelection == -1) exitWith {END_COUNTER(fnc_renderMenuOpen);}; private _closest = GVAR(currentOptions) select _closestSelection; _closest params ["_action", "_sPos", "_hoverPath"]; diff --git a/addons/interact_menu/functions/fnc_renderActionPoints.sqf b/addons/interact_menu/functions/fnc_renderActionPoints.sqf index c5b2c887ce..1d42f38c6c 100644 --- a/addons/interact_menu/functions/fnc_renderActionPoints.sqf +++ b/addons/interact_menu/functions/fnc_renderActionPoints.sqf @@ -14,56 +14,57 @@ GVAR(currentOptions) = []; -private ["_player","_numInteractObjects","_numInteractions","_actionsVarName","_classActions","_target","_player","_action","_cameraPos","_cameraDir", "_lambda", "_nearestObjects", "_pos", "_virtualPoint", "_wavesAtOrigin", "_wavesAtVirtualPoint"]; -_player = ACE_player; +private _player = ACE_player; -_cameraPos = (positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL); -_cameraDir = ((positionCameraToWorld [0, 0, 1]) call EFUNC(common,positionToASL)) vectorDiff _cameraPos; +private _cameraPosASL = AGLtoASL (positionCameraToWorld [0, 0, 0]); +private _cameraDir = (AGLtoASL (positionCameraToWorld [0, 0, 1])) vectorDiff _cameraPosASL; -_fnc_renderNearbyActions = { +private _fnc_renderNearbyActions = { // Render all nearby interaction menus #define MAXINTERACTOBJECTS 3 GVAR(foundActions) = []; GVAR(lastTimeSearchedActions) = ACE_diagTime; - _numInteractObjects = 0; - _nearestObjects = nearestObjects [ACE_player, ["All"], 13]; + private _numInteractObjects = 0; + private _nearestObjects = nearestObjects [ACE_player, ["All"], 13]; { - _target = _x; + private _target = _x; // Quick oclussion test. Skip objects more than 1 m behind the camera plane - _lambda = ((getPosASL _x) vectorDiff _cameraPos) vectorDotProduct _cameraDir; + private _lambda = ((getPosASL _x) vectorDiff _cameraPosASL) vectorDotProduct _cameraDir; if ((_lambda > -1) && {!isObjectHidden _target}) then { - _numInteractions = 0; + private _numInteractions = 0; // Prevent interacting with yourself or your own vehicle if (_target != ACE_player && {_target != vehicle ACE_player}) then { // Iterate through object actions, find base level actions and render them if appropiate - _actionsVarName = format [QGVAR(Act_%1), typeOf _target]; GVAR(objectActionList) = _target getVariable [QGVAR(actions), []]; { // Only render them directly if they are base level actions - if (count (_x select 1) == 0) then { + if ((_x select 1) isEqualTo []) then { // Try to render the menu - _action = _x; + private _action = _x; if ([_target, _action] call FUNC(renderBaseMenu)) then { _numInteractions = _numInteractions + 1; GVAR(foundActions) pushBack [_target, _action, GVAR(objectActionList)]; }; }; - } forEach GVAR(objectActionList); + nil + } count GVAR(objectActionList); // Iterate through base level class actions and render them if appropiate - _classActions = missionNamespace getVariable [_actionsVarName, []]; + private _actionsVarName = format [QGVAR(Act_%1), typeOf _target]; + private _classActions = missionNamespace getVariable [_actionsVarName, []]; { - _action = _x; + private _action = _x; // Try to render the menu if ([_target, _action] call FUNC(renderBaseMenu)) then { _numInteractions = _numInteractions + 1; GVAR(foundActions) pushBack [_target, _action, GVAR(objectActionList)]; }; - } forEach _classActions; + nil + } count _classActions; // Limit the amount of objects the player can interact with if (_numInteractions > 0) then { @@ -73,44 +74,33 @@ _fnc_renderNearbyActions = { }; if (_numInteractObjects >= MAXINTERACTOBJECTS) exitWith {}; - } forEach _nearestObjects; + nil + } count _nearestObjects; }; -_fnc_renderLastFrameActions = { +private _fnc_renderLastFrameActions = { { _x params ["_target", "_action", "_objectActionList"]; GVAR(objectActionList) = _objectActionList; [_target, _action] call FUNC(renderBaseMenu); - } forEach GVAR(foundActions); + nil + } count GVAR(foundActions); }; -_fnc_renderSelfActions = { - _target = _this; +private _fnc_renderSelfActions = { + private _target = _this; - // Iterate through object actions, find base level actions and render them if appropiate - _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; + // Set object actions for collectActiveActionTree GVAR(objectActionList) = _target getVariable [QGVAR(selfActions), []]; - /* - { - _action = _x; - // Only render them directly if they are base level actions - if (count (_action select 7) == 1) then { - [_target, _action, 0, [180, 360]] call FUNC(renderMenu); - }; - } forEach GVAR(objectActionList); - */ // Iterate through base level class actions and render them if appropiate - _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; - _classActions = missionNamespace getVariable [_actionsVarName, []]; + private _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; + private _classActions = missionNamespace getVariable [_actionsVarName, []]; - _pos = if !(GVAR(useCursorMenu)) then { - _virtualPoint = (((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)) vectorAdd GVAR(selfMenuOffset)) call EFUNC(common,ASLToPosition); - _wavesAtOrigin = [(positionCameraToWorld [0, 0, 0])] call EFUNC(common,waveHeightAt); - _wavesAtVirtualPoint = [_virtualPoint] call EFUNC(common,waveHeightAt); - _virtualPoint set [2, ((_virtualPoint select 2) - _wavesAtOrigin + _wavesAtVirtualPoint)]; - _virtualPoint + private _pos = if !(GVAR(useCursorMenu)) then { + //Convert to ASL, add offset and then convert back to AGL (handles waves when over water) + ASLtoAGL ((AGLtoASL (positionCameraToWorld [0, 0, 0])) vectorAdd GVAR(selfMenuOffset)); } else { [0.5, 0.5] }; @@ -118,14 +108,16 @@ _fnc_renderSelfActions = { { _action = _x; [_target, _action, _pos] call FUNC(renderBaseMenu); - } forEach _classActions; + nil + } count _classActions; }; -_fnc_renderZeusActions = { +private _fnc_renderZeusActions = { { - _action = _x; + private _action = _x; [_this, _action, [0.5, 0.5]] call FUNC(renderBaseMenu); - } forEach GVAR(ZeusActions); + nil + } count GVAR(ZeusActions); }; @@ -160,11 +152,10 @@ if (count GVAR(collectedActionPoints) > 1) then { // Order action points according to z GVAR(collectedActionPoints) sort true; - private ["_i","_j","_delta"]; - for [{_i = count GVAR(collectedActionPoints) - 1}, {_i > 0}, {_i = _i - 1}] do { - for [{_j = _i - 1}, {_j >= 0}, {_j = _j - 1}] do { + for [{private _i = count GVAR(collectedActionPoints) - 1}, {_i > 0}, {_i = _i - 1}] do { + for [{private _j = _i - 1}, {_j >= 0}, {_j = _j - 1}] do { // Check if action point _i is ocluded by _j - _delta = vectorNormalized ((GVAR(collectedActionPoints) select _i select 1) vectorDiff (GVAR(collectedActionPoints) select _j select 1)); + private _delta = vectorNormalized ((GVAR(collectedActionPoints) select _i select 1) vectorDiff (GVAR(collectedActionPoints) select _j select 1)); // If _i is inside a cone with 20º half angle with origin on _j if (_delta select 2 > 0.94) exitWith { @@ -178,4 +169,5 @@ if (count GVAR(collectedActionPoints) > 1) then { { _x params ["_z", "_sPos", "_activeActionTree"]; [[], _activeActionTree, _sPos, [180,360]] call FUNC(renderMenu); -} forEach GVAR(collectedActionPoints); + nil +} count GVAR(collectedActionPoints); diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index a5ccabf3bf..57ded33be0 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -16,88 +16,83 @@ BEGIN_COUNTER(fnc_renderBaseMenu) -private ["_distance","_pos","_weaponDir","_ref","_sPos","_activeActionTree", "_line"]; - params ["_object", "_baseActionNode"]; _baseActionNode params ["_actionData"]; +_actionData params ["_actionName", "", "", "", "", "", "", "_positionCode", "_distance", "_params"]; -_distance = _actionData select 8; // Obtain a 3D position for the action -_pos = if((count _this) > 2) then { +private _pos = if((count _this) > 2) then { _this select 2 } else { // Setup scope variables for position code - private ["_target"]; - _target = _object; + private _target = _object; // Get action position - _object modelToWorldVisual (call (_actionData select 7)) + _object modelToWorldVisual (call _positionCode) }; // For non-self actions, exit if the action is too far away or ocluded -if (GVAR(openedMenuType) == 0 && (vehicle ACE_player == ACE_player) && (isNull curatorCamera) && +private _distanceToBasePoint = 0; //This will be 0 for self/zeus/in-vehicle (used later to check sub action distance) +if ((GVAR(openedMenuType) == 0) && {vehicle ACE_player == ACE_player} && {isNull curatorCamera} && { - private ["_headPos","_actualDistance"]; - _headPos = ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"); - _actualDistance = _headPos distance _pos; + private _headPos = ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"); + _distanceToBasePoint = _headPos distance _pos; - if (_actualDistance > _distance) exitWith {true}; + if (_distanceToBasePoint > _distance) exitWith {true}; - if ((_actualDistance > 1.5) && {!((_actionData select 9) select 4)}) exitWith { - // If distance to action is greater than 1.5 m, check LOS - _line = [_headPos call EFUNC(common,positionToASL), _pos call EFUNC(common,positionToASL), _object, ACE_player]; - lineIntersects _line + if ((_distanceToBasePoint > 1.2) && {!(_params select 4)}) exitWith { + // If distance to action is greater than 1.2 m and check isn't disabled in params, check LOS + lineIntersects [AGLtoASL _headPos, AGLtoASL _pos, _object, ACE_player] }; false }) exitWith {false}; // Exit if the action is behind you -_sPos = if (count _pos != 2) then { +private _sPos = if (count _pos != 2) then { worldToScreen _pos } else { _pos }; -if(count _sPos == 0) exitWith {false}; +if (_sPos isEqualTo []) exitWith {false}; // Exit if the action is off screen -if ((_sPos select 0) < safeZoneXAbs || (_sPos select 0) > safeZoneXAbs + safeZoneWAbs) exitWith {false}; -if ((_sPos select 1) < safeZoneY || (_sPos select 1) > safeZoneY + safeZoneH) exitWith {false}; +if ((_sPos select 0) < safeZoneXAbs || {(_sPos select 0) > safeZoneXAbs + safeZoneWAbs}) exitWith {false}; +if ((_sPos select 1) < safeZoneY || {(_sPos select 1) > safeZoneY + safeZoneH}) exitWith {false}; BEGIN_COUNTER(fnc_collectActiveActionTree) // Collect active tree -private "_uid"; -_uid = format [QGVAR(ATCache_%1), _actionData select 0]; -_activeActionTree = [ - [_object, _baseActionNode, []], +private _uid = format [QGVAR(ATCache_%1), _actionName]; +private _activeActionTree = [ + [_object, _baseActionNode, [], _distanceToBasePoint], DFUNC(collectActiveActionTree), _object, _uid, 1.0, "interactMenuClosed" ] call EFUNC(common,cachedCall); END_COUNTER(fnc_collectActiveActionTree) -/* +#ifdef DEBUG_MODE_EXTRA diag_log "Printing: _activeActionTree"; -_fnc_print = { - EXPLODE_2_PVT(_this,_level,_node); - EXPLODE_3_PVT(_node,_actionData,_children,_object); +[0, _activeActionTree] call { + params ["_level", "_node"]; + _node params ["_actionData", "_children", "_object"]; diag_log text format ["Level %1 -> %2 on %3", _level, _actionData select 0, _object]; { [_level + 1, _x] call _fnc_print; } forEach _children; }; -[0, _activeActionTree] call _fnc_print; -*/ +#endif + // Check if there's something left for rendering -if (count _activeActionTree == 0) exitWith {false}; +if (_activeActionTree isEqualTo []) exitWith {false}; BEGIN_COUNTER(fnc_renderMenus); -// IGNORE_PRIVATE_WARNING(_cameraPos,_cameraDir); +// IGNORE_PRIVATE_WARNING(_cameraPosASL,_cameraDir); if (count _pos > 2) then { - _sPos pushBack (((_pos call EFUNC(common,positionToASL)) vectorDiff _cameraPos) vectorDotProduct _cameraDir); + _sPos pushBack (((AGLtoASL _pos) vectorDiff _cameraPosASL) vectorDotProduct _cameraDir); } else { _sPos pushBack 0; }; diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index ab909964de..9ead5c65cf 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -15,21 +15,20 @@ */ #include "script_component.hpp" #define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa) -private ["_ctrl", "_pos", "_displayNum"]; params ["_text", "_icon", "_sPos", "_textSettings"]; -//systemChat format ["Icon %1 - %2,%3", _text, _sPos select 0, _sPos select 1]; +TRACE_2("Icon",_text,_sPos); if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { - _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); + private _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); if (GVAR(useCursorMenu)) then { ((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseMoving", DFUNC(handleMouseMovement)]; ((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseButtonDown", DFUNC(handleMouseButtonDown)]; }; }; -_ctrl = GVAR(iconCtrls) select GVAR(iconCount); +private _ctrl = GVAR(iconCtrls) select GVAR(iconCount); if(_icon == "") then { _icon = DEFAULT_ICON; @@ -41,11 +40,10 @@ _text = if (GVAR(UseListMenu)) then { format ["
%3", _icon, _textSettings, "ace_break_line" callExtension _text]; }; -//_ctrl ctrlSetStructuredText parseText _text; [_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached); GVAR(iconCount) = GVAR(iconCount) + 1; -_pos = if (GVAR(UseListMenu)) then { +private _pos = if (GVAR(UseListMenu)) then { [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW] } else { [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW] diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index 573845c08a..6abb980620 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -15,22 +15,20 @@ */ #include "script_component.hpp" -private ["_menuInSelectedPath", "_path", "_menuDepth", "_x", "_offset", "_newPos", "_forEachIndex", "_player", "_pos", "_target", "_textSettings"]; - params ["_parentPath", "_action", "_sPos", "_angles"]; _action params ["_actionData", "_activeChildren", "_actionObject"]; _angles params ["_centerAngle", "_maxAngleSpan"]; -_menuDepth = (count GVAR(menuDepthPath)); +private _menuDepth = (count GVAR(menuDepthPath)); //BEGIN_COUNTER(constructing_paths); // Store path to action -_path = +_parentPath; +private _path = +_parentPath; _path pushBack [_actionData select 0,_actionObject]; // Check if the menu is on the selected path -_menuInSelectedPath = true; +private _menuInSelectedPath = true; { if (_forEachIndex >= (count GVAR(menuDepthPath))) exitWith { _menuInSelectedPath = false; @@ -44,7 +42,7 @@ _menuInSelectedPath = true; //BEGIN_COUNTER(constructing_colors); //Get text color settings string -_textSettings = GVAR(colorSelectedSettings); +private _textSettings = GVAR(colorSelectedSettings); if(!_menuInSelectedPath) then { _textSettings = (GVAR(textSettingsMatrix) select (count _path)) select _menuDepth; }; @@ -68,13 +66,12 @@ if !(_menuInSelectedPath) exitWith {true}; //BEGIN_COUNTER(children); -private ["_numChildren","_angleSpan","_angle","_angleInterval","_scaleX", "_scaleY", "_offset", "_textSize"]; -_numChildren = count _activeChildren; -_angleSpan = _maxAngleSpan min (55 * ((_numChildren) - 1)); +private _numChildren = count _activeChildren; +private _angleSpan = _maxAngleSpan min (55 * ((_numChildren) - 1)); if (_angleSpan >= 305) then { _angleSpan = 360; }; -_angleInterval = 55; +private _angleInterval = 55; if (_angleSpan < 360) then { if (_numChildren > 1) then { _angleInterval = _angleSpan / (_numChildren - 1); @@ -87,15 +84,15 @@ if (_numChildren == 1) then { }; // Scale menu based on the amount of children -_scaleX = 1; -_scaleY = 1; +private _scaleX = 1; +private _scaleY = 1; if (GVAR(UseListMenu)) then { - _textSize = [0.75, 0.875, 1, 1.2, 1.4] select GVAR(textSize); + private _textSize = [0.75, 0.875, 1, 1.2, 1.4] select GVAR(textSize); _scaleX = _textSize * 0.17 * 1.1; _scaleY = 0.17 * 0.30 * 4/3; } else { - _textSize = if (GVAR(textSize) > 2) then {1.3} else {1}; + private _textSize = if (GVAR(textSize) > 2) then {1.3} else {1}; _scaleX = _textSize * 0.17 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5); _scaleY = _textSize * 0.17 * 4/3 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5); }; @@ -106,15 +103,13 @@ if (_menuInSelectedPath && {_menuDepth == count _path}) then { _scaleY = _scaleY * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1)); }; -_target = _actionObject; -_player = ACE_player; +private _target = _actionObject; +private _player = ACE_player; //END_COUNTER(children); -_angle = _centerAngle - _angleSpan / 2; +private _angle = _centerAngle - _angleSpan / 2; { - //BEGIN_COUNTER(children); - private ["_offset","_newPos"]; - _newPos = if (GVAR(UseListMenu)) then { + private _newPos = if (GVAR(UseListMenu)) then { [(_sPos select 0) + _scaleX, (_sPos select 1) + _scaleY * (_forEachIndex - _numChildren/2 + 0.5)]; } else { @@ -122,8 +117,6 @@ _angle = _centerAngle - _angleSpan / 2; (_sPos select 1) + _scaleY * (sin _angle)]; }; - //drawLine3D [_pos, _newPos, [1,0,0,0.8]]; - //END_COUNTER(children); [_path, _x, _newPos, [_angle, 150]] call FUNC(renderMenu); _angle = _angle + _angleInterval; diff --git a/addons/interact_menu/functions/fnc_renderSelector.sqf b/addons/interact_menu/functions/fnc_renderSelector.sqf index 17ded20903..69f8a81b95 100644 --- a/addons/interact_menu/functions/fnc_renderSelector.sqf +++ b/addons/interact_menu/functions/fnc_renderSelector.sqf @@ -15,10 +15,8 @@ params ["_sPos", "_icon"]; -private ["_displayNum", "_ctrl", "_pos"]; - if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { - _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); + private _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); if (GVAR(useCursorMenu)) then { ((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseMoving", DFUNC(handleMouseMovement)]; @@ -26,9 +24,9 @@ if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { }; }; -_ctrl = GVAR(iconCtrls) select GVAR(iconCount); +private _ctrl = GVAR(iconCtrls) select GVAR(iconCount); -_pos = if (GVAR(UseListMenu)) then { +private _pos = if (GVAR(UseListMenu)) then { [_ctrl, GVAR(iconCount), format ["", _icon]] call FUNC(ctrlSetParsedTextCached); [(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW] } else { diff --git a/addons/interact_menu/functions/fnc_setupTextColors.sqf b/addons/interact_menu/functions/fnc_setupTextColors.sqf index c23d68cfd3..cbdd56fb07 100644 --- a/addons/interact_menu/functions/fnc_setupTextColors.sqf +++ b/addons/interact_menu/functions/fnc_setupTextColors.sqf @@ -12,15 +12,13 @@ */ #include "script_component.hpp" -private ["_menuDepth", "_mixColor", "_pathCount", "_row", "_shadowColor", "_textColor", "_textSize", "_colorShadowMax", "_colorShadowMin", "_colorTextMax", "_colorTextMin", "_shadowSetting"]; - //Mixes 2 colors (number arrays) and makes a color string "#AARRGGBB" for structured text -_mixColor = { +private _mixColor = { params ["_color1", "_color2", "_ratio"]; - private ["_return", "_mix", "_index"]; - _return = ""; + + private _return = ""; for "_index" from 0 to 3 do { - _mix = linearConversion [0, 1, _ratio, (_color1 select _index), (_color2 select _index)]; + private _mix = linearConversion [0, 1, _ratio, (_color1 select _index), (_color2 select _index)]; if (_index != 3) then { _return = _return + ([255 * _mix] call EFUNC(common,toHex)); } else { @@ -30,15 +28,17 @@ _mixColor = { _return }; -_colorTextMin = missionNamespace getVariable [QGVAR(colorTextMin), [1,1,1,0.25]]; -_colorTextMax = missionNamespace getVariable [QGVAR(colorTextMax), [1,1,1,1]]; -_colorShadowMin = missionNamespace getVariable [QGVAR(colorShadowMin), [0,0,0,0.25]]; -_colorShadowMax = missionNamespace getVariable [QGVAR(colorShadowMax), [0,0,0,1]]; -_shadowSetting = missionNamespace getVariable [QGVAR(shadowSetting), 2]; -_textSize = missionNamespace getVariable [QGVAR(textSize), 2]; +private _colorTextMin = missionNamespace getVariable [QGVAR(colorTextMin), [1,1,1,0.25]]; +private _colorTextMax = missionNamespace getVariable [QGVAR(colorTextMax), [1,1,1,1]]; +private _colorShadowMin = missionNamespace getVariable [QGVAR(colorShadowMin), [0,0,0,0.25]]; +private _colorShadowMax = missionNamespace getVariable [QGVAR(colorShadowMax), [0,0,0,1]]; +private _shadowSetting = missionNamespace getVariable [QGVAR(shadowSetting), 2]; +private _textSize = missionNamespace getVariable [QGVAR(textSize), 2]; -_textColor = [_colorTextMin, _colorTextMax, 1] call _mixColor; -_shadowColor = [_colorShadowMin, _colorShadowMax, 1] call _mixColor; +TRACE_6("Building text matrix",_colorTextMin,_colorTextMax,_colorShadowMin,_colorShadowMax,_shadowSetting,_textSize); + +private _textColor = [_colorTextMin, _colorTextMax, 1] call _mixColor; +private _shadowColor = [_colorShadowMin, _colorShadowMax, 1] call _mixColor; _textSize = switch (_textSize) do { case (0): {0.4}; case (1): {0.6}; @@ -51,7 +51,7 @@ GVAR(colorSelectedSettings) = format ["color='%1' size='%2' shadow='%3' shadowCo GVAR(textSettingsMatrix) = []; for "_pathCount" from 0 to 15 do { - _row = []; + private _row = []; for "_menuDepth" from 0 to 15 do { if (_menuDepth > 0) then { _textColor = [_colorTextMin, _colorTextMax, (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor; diff --git a/addons/interact_menu/functions/fnc_splitPath.sqf b/addons/interact_menu/functions/fnc_splitPath.sqf index 790ae83466..ba07dc1d9e 100644 --- a/addons/interact_menu/functions/fnc_splitPath.sqf +++ b/addons/interact_menu/functions/fnc_splitPath.sqf @@ -13,12 +13,11 @@ */ #include "script_component.hpp" -private ["_parentPath","_actionName", "_i"]; -_parentPath = []; -for [{_i = 0},{_i < (count _this) - 1},{_i = _i + 1}] do { +private _parentPath = []; +for [{private _i = 0},{_i < (count _this) - 1},{_i = _i + 1}] do { _parentPath pushBack (_this select _i); }; -_actionName = if (count _this > 0) then { +private _actionName = if (count _this > 0) then { _this select ((count _this) - 1); } else { "" diff --git a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf index 98abfdccd1..a83ff46bba 100644 --- a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf +++ b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf @@ -1,7 +1,7 @@ /* * Author: PabstMirror * Scans for nearby "Static" objects (buildings) and adds the UserActions to them. - * Called when interact_menu starts rendering (from "interact_keyDown" event) + * Called when interact_menu starts rendering (from "interactMenuOpened" event) * * Arguments: * 0: Interact Menu Type (0 - world, 1 - self) @@ -10,9 +10,9 @@ * Nothing * * Example: - * [0] call ace_interact_menu_fnc_addHouseActions + * [0] call ace_interact_menu_fnc_userActions_addHouseActions * - * Public: Yes + * Public: No */ #include "script_component.hpp" @@ -26,7 +26,6 @@ if (_interactionType != 0) exitWith {}; if ((vehicle ACE_player) != ACE_player) exitWith {}; [{ - private ["_nearBuidlings", "_typeOfHouse", "_houseBeingScaned", "_actionSet", "_memPoints", "_memPointsActions", "_helperPos", "_helperObject"]; params ["_args", "_pfID"]; _args params ["_setPosition", "_addedHelpers", "_housesScaned", "_housesToScanForActions"]; @@ -54,33 +53,34 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; //If player moved >2 meters from last pos, then rescan if (((getPosASL ace_player) distance _setPosition) < 2) exitWith {}; - _nearBuidlings = nearestObjects [ace_player, ["Static"], 30]; + private _nearBuidlings = nearestObjects [ace_player, ["Static"], 30]; { - _typeOfHouse = typeOf _x; + private _typeOfHouse = typeOf _x; if (((count (configFile >> "CfgVehicles" >> _typeOfHouse >> "UserActions")) == 0) && {(count (getArray (configFile >> "CfgVehicles" >> _typeOfHouse >> "ladders"))) == 0}) then { _housesScaned pushBack _x; } else { _housesToScanForActions pushBack _x; }; - } forEach (_nearBuidlings - _housesScaned); + nil + } count (_nearBuidlings - _housesScaned); _args set [0, (getPosASL ace_player)]; } else { _houseBeingScaned = _housesToScanForActions deleteAt 0; - _typeOfHouse = typeOf _houseBeingScaned; + private _typeOfHouse = typeOf _houseBeingScaned; //Skip this house for now if we are outside of it's radius //(we have to scan far out for the big houses, but we don't want to waste time adding actions on every little shack) if ((_houseBeingScaned != cursorTarget) && {((ACE_player distance _houseBeingScaned) - ((sizeOf _typeOfHouse) / 2)) > 4}) exitWith {}; _housesScaned pushBack _houseBeingScaned; - _actionSet = [_typeOfHouse] call FUNC(userActions_getHouseActions); + private _actionSet = [_typeOfHouse] call FUNC(userActions_getHouseActions); _actionSet params ["_memPoints", "_memPointsActions"]; // systemChat format ["Add Actions for [%1] (count %2) @ %3", _typeOfHouse, (count _memPoints), diag_tickTime]; { - _helperPos = (_houseBeingScaned modelToWorld (_houseBeingScaned selectionPosition _x)) call EFUNC(common,positionToASL); - _helperObject = "ACE_LogicDummy" createVehicleLocal _helperPos; + private _helperPos = AGLtoASL (_houseBeingScaned modelToWorld (_houseBeingScaned selectionPosition _x)); + private _helperObject = "ACE_LogicDummy" createVehicleLocal _helperPos; _addedHelpers pushBack _helperObject; _helperObject setVariable [QGVAR(building), _houseBeingScaned]; _helperObject setPosASL _helperPos; @@ -88,7 +88,8 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; { [_helperObject, 0, [], _x] call EFUNC(interact_menu,addActionToObject); - } forEach (_memPointsActions select _forEachIndex); + nil + } count (_memPointsActions select _forEachIndex); } forEach _memPoints; }; diff --git a/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf b/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf index dee82fd939..c513805d10 100644 --- a/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf +++ b/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf @@ -8,22 +8,23 @@ * Return Value: * [[Array of MemPoints], [Array Of Actions]] * - * Public: Yes + * Example: + * ["Land_i_House_Big_01_V1_F"] call ace_interact_menu_fnc_userActions_getHouseActions + * + * Public: No */ #include "script_component.hpp" params ["_typeOfBuilding"]; -private["_action", "_actionDisplayName", "_actionDisplayNameDefault", "_actionMaxDistance", "_actionOffset", "_actionPath", "_actionPosition", "_building", "_configPath", "_endIndex", "_iconImage", "_index", "_ladders", "_memPointIndex", "_memPoints", "_memPointsActions", "_startIndex"]; - -_searchIndex = GVAR(cachedBuildingTypes) find _typeOfBuilding; +private _searchIndex = GVAR(cachedBuildingTypes) find _typeOfBuilding; if (_searchIndex != -1) exitWith {GVAR(cachedBuildingActionPairs) select _searchIndex}; -_memPoints = []; -_memPointsActions = []; +private _memPoints = []; +private _memPointsActions = []; //Get the offset for a memory point: -_fnc_getMemPointOffset = { +private _fnc_getMemPointOffset = { params ["_memoryPoint"]; _memPointIndex = _memPoints find _memoryPoint; _actionOffset = [0,0,0]; @@ -37,13 +38,13 @@ _fnc_getMemPointOffset = { }; // Add UserActions for the building: -_fnc_userAction_Statement = { +private _fnc_userAction_Statement = { params ["_target", "_player", "_variable"]; _variable params ["_actionStatement", "_actionCondition"]; this = _target getVariable [QGVAR(building), objNull]; call _actionStatement; }; -_fnc_userAction_Condition = { +private _fnc_userAction_Condition = { params ["_target", "_player", "_variable"]; _variable params ["_actionStatement", "_actionCondition"]; this = _target getVariable [QGVAR(building), objNull]; @@ -51,16 +52,16 @@ _fnc_userAction_Condition = { call _actionCondition; }; -_configPath = configFile >> "CfgVehicles" >> _typeOfBuilding >> "UserActions"; +private _configPath = configFile >> "CfgVehicles" >> _typeOfBuilding >> "UserActions"; for "_index" from 0 to ((count _configPath) - 1) do { - _actionPath = _configPath select _index; + private _actionPath = _configPath select _index; - _actionDisplayName = getText (_actionPath >> "displayName"); - _actionDisplayNameDefault = getText (_actionPath >> "displayNameDefault"); - _actionPosition = getText (_actionPath >> "position"); - _actionCondition = getText (_actionPath >> "condition"); - _actionStatement = getText (_actionPath >> "statement"); - _actionMaxDistance = getNumber (_actionPath >> "radius"); + private _actionDisplayName = getText (_actionPath >> "displayName"); + private _actionDisplayNameDefault = getText (_actionPath >> "displayNameDefault"); + private _actionPosition = getText (_actionPath >> "position"); + private _actionCondition = getText (_actionPath >> "condition"); + private _actionStatement = getText (_actionPath >> "statement"); + private _actionMaxDistance = getNumber (_actionPath >> "radius"); if (_actionDisplayName == "") then {_actionDisplayName = (configName _x);}; if (_actionPosition == "") then {ERROR("Bad Position");}; @@ -70,53 +71,52 @@ for "_index" from 0 to ((count _configPath) - 1) do { _actionStatement = compile _actionStatement; _actionCondition = compile _actionCondition; _actionMaxDistance = _actionMaxDistance + 0.1; //increase range slightly - _iconImage = ""; //extension ~4x as fast: - _iconImage = "ace_parse_imagepath" callExtension _actionDisplayNameDefault; + private _iconImage = "ace_parse_imagepath" callExtension _actionDisplayNameDefault; - _actionOffset = [_actionPosition] call _fnc_getMemPointOffset; - _memPointIndex = _memPoints find _actionPosition; + private _actionOffset = [_actionPosition] call _fnc_getMemPointOffset; + private _memPointIndex = _memPoints find _actionPosition; _action = [(configName _actionPath), _actionDisplayName, _iconImage, _fnc_userAction_Statement, _fnc_userAction_Condition, {}, [_actionStatement, _actionCondition], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction); (_memPointsActions select _memPointIndex) pushBack _action; }; // Add Ladder Actions for the building: -_fnc_ladder_ladderUp = { +private _fnc_ladder_ladderUp = { params ["_target", "_player", "_variable"]; _variable params ["_ladderIndex"]; - _building = _target getVariable [QGVAR(building), objNull]; + private _building = _target getVariable [QGVAR(building), objNull]; TRACE_3("Ladder Action - UP",_player,_building,_ladderIndex); _player action ["LadderUp", _building, _ladderIndex, 0]; }; -_fnc_ladder_ladderDown = { +private _fnc_ladder_ladderDown = { params ["_target", "_player", "_variable"]; _variable params ["_ladderIndex"]; - _building = _target getVariable [QGVAR(building), objNull]; + private _building = _target getVariable [QGVAR(building), objNull]; TRACE_3("Ladder Action - Down",_player,_building,_ladderIndex); _player action ["LadderDown", _building, _ladderIndex, 1]; }; -_fnc_ladder_conditional = { +private _fnc_ladder_conditional = { params ["_target", "_player"]; //(Check distance < 2) and (Don't show actions if on a ladder) ((_target distance _player) < 2) && {((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _player) >> "onLadder")) == 0)} }; -_ladders = getArray (configFile >> "CfgVehicles" >> _typeOfBuilding >> "ladders"); +private _ladders = getArray (configFile >> "CfgVehicles" >> _typeOfBuilding >> "ladders"); { _x params ["_ladderBottomMemPoint", "_ladderTopMemPoint"]; - _actionMaxDistance = 3; //interact_menu will check head -> target's offset; leave this high and do a precice distance check in condition + private _actionMaxDistance = 3; //interact_menu will check head -> target's offset; leave this high and do a precice distance check in condition - _actionDisplayName = localize "str_action_ladderup"; - _iconImage = "\A3\ui_f\data\igui\cfg\actions\ladderup_ca.paa"; + private _actionDisplayName = localize "str_action_ladderup"; + private _iconImage = "\A3\ui_f\data\igui\cfg\actions\ladderup_ca.paa"; //Ladder Up Action: - _actionOffset = [_ladderBottomMemPoint] call _fnc_getMemPointOffset; + private _actionOffset = [_ladderBottomMemPoint] call _fnc_getMemPointOffset; _actionOffset = _actionOffset vectorAdd [0,0,1]; - _memPointIndex = _memPoints find _ladderBottomMemPoint; - _action = [format ["LadderUp_%1", _forEachIndex], _actionDisplayName, _iconImage, _fnc_ladder_ladderUp, _fnc_ladder_conditional, {}, [_forEachIndex], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction); + private _memPointIndex = _memPoints find _ladderBottomMemPoint; + private _action = [format ["LadderUp_%1", _forEachIndex], _actionDisplayName, _iconImage, _fnc_ladder_ladderUp, _fnc_ladder_conditional, {}, [_forEachIndex], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction); (_memPointsActions select _memPointIndex) pushBack _action; _actionDisplayName = localize "str_action_ladderdown"; diff --git a/addons/interact_menu/script_component.hpp b/addons/interact_menu/script_component.hpp index 3117065ca2..6a2f4e86f3 100644 --- a/addons/interact_menu/script_component.hpp +++ b/addons/interact_menu/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_INTERACT_MENU #define DEBUG_MODE_FULL @@ -12,5 +15,3 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#define ENABLE_PERFORMANCE_COUNTERS diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index 3f3ad122f2..a55b34cd97 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -1,16 +1,16 @@ - + Always display cursor for self interaction - Immer den Cursor für Selbst-Interaktionen anzeigen. + Immer den Mauszeiger für Selbst-Interaktionen anzeigen. Mostrar siempre el cursor para la interacción propia Показывать курсор (взаимодействия с собой) Zobrazit kurzor v menu pro vlastní interakci Zawsze wyświetlaj kursor dla własnej interakcji Toujours afficher le curseur pour les interactions sur soi-même Mindig legyen a saját cselekvés kurzorja látható - Mostra sempre il cursore per le interazioni su se stessi + Mostra sempre il cursore delle autointerazioni Sempre mostrar cursor para interação pessoal @@ -21,7 +21,7 @@ Zawsze wyświetlaj kursor dla interakcji Показывать курсор (взаимодействие) Zobrazit kurzor v menu pro interakci - Immer den Cursor für Fremd-Interaktionen anzeigen + Immer den Mauszeiger für Fremd-Interaktionen anzeigen Mindig legyen a cselekvés kurzorja látható Sempre mostrar cursor para interação @@ -87,6 +87,7 @@ Zeus Actions + Zeus-Aktionen Akcje Zeusa Akce Zeuse Acciones Zeus @@ -94,6 +95,7 @@ Zeus cselekvések Ações do Zeus Действия Зевса + Azioni Zeus Interaction - Text Max @@ -147,7 +149,7 @@ Keep cursor centered Garder le curseur au centre Центрировать курсор - Cursor zentriert halten + Mauszeiger zentriert halten Kurzor középen tartása Utrzymaj kursor wyśrodkowany Mantener el cursor centrado @@ -160,7 +162,7 @@ Udržuje kurzor na středu. Užitečné, pokud je velikost obrazovky omezena. Garde le curseur au milieu et dispose le menu des options autour. Utile si la taille de l'écran est limitée. Центрирует курсор и двигает само меню опций. Полезно при ограниченном размере экрана. - Hält den Cursor zentriert und verschiebt das Menü beim Bewegen. Nützlich bei kleinen Bildschirmen. + Hält den Mauszeiger zentriert und verschiebt das Menü beim Bewegen. Nützlich bei kleinen Bildschirmen. Középen tartja a kurzort, és a menüelemeket mozgatja. Hasznos lehetőség korlátozott képméretnél. Utrzymuje kursor na środku ekranu, zamiast tego ruch myszą powoduje przesuwanie menu interakcji. Użyteczne w przypadku kiedy rozmiar ekranu jest ograniczony. Mantiene el cursor centrado y despliega los menús alrededor. Útil si el tamaño de la pantalla es limitado. @@ -237,6 +239,7 @@ Arrière plan du menu d'interaction Cselekvő menü háttere Фон меню взаимодействия + Sfondo Menù Interazioni Blur the background while the interaction menu is open. @@ -248,6 +251,7 @@ Flouter l'arrière plan durant l'ouverture du menu d'interaction A háttér elmosása a cselekvő menü használata alatt. Размыть фон, пока открыто меню взаимодействия. + Sfoca lo sfondo mentre il Menù Interazioni è aperto. Blur screen @@ -259,6 +263,7 @@ Flouter l'écran Kép elmosása Размытый + Sfoca schermo Black @@ -270,9 +275,11 @@ Noir Fekete Черный + Nero Show actions for buildings + Zeige Aktionen für Gebäude Pokazuj akcje dla budynków Zobrazit akci pro budovy Mostrar acciones para edificios @@ -280,9 +287,11 @@ Cselekvések mutatása épületeknél Mostrar ações para edifícios Показывать действия для зданий + Mostra azioni per edifici Adds interaction actions for opening doors and mounting ladders on buildings. (Note: There is a performance cost when opening interaction menu, especially in towns) + Fügt Aktionen zum Türöffnen oder für eine Leiter zum Besteigen von Gebäuden hinzu. (Hinweis: Verschlechtert die Leistung wenn das Interaktionsmenü geöffnet wird. Insbesondere in Städten) 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) @@ -290,26 +299,35 @@ 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) Добавляет действия открывания дверей и залезания на лестницы для зданий. (Примечание: возможно падение производительности при открытии меню взаимодействия, особенно в городах) + Aggiunge azioni interattive per l'apertura delle porte e piazzamento scale su edifici. (Nota: C'è un costo in performance quando si apre il Menù Interazioni, soprattutto in città) Interaction Menu + Interaktionsmenü Menu interakcji Menu de interação Меню взаимодействия Menu interakce Menú de interacción + Menù Interazioni Interaction Animation Speed + Interaktionsmenü Animationsgeschwindigkeit Szybkość animacji interakcji Скорость анимации меню взаимодействия Velocidade da animação de interação + Rychlost animace interakce + Velocità Animazioni Interazioni Makes menu animations faster and decreases the time needed to hover to show sub actions + Beschleunigt die Menüanmimationen und folglich das Öffnen eines Submenüs. Przyśpiesza animacje menu interakcji oraz czas wymagany do pokazania podmenu Ускоряет анимацию меню и уменьшает задержку при наведении мыши для раскрытия подменю Faz com que as animações do menu de interação sejam mais rápidas, dimiuindo a necessidade de esperar para mostrar as ações + Zrychlí animaci menu a sníží tak čas potřebný pro plné zobrazení podmenu + Rende le animazioni Menù più veloci e diminuisce il tempo richiesto per mostrare sotto-azioni - \ No newline at end of file + diff --git a/addons/interaction/CfgEventHandlers.hpp b/addons/interaction/CfgEventHandlers.hpp index 60a8fdfcf6..93be6e902b 100644 --- a/addons/interaction/CfgEventHandlers.hpp +++ b/addons/interaction/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index f6b5172b70..5c3366c9f0 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -1,4 +1,3 @@ - class CfgVehicles { class ACE_Module; class ACE_ModuleInteraction: ACE_Module { @@ -10,7 +9,6 @@ class CfgVehicles { isGlobal = 1; isSingular = 1; icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa); - class Arguments { class EnableTeamManagement { displayName = CSTRING(EnableTeamManagement_DisplayName); @@ -19,7 +17,6 @@ class CfgVehicles { defaultValue = 1; }; }; - class ModuleDescription { description = CSTRING(Module_Description); }; @@ -141,6 +138,13 @@ class CfgVehicles { showDisabled = 0; priority = 2.5; }; + class ACE_GetOut { + displayName = CSTRING(GetOut); + condition = QUOTE(!(isNull objectParent _target) && [ARR_2(_player,_target)] call DFUNC(canInteractWithCivilian)); + statement = QUOTE([_target] call EFUNC(common,unloadPerson)); + showDisabled = 0; + priority = 2.6; + }; }; class ACE_Torso { @@ -282,6 +286,7 @@ class CfgVehicles { icon = PATHTOF(UI\team\team_management_ca.paa); }; }; + class ACE_Equipment { displayName = CSTRING(Equipment); condition = QUOTE(true); @@ -497,8 +502,8 @@ class CfgVehicles { }; }; - class thingX; - class ReammoBox_F: thingX { + class ThingX; + class ReammoBox_F: ThingX { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); @@ -519,7 +524,7 @@ class CfgVehicles { class ACE_SelfActions {}; }; - class ACE_RepairItem_Base: thingX { + class ACE_RepairItem_Base: ThingX { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); @@ -532,7 +537,42 @@ class CfgVehicles { class ACE_SelfActions {}; }; - class RoadCone_F: thingX { + class Lamps_base_F; + class Land_PortableLight_single_F: Lamps_base_F { + scope = 2; + XEH_ENABLED; + class ACE_Actions { + class ACE_MainActions { + displayName = CSTRING(MainAction); + selection = ""; + distance = 2; + condition = "true"; + class ACE_LampTurnOn { + displayName = CSTRING(TurnOn); + condition = QUOTE(alive _target && !(_target getVariable [ARR_2('ACE_lampOn',true)])); + statement = QUOTE(_target call DFUNC(switchLamp)); + selection = ""; + distance = 2; + }; + class ACE_LampTurnOff { + displayName = CSTRING(TurnOff); + condition = QUOTE(alive _target && _target getVariable [ARR_2('ACE_lampOn',true)]); + statement = QUOTE(_target call DFUNC(switchLamp)); + selection = ""; + distance = 2; + }; + }; + }; + }; + class Land_PortableLight_single_off_F: Land_PortableLight_single_F { + scope = 1; + }; + class Land_PortableLight_double_F: Land_PortableLight_single_F {}; + class Land_PortableLight_double_off_F: Land_PortableLight_double_F { + scope = 1; + }; + + class RoadCone_F: ThingX { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); diff --git a/addons/interaction/XEH_PREP.hpp b/addons/interaction/XEH_PREP.hpp new file mode 100644 index 0000000000..d24a3623dd --- /dev/null +++ b/addons/interaction/XEH_PREP.hpp @@ -0,0 +1,38 @@ + +// interaction menu +PREP(addPassengerActions); +PREP(addPassengersActions); +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(joinTeam); +PREP(canPassMagazine); +PREP(passMagazine); +PREP(canBecomeLeader); +PREP(doBecomeLeader); +PREP(canTapShoulder); +PREP(tapShoulder); +PREP(canPardon); +PREP(pardon); + +// interaction with doors +PREP(getDoor); +PREP(getDoorAnimations); +PREP(handleScrollWheel); +PREP(openDoor); + +// interaction with boats +PREP(push); + +PREP(switchLamp); diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index bed8a349bc..c57fd09191 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -18,6 +18,16 @@ ACE_Modifier = 0; _unit doMove _position; }] call EFUNC(common,addEventHandler); +["lampTurnOn", { + params ["_lamp", "_hitPointsDamage", "_disabledLampDMG"]; + {if((_x select 1) == _disabledLampDMG) then {_lamp setHit [_x select 0, 0];};nil} count _hitPointsDamage; +}] call EFUNC(common,addEventHandler); + +["lampTurnOff", { + params ["_lamp", "_hitPointsDamage", "_disabledLampDMG"]; + {_lamp setHit [_x select 0, (_x select 1) max _disabledLampDMG];nil} count _hitPointsDamage; +}] call EFUNC(common,addEventHandler); + if (!hasInterface) exitWith {}; GVAR(isOpeningDoor) = false; @@ -61,7 +71,7 @@ GVAR(isOpeningDoor) = false; //Tap whichever shoulder is closest private _shoulderNum = [0, 1] select (([cursorTarget, ACE_player] call BIS_fnc_relativeDirTo) > 180); - + // Statement [ACE_player, cursorTarget, _shoulderNum] call FUNC(tapShoulder); true diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index 258567482d..a7feade1c3 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -2,40 +2,6 @@ ADDON = false; -// interaction menu -PREP(addPassengerActions); -PREP(addPassengersActions); -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(joinTeam); -PREP(canPassMagazine); -PREP(passMagazine); -PREP(canBecomeLeader); -PREP(doBecomeLeader); -PREP(canTapShoulder); -PREP(tapShoulder); -PREP(canPardon); -PREP(pardon); - -// interaction with doors -PREP(getDoor); -PREP(getDoorAnimations); -PREP(handleScrollWheel); -PREP(openDoor); - -// interaction with boats -PREP(push); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/interaction/XEH_preStart.sqf b/addons/interaction/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/interaction/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index 9659565c3c..2413256bf4 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interact_menu"}; - author[] = {"commy2", "KoffeinFlummi", "esteldunedain", "bux578"}; + author[] = {"commy2", "KoffeinFlummi", "esteldunedain", "bux578", "dixon13"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; }; diff --git a/addons/interaction/functions/fnc_addPassengerActions.sqf b/addons/interaction/functions/fnc_addPassengerActions.sqf index 20de00e315..47a845601b 100644 --- a/addons/interaction/functions/fnc_addPassengerActions.sqf +++ b/addons/interaction/functions/fnc_addPassengerActions.sqf @@ -20,12 +20,10 @@ params ["", "", "_parameters"]; _parameters params ["_unit"]; -private ["_varName", "_actionTrees", "_actions"]; +private _varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit]; +private _actionTrees = missionNamespace getVariable [_varName, []]; -_varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit]; -_actionTrees = missionNamespace getVariable [_varName, []]; - -_actions = []; +private _actions = []; // Mount unit MainActions menu { diff --git a/addons/interaction/functions/fnc_addPassengersActions.sqf b/addons/interaction/functions/fnc_addPassengersActions.sqf index 7296b34fa2..8ee95b7eb9 100644 --- a/addons/interaction/functions/fnc_addPassengersActions.sqf +++ b/addons/interaction/functions/fnc_addPassengersActions.sqf @@ -23,12 +23,10 @@ private "_actions"; _actions = []; { - private ["_unit", "_icon"]; - - _unit = _x; + private _unit = _x; if (_unit != _player && {getText (configFile >> "CfgVehicles" >> typeOf _unit >> "simulation") != "UAVPilot"}) then { - _icon = [ + private _icon = [ "", "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa", "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa", @@ -44,14 +42,27 @@ _actions = []; format ["%1", _unit], [_unit, true] call EFUNC(common,getName), _icon, - {}, + { + //statement (Run on hover) - reset the cache so we will insert actions immedietly when hovering over new unit + TRACE_2("Cleaning Cache",_target,vehicle _target); + [vehicle _target, QEGVAR(interact_menu,ATCache_ACE_SelfActions)] call EFUNC(common,eraseCache); + }, {true}, - {_this call FUNC(addPassengerActions)}, - [_unit] - ] call EFUNC(interact_menu,createAction), - [], - _unit - ]; + { + if (EGVAR(interact_menu,selectedTarget) isEqualTo _target) then { + _this call FUNC(addPassengerActions) + } else { + [] //not selected, don't waste time on actions + }; + }, + [_unit], + {[0, 0, 0]}, + 2, + [false,false,false,true,false] //add run on hover (4th bit true) + ] call EFUNC(interact_menu,createAction), + [], + _unit + ]; }; false } count crew _vehicle; diff --git a/addons/interaction/functions/fnc_canInteractWithCivilian.sqf b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf index eb8374191b..add66740e5 100644 --- a/addons/interaction/functions/fnc_canInteractWithCivilian.sqf +++ b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf @@ -18,5 +18,4 @@ #include "script_component.hpp" params ["_unit", "_target", ["_isCivilian", true]]; - alive _target && [side _target != side _unit, side group _target == civilian] select _isCivilian // return diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf index 1c1dd1bb2d..66c560c271 100644 --- a/addons/interaction/functions/fnc_canPassMagazine.sqf +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -18,11 +18,11 @@ #include "script_component.hpp" params ["_player", "_target", "_weapon"]; -private ["_compatibleMags"]; if (!GVAR(enableMagazinePassing)) exitWith {false}; +if (((vehicle _target) != _target) && {(vehicle _target) != (vehicle _player)}) exitWith {false}; -_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); +private _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); { _x params ["_className", "", "_loaded"]; if ((_className in _compatibleMags) && {!_loaded} && {_target canAdd _className}) exitWith {true}; diff --git a/addons/interaction/functions/fnc_passMagazine.sqf b/addons/interaction/functions/fnc_passMagazine.sqf index 2afe2f3817..7e2f7b9356 100644 --- a/addons/interaction/functions/fnc_passMagazine.sqf +++ b/addons/interaction/functions/fnc_passMagazine.sqf @@ -21,10 +21,7 @@ params ["_player", "_target", "_weapon"]; private ["_compatibleMags", "_filteredMags", "_magToPass", "_magToPassIndex", "_playerName", "_magToPassDisplayName"]; _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); -_filteredMags = [magazinesAmmoFull _player, { - params ["_className", "", "_loaded"]; - _className in _compatibleMags && !_loaded -}] call EFUNC(common,filter); +_filteredMags = magazinesAmmoFull _player select {(_x select 0) in _compatibleMags && {!(_x select 2)}}; //select magazine with most ammo _magToPass = _filteredMags select 0; diff --git a/addons/interaction/functions/fnc_switchLamp.sqf b/addons/interaction/functions/fnc_switchLamp.sqf new file mode 100644 index 0000000000..20a2d45dea --- /dev/null +++ b/addons/interaction/functions/fnc_switchLamp.sqf @@ -0,0 +1,38 @@ +/* + * Author: SzwedzikPL + * Turn on/off lamp + * + * Arguments: + * 0: Lamp + * + * Return value: + * None + * + * Example: + * lamp call ace_interaction_fnc_switchLamp + * + * Public: No + */ +#include "script_component.hpp" + +#define DISABLED_LAMP_DMG 0.95 + +params ["_lamp"]; + +_isOn = _lamp getVariable ["ACE_lampOn", true]; +private _reflectors = "true" configClasses (configfile >> "CfgVehicles" >> (typeof _lamp) >> "Reflectors"); +private _hitPointsDamage = []; +{ + private _hitPoint = getText (_x >> "hitpoint"); + _hitPointsDamage pushback [_hitPoint, _lamp getHit _hitPoint]; + nil +} count _reflectors; + +//if lamp is on turn it off +private _eventName = ["lampTurnOn", "lampTurnOff"] select _isOn; +if(local _lamp) then { + [_eventName, [_lamp, _hitPointsDamage, DISABLED_LAMP_DMG]] call EFUNC(common,localEvent); +} else { + [_eventName, [_lamp], [_lamp, _hitPointsDamage, DISABLED_LAMP_DMG]] call EFUNC(common,targetEvent); +}; +_lamp setVariable ["ACE_lampOn", !_isOn, true]; diff --git a/addons/interaction/script_component.hpp b/addons/interaction/script_component.hpp index d668387bb9..fd6ce8ce58 100644 --- a/addons/interaction/script_component.hpp +++ b/addons/interaction/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT interaction #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_INTERACTION #define DEBUG_MODE_FULL #endif diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 4171789b22..223ddc5a1a 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -222,7 +222,7 @@ TANZEN! BAILAR! TAŃCZ! - TANČIT! + TANCUJ! Danse! ТАНЦЕВАТЬ! TÁNC! @@ -349,6 +349,11 @@ Abaixe-se! A terra! + + Get Out + Wyjdź + Esci + Team Management Gruppenverwaltung @@ -511,7 +516,7 @@ Te has unido al equipo %1 Tu as rejoint l'équipe %1 Dołączyłeś do %1 - Připojil ses do %1 týmu + Připojili jste se do %1 týmu Вы присоединились к группе %1 Você uniu-se à Equipe %1 Sei entrato nel team %1 @@ -535,7 +540,7 @@ Has dejado el equipo Tu as quitté l'équipe Opuściłeś drużynę - Opustil jsi tým + Opustili jste tým Вы покинули группу Você deixou a Equipe Hai lasciato il team @@ -563,7 +568,7 @@ Rolar Scorri Görgetés - Otáčení + Posunout Modifier Key @@ -607,7 +612,7 @@ Empujar Pousser Pchnij - Odstrčit + Tlačit Tolás Толкать Empurrar @@ -646,6 +651,7 @@ Nyitás Abrir Открыть + Apri Interaction System @@ -657,6 +663,7 @@ Système d'interaction Interakciós rendszer Sistema de interação + Sistema Interazioni Enable Team Management @@ -668,6 +675,7 @@ Active la gestion d'équipe Csapatkezelés engedélyezése Habilitar gestão de equipes + Abilità Management Squadra Should players be allowed to use the Team Management Menu? Default: Yes @@ -679,6 +687,7 @@ 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 + Possono i giocatori usare il Menù Managment Squadra? Default: Si Team management allows color allocation for team members, taking team command and joining/leaving teams. @@ -690,6 +699,17 @@ 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. Управление группами позволяет назначать цвета членам групп, брать командование, вступать в группы или покидать их. + Management Squadra permette l'assegnazione di colori per membri della squadra, prendere il comando ed entrare/uscire dalle squadre. + + + Turn on + Aktivieren + Włącz + + + Turn off + Deaktivieren + Wyłącz Pass magazine @@ -697,6 +717,8 @@ Podaj magazynek Передать магазин Passar carregador + Podat zásobník + Passa caricatore Primary magazine @@ -704,6 +726,8 @@ Magazynek karabinowy Основной магазин Carregador primário + Zásobník do primární zbraně + Caricatore Primario Pistol magazine @@ -711,6 +735,8 @@ Magazynek pistoletowy Магазин к пистолету Carregador da pistola + Zásobník do pistole + Caricatore Pistola %1 passed you a %2 magazine. @@ -718,6 +744,8 @@ %1 podał Ci magazynek %2. %1 передал вам магазин %2. %1 passou a você um carregador %2. + %1 ti podal %2 zásobník. + %1 ti ha passato un caricatore %2 . Show "pass magazine" interaction @@ -725,6 +753,8 @@ Pokaż interakcję "podaj magazynek" Показывать действие "передать магазин" Mostrar a interação "Passar carregador" + Zobrazit "interakci "podat zásobník" + Mostra interazione "passa caricatore" - \ No newline at end of file + diff --git a/addons/inventory/CfgEventHandlers.hpp b/addons/inventory/CfgEventHandlers.hpp new file mode 100644 index 0000000000..369f47e1dd --- /dev/null +++ b/addons/inventory/CfgEventHandlers.hpp @@ -0,0 +1,24 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +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_DisplayLoad_EventHandlers { + class RscDisplayInventory { + ADDON = QUOTE(_this call FUNC(inventoryDisplayLoad)); + }; +}; diff --git a/addons/inventory/XEH_PREP.hpp b/addons/inventory/XEH_PREP.hpp new file mode 100644 index 0000000000..7c58268e23 --- /dev/null +++ b/addons/inventory/XEH_PREP.hpp @@ -0,0 +1,16 @@ + +PREP(addCustomFilter); +PREP(currentItemListBox); +PREP(forceItemListUpdate); +PREP(inventoryDisplayLoad); +PREP(onLBSelChanged); + +PREP(filterWeapons); +PREP(filterMagazines); +PREP(filterItems); +PREP(filterHeadgear); +PREP(filterUniforms); +PREP(filterVests); +PREP(filterBackpacks); +PREP(filterGrenades); +PREP(filterMedical); diff --git a/addons/inventory/XEH_postInit.sqf b/addons/inventory/XEH_postInit.sqf new file mode 100644 index 0000000000..bf7adec77a --- /dev/null +++ b/addons/inventory/XEH_postInit.sqf @@ -0,0 +1,51 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +GVAR(customFilters) = []; +GVAR(selectedFilterIndex) = -1; + +// add custom filters + +// generate list of grenades +GVAR(Grenades_ItemList) = []; + +{ + GVAR(Grenades_ItemList) append getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines"); + false +} count getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles"); + +// make list case insensitive +GVAR(Grenades_ItemList) = GVAR(Grenades_ItemList) apply {toLower _x}; + +// filter duplicates +GVAR(Grenades_ItemList) = GVAR(Grenades_ItemList) arrayIntersect GVAR(Grenades_ItemList); + +[localize LSTRING(Grenades), QFUNC(filterGrenades)] call FUNC(addCustomFilter); + +[localize LSTRING(Backpacks), QFUNC(filterBackpacks)] call FUNC(addCustomFilter); +[localize LSTRING(Uniforms), QFUNC(filterUniforms)] call FUNC(addCustomFilter); +[localize LSTRING(Vests), QFUNC(filterVests)] call FUNC(addCustomFilter); +[localize LSTRING(Headgear), QFUNC(filterHeadgear)] call FUNC(addCustomFilter); + +// generate list of medical items +GVAR(Medical_ItemList) = []; + +{ + GVAR(Medical_ItemList) append getArray (_x >> "items"); + false +} count ( + ("true" configClasses (configFile >> QEGVAR(Medical,Actions) >> "Basic")) + + ("true" configClasses (configFile >> QEGVAR(Medical,Actions) >> "Advanced")) +); + +// remove all numbers from list +GVAR(Medical_ItemList) = GVAR(Medical_ItemList) select {_x isEqualType ""}; + +// make list case insensitive +GVAR(Medical_ItemList) = GVAR(Medical_ItemList) apply {toLower _x}; + +// filter duplicates +GVAR(Medical_ItemList) = GVAR(Medical_ItemList) arrayIntersect GVAR(Medical_ItemList); + +[localize LSTRING(Medical), QFUNC(filterMedical)] call FUNC(addCustomFilter); diff --git a/addons/inventory/XEH_preInit.sqf b/addons/inventory/XEH_preInit.sqf new file mode 100644 index 0000000000..535b9be656 --- /dev/null +++ b/addons/inventory/XEH_preInit.sqf @@ -0,0 +1,50 @@ +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +// cache config +// items in the inventory display can only be distinguished by their lb names and pictures +// this can cause collisions (mainly weapons with attachments), +// but if the item has the same name and picture it at least shouldn't change the filter anyway +// luckily we don't need private items, so dummy and parent classes are out of the picture + +if !(uiNamespace getVariable [QGVAR(configCached), false]) then { + private _fnc_addToCache = { + private _displayName = getText (_this >> "displayName"); + private _picture = getText (_this >> "picture"); + + // list box seems to delete the leading backslash + if (_picture select [0,1] == "\") then { + _picture = _picture select [1]; + }; + + uiNamespace setVariable [format [QGVAR(ItemKey:%1:%2), _displayName, _picture], _this]; + }; + + // weapons and items + { + if (getNumber (_x >> "scope") > 0) then {_x call _fnc_addToCache}; + false + } count ( + ("true" configClasses (configFile >> "CfgWeapons")) + + ("true" configClasses (configFile >> "CfgGlasses")) + ); + + // magazines + { + if (getNumber (_x >> "scope") == 2) then {_x call _fnc_addToCache}; + false + } count ("true" configClasses (configFile >> "CfgMagazines")); + + // backpacks + { + if (getNumber (_x >> "scope") > 0 && {getNumber (_x >> "isBackpack") == 1}) then {_x call _fnc_addToCache}; + false + } count ("true" configClasses (configFile >> "CfgVehicles")); + + uiNamespace setVariable [QGVAR(configCached), true]; +}; + +ADDON = true; diff --git a/addons/inventory/XEH_preStart.sqf b/addons/inventory/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/inventory/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/inventory/config.cpp b/addons/inventory/config.cpp index 1190525901..f0982a46b4 100644 --- a/addons/inventory/config.cpp +++ b/addons/inventory/config.cpp @@ -6,11 +6,13 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Pabst Mirror"}; + author[] = {"Pabst Mirror, commy2"}; authorUrl = "https://github.com/PabstMirror/"; VERSION_CONFIG; }; }; +#include "CfgEventHandlers.hpp" + #include "RscDisplayInventory.hpp" #include "ACE_Settings.hpp" diff --git a/addons/inventory/functions/fnc_addCustomFilter.sqf b/addons/inventory/functions/fnc_addCustomFilter.sqf new file mode 100644 index 0000000000..44e43bdbf0 --- /dev/null +++ b/addons/inventory/functions/fnc_addCustomFilter.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Adds a custom filter list to the inventory display. + * Functions are here as strings, because list boxes can only store numbers and strings. + * + * Arguments: + * 0: Localized filter display name + * 1: Filter function name + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params [["_filterName", "ERROR: No Name", [""]], ["_fncName", "", [""]]]; + +GVAR(customFilters) pushBack [_filterName, _fncName]; diff --git a/addons/inventory/functions/fnc_currentItemListBox.sqf b/addons/inventory/functions/fnc_currentItemListBox.sqf new file mode 100644 index 0000000000..1f1b528e93 --- /dev/null +++ b/addons/inventory/functions/fnc_currentItemListBox.sqf @@ -0,0 +1,30 @@ +/* + * Author: commy2 + * Returns the current item list box of given inventory display. + * These can be Ground, Soldier, Uniform, Backpack or Vest. + * Can also be Weapon since 1.52, but that apparently uses one of the above. + * + * Arguments: + * 0: Inventory display + * + * Return Value: + * Currently selected item list box + * + * Public: No + */ +#include "script_component.hpp" + +params ["_display"]; + +scopeName "main"; + +{ + private _control = _display displayCtrl _x; + + if (ctrlShown _control) then { + _control breakOut "main"; + }; + false +} count [IDC_ITEMLIST_GROUND, IDC_ITEMLIST_SOLDIER, IDC_ITEMLIST_UNIFORM, IDC_ITEMLIST_VEST, IDC_ITEMLIST_BACKPACK]; + +-1 diff --git a/addons/inventory/functions/fnc_filterBackpacks.sqf b/addons/inventory/functions/fnc_filterBackpacks.sqf new file mode 100644 index 0000000000..9b629de66f --- /dev/null +++ b/addons/inventory/functions/fnc_filterBackpacks.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Backpacks filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +getNumber (_config >> "isBackpack") == 1 diff --git a/addons/inventory/functions/fnc_filterGrenades.sqf b/addons/inventory/functions/fnc_filterGrenades.sqf new file mode 100644 index 0000000000..0acfbcaa2c --- /dev/null +++ b/addons/inventory/functions/fnc_filterGrenades.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Grenades filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +toLower configName _config in GVAR(Grenades_ItemList) diff --git a/addons/inventory/functions/fnc_filterHeadgear.sqf b/addons/inventory/functions/fnc_filterHeadgear.sqf new file mode 100644 index 0000000000..056406a3d1 --- /dev/null +++ b/addons/inventory/functions/fnc_filterHeadgear.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Headgear filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +getNumber (_config >> "ItemInfo" >> "type") in [TYPE_HEADGEAR, TYPE_HMD] || {isClass (configFile >> "CfgGlasses" >> configName _config)} diff --git a/addons/inventory/functions/fnc_filterItems.sqf b/addons/inventory/functions/fnc_filterItems.sqf new file mode 100644 index 0000000000..b9bf9baeea --- /dev/null +++ b/addons/inventory/functions/fnc_filterItems.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Remove uniforms, vests and backpacks from Items filter. + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +!(getNumber (_config >> "ItemInfo" >> "type") in [TYPE_UNIFORM, TYPE_VESTS, TYPE_HEADGEAR]) && {!(_this call FUNC(filterBackpacks))} diff --git a/addons/inventory/functions/fnc_filterMagazines.sqf b/addons/inventory/functions/fnc_filterMagazines.sqf new file mode 100644 index 0000000000..dfd357f61d --- /dev/null +++ b/addons/inventory/functions/fnc_filterMagazines.sqf @@ -0,0 +1,15 @@ +/* + * Author: commy2 + * Remove backpacks and grenades from Magazines filter. + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +!(_this call FUNC(filterBackpacks)) && {!(_this call FUNC(filterGrenades))} diff --git a/addons/inventory/functions/fnc_filterMedical.sqf b/addons/inventory/functions/fnc_filterMedical.sqf new file mode 100644 index 0000000000..397be50f06 --- /dev/null +++ b/addons/inventory/functions/fnc_filterMedical.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Medical filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +toLower configName _config in GVAR(Medical_ItemList) diff --git a/addons/inventory/functions/fnc_filterUniforms.sqf b/addons/inventory/functions/fnc_filterUniforms.sqf new file mode 100644 index 0000000000..4c135dfa88 --- /dev/null +++ b/addons/inventory/functions/fnc_filterUniforms.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Uniforms filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +getNumber (_config >> "ItemInfo" >> "type") == TYPE_UNIFORM diff --git a/addons/inventory/functions/fnc_filterVests.sqf b/addons/inventory/functions/fnc_filterVests.sqf new file mode 100644 index 0000000000..646e23d04d --- /dev/null +++ b/addons/inventory/functions/fnc_filterVests.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Vests filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +getNumber (_config >> "ItemInfo" >> "type") == TYPE_VEST diff --git a/addons/inventory/functions/fnc_filterWeapons.sqf b/addons/inventory/functions/fnc_filterWeapons.sqf new file mode 100644 index 0000000000..94a92814ae --- /dev/null +++ b/addons/inventory/functions/fnc_filterWeapons.sqf @@ -0,0 +1,15 @@ +/* + * Author: commy2 + * Remove backpacks from Weapons filter. + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +!(_this call FUNC(filterBackpacks)) diff --git a/addons/inventory/functions/fnc_forceItemListUpdate.sqf b/addons/inventory/functions/fnc_forceItemListUpdate.sqf new file mode 100644 index 0000000000..89142b99ff --- /dev/null +++ b/addons/inventory/functions/fnc_forceItemListUpdate.sqf @@ -0,0 +1,40 @@ +/* + * Author: commy2 + * Updates item list and removes every entry that does not fit in the currently selected filter list. + * + * Arguments: + * 0: Inventory display + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; +params ["_display"]; + +private _index = GVAR(selectedFilterIndex); +private _itemList = _display call FUNC(currentItemListBox); +private _filterFunction = missionNamespace getVariable ((_display displayCtrl IDC_FILTERLISTS) lbData _index); + +if (_filterFunction isEqualType {}) then { + private _i = 0; + + while {_i < lbSize _itemList} do { + private _config = uiNamespace getVariable [ + format [QGVAR(ItemKey:%1:%2), _itemList lbText _i, _itemList lbPicture _i], + configNull + ]; + + if (!isNull _config && {!(_config call _filterFunction)}) then { + _itemList lbDelete _i; + + // in case the filter function returns nil. Otherwise could lock up the game. + _i = _i - 1; + }; + + _i = _i + 1; + }; +}; diff --git a/addons/inventory/functions/fnc_inventoryDisplayLoad.sqf b/addons/inventory/functions/fnc_inventoryDisplayLoad.sqf new file mode 100644 index 0000000000..6e48c1ec2a --- /dev/null +++ b/addons/inventory/functions/fnc_inventoryDisplayLoad.sqf @@ -0,0 +1,77 @@ +/* + * Author: commy2 + * Executed every time an inventory display is opened. + * + * Arguments: + * 0: Inventory display + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; +params ["_display"]; + +private _filter = _display displayCtrl IDC_FILTERLISTS; + +// engine defined behaviour is the following: +// lb value, data and text don't matter, only the index. +// the first three indecies are hard coded: 0 - weapons , 1 - magazines, 2 - items +// all of them show backpacks, because BI +// all other indecies show everything, so all we have to do is delete stuff we dont like +_filter ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChanged)}]; + +// have to add these a frame later, because this event happens before the engine adds the default filters +[{ + disableSerialization; + params ["_filter"]; + + // remove "All", so we can push it to the back later. + // to keep localization we can keep the lbText (displayed name). + private _index = lbSize _filter - 1; + private _nameAll = _filter lbText _index; + _filter lbDelete _index; + + // add additional filter functions to the default filters. These remove backpacks etc. + _filter lbSetData [0, QFUNC(filterWeapons)]; + _filter lbSetData [1, QFUNC(filterMagazines)]; + _filter lbSetData [2, QFUNC(filterItems)]; + + // add our custom filters + { + _x params ["_name", "_fncName"]; + + _index = _filter lbAdd _name; + _filter lbSetData [_index, _fncName]; + + false + } count GVAR(customFilters); + + // readd "All" filter to last position and select it + _index = _filter lbAdd _nameAll; + _filter lbSetCurSel _index; +}, [_filter]] call EFUNC(common,execNextFrame); + +// monitor changes that can happen and force our update +private _dummyControl = _display ctrlCreate ["RscMapControl", -1]; + +_dummyControl ctrlSetPosition [0,0,0,0]; +_dummyControl ctrlCommit 0; + +_dummyControl ctrlAddEventHandler ["Draw", { + disableSerialization; + params ["_dummyControl"]; + + private _display = ctrlParent _dummyControl; + + private _itemList = _display call FUNC(currentItemListBox); + + // monitoring is done by setting a lb value. These are unused here and are reset every time the list box updates. + if (_itemList lbValue 0 != DUMMY_VALUE) then { + _display call FUNC(forceItemListUpdate); + _itemList lbSetValue [0, DUMMY_VALUE]; + }; +}]; diff --git a/addons/inventory/functions/fnc_onLBSelChanged.sqf b/addons/inventory/functions/fnc_onLBSelChanged.sqf new file mode 100644 index 0000000000..61e4b12b10 --- /dev/null +++ b/addons/inventory/functions/fnc_onLBSelChanged.sqf @@ -0,0 +1,27 @@ +/* + * Author: commy2 + * Executed when the filter list box is changed. + * Sets new filter list index. + * + * Arguments: + * 0: Filter list box + * 1: Filter list index + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; +params ["_filter", "_index"]; + +GVAR(selectedFilterIndex) = _index; + +[{ + disableSerialization; + params ["_display"]; + + [_display] call FUNC(forceItemListUpdate); +}, [ctrlParent _filter]] call EFUNC(common,execNextFrame); diff --git a/addons/inventory/functions/script_component.hpp b/addons/inventory/functions/script_component.hpp new file mode 100644 index 0000000000..07c5e38d2d --- /dev/null +++ b/addons/inventory/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\inventory\script_component.hpp" \ No newline at end of file diff --git a/addons/inventory/script_component.hpp b/addons/inventory/script_component.hpp index 248f324b36..e95ad43b83 100644 --- a/addons/inventory/script_component.hpp +++ b/addons/inventory/script_component.hpp @@ -1,12 +1,26 @@ #define COMPONENT inventory #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_INVENTORY - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_INVENTORY - #define DEBUG_SETTINGS DEBUG_SETTINGS_INVENTORY + #define DEBUG_SETTINGS DEBUG_SETTINGS_INVENTORY #endif #include "\z\ace\addons\main\script_macros.hpp" + +#define IDC_FILTERLISTS 6554 +#define IDC_ITEMLIST_GROUND 632 +#define IDC_ITEMLIST_SOLDIER 640 +#define IDC_ITEMLIST_UNIFORM 633 +#define IDC_ITEMLIST_VEST 638 +#define IDC_ITEMLIST_BACKPACK 619 + +#define DUMMY_VALUE 127 diff --git a/addons/inventory/stringtable.xml b/addons/inventory/stringtable.xml index 04cac46b87..b487e5d4ff 100644 --- a/addons/inventory/stringtable.xml +++ b/addons/inventory/stringtable.xml @@ -25,5 +25,54 @@ Normalmente il menù inventario è scalato in base alle dimensioni interfaccia. Questa opzione di permette di ingrandirlo ulteriormente ma senza aumentare la dimensione del testo. 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. + + Backpacks + Rucksäcke + Batohy + Plecaki + Zaini + + + Headgear + Kopfbedeckungen + Pokrývka hlavy + Hełmy + Copricapi + + + Glasses + Brillen + Brýle + Gogle + Occhiali + + + Uniforms + Uniformen + Uniformy + Uniformy + Uniformi + + + Vests + Westen + Vesty + Kamizelki + Vests + + + Grenades + Granaten + Granáty + Granaty + Granate + + + Medical + Sanitätsmaterial + Lékařské vybavení + Medyczne + Medico + - + \ No newline at end of file diff --git a/addons/javelin/CfgEventhandlers.hpp b/addons/javelin/CfgEventhandlers.hpp index ae7f95b232..9c0c367ba6 100644 --- a/addons/javelin/CfgEventhandlers.hpp +++ b/addons/javelin/CfgEventhandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_pre_init)); @@ -15,4 +22,4 @@ class Extended_FiredBIS_EventHandlers { class All { ADDON = QUOTE(_this call FUNC(onFired)); }; -}; \ No newline at end of file +}; diff --git a/addons/javelin/XEH_PREP.hpp b/addons/javelin/XEH_PREP.hpp new file mode 100644 index 0000000000..fe9bbc553b --- /dev/null +++ b/addons/javelin/XEH_PREP.hpp @@ -0,0 +1,11 @@ + +PREP(lockKeyDown); +PREP(lockKeyUp); + +PREP(cycleFireMode); +PREP(showFireMode); + +PREP(onFired); +PREP(onOpticLoad); +PREP(onOpticDraw); +PREP(onOpticUnload); diff --git a/addons/javelin/XEH_preStart.sqf b/addons/javelin/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/javelin/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/javelin/XEH_pre_init.sqf b/addons/javelin/XEH_pre_init.sqf index 961f9af93d..045e4a46aa 100644 --- a/addons/javelin/XEH_pre_init.sqf +++ b/addons/javelin/XEH_pre_init.sqf @@ -1,15 +1,10 @@ #include "script_component.hpp" -PREP(lockKeyDown); -PREP(lockKeyUp); +ADDON = false; -PREP(cycleFireMode); -PREP(showFireMode); - -PREP(onFired); -PREP(onOpticLoad); -PREP(onOpticDraw); -PREP(onOpticUnload); +#include "XEH_PREP.hpp" GVAR(isLockKeyDown) = false; GVAR(pfehID) = -1; + +ADDON = true; diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index 8be68be5b5..f561806eaa 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -65,6 +65,10 @@ _newTarget = objNull; // Bail on fast movement if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady. ACE_player switchCamera "INTERNAL"; + if (player != ACE_player) then { + TRACE_2("Zeus, manually reseting RC after switchCamera",player,ACE_player); + player remoteControl ACE_player; + }; }; // Refresh the firemode diff --git a/addons/javelin/script_component.hpp b/addons/javelin/script_component.hpp index 984edc6988..e252ed1cbb 100644 --- a/addons/javelin/script_component.hpp +++ b/addons/javelin/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT javelin #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_JAVELIN #define DEBUG_MODE_FULL #endif diff --git a/addons/kestrel4500/CfgEventHandlers.hpp b/addons/kestrel4500/CfgEventHandlers.hpp index 2a05b72298..10dce0a9bf 100644 --- a/addons/kestrel4500/CfgEventHandlers.hpp +++ b/addons/kestrel4500/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); @@ -8,4 +15,4 @@ class Extended_PostInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; -}; \ No newline at end of file +}; diff --git a/addons/kestrel4500/XEH_PREP.hpp b/addons/kestrel4500/XEH_PREP.hpp new file mode 100644 index 0000000000..7d062c9ac8 --- /dev/null +++ b/addons/kestrel4500/XEH_PREP.hpp @@ -0,0 +1,16 @@ + +PREP(buttonPressed); +PREP(canShow); +PREP(collectData); +PREP(createKestrelDialog); +PREP(displayKestrel); +PREP(generateOutputData); +PREP(measureWindSpeed); +PREP(onCloseDialog); +PREP(onCloseDisplay); +PREP(restoreUserData); +PREP(storeUserData); +PREP(updateDisplay); +PREP(updateImpellerState); +PREP(updateMemory); +PREP(dayOfWeek); diff --git a/addons/kestrel4500/XEH_preInit.sqf b/addons/kestrel4500/XEH_preInit.sqf index b3f8ba755f..a7feade1c3 100644 --- a/addons/kestrel4500/XEH_preInit.sqf +++ b/addons/kestrel4500/XEH_preInit.sqf @@ -2,19 +2,6 @@ ADDON = false; -PREP(buttonPressed); -PREP(canShow); -PREP(collectData); -PREP(createKestrelDialog); -PREP(displayKestrel); -PREP(generateOutputData); -PREP(measureWindSpeed); -PREP(onCloseDialog); -PREP(onCloseDisplay); -PREP(restoreUserData); -PREP(storeUserData); -PREP(updateDisplay); -PREP(updateImpellerState); -PREP(updateMemory); -PREP(dayOfWeek); +#include "XEH_PREP.hpp" + ADDON = true; diff --git a/addons/kestrel4500/XEH_preStart.sqf b/addons/kestrel4500/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/kestrel4500/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/kestrel4500/script_component.hpp b/addons/kestrel4500/script_component.hpp index 90c338ebeb..87a0c0b594 100644 --- a/addons/kestrel4500/script_component.hpp +++ b/addons/kestrel4500/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT kestrel4500 #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_KESTREL4500 #define DEBUG_MODE_FULL #endif diff --git a/addons/kestrel4500/stringtable.xml b/addons/kestrel4500/stringtable.xml index 3ad9e8824f..defb44c2dc 100644 --- a/addons/kestrel4500/stringtable.xml +++ b/addons/kestrel4500/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/laser/CfgEventhandlers.hpp b/addons/laser/CfgEventhandlers.hpp index d925d0a12e..2abad68362 100644 --- a/addons/laser/CfgEventhandlers.hpp +++ b/addons/laser/CfgEventhandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_pre_init)); @@ -16,4 +23,4 @@ class Extended_Init_EventHandlers { init = QUOTE(_this call DFUNC(laser_init)); }; }; -}; \ No newline at end of file +}; diff --git a/addons/laser/XEH_PREP.hpp b/addons/laser/XEH_PREP.hpp new file mode 100644 index 0000000000..df185221ff --- /dev/null +++ b/addons/laser/XEH_PREP.hpp @@ -0,0 +1,26 @@ + +PREP(rotateVectLineGetMap); +PREP(rotateVectLine); +PREP(shootRay); +PREP(shootCone); +PREP(checkLos); + +PREP(findStrongestRay); + +PREP(onLaserDesignatorDraw); + +PREP(seekerFindLaserSpot); +PREP(laserOn); +PREP(laserOff); +PREP(handleLaserOn); +PREP(handleLaserOff); + +PREP(drawVisibleLaserTargets); + +PREP(laser_init); +PREP(vanillaLaserSeekerHandler); +PREP(laserTargetPFH); + +PREP(unitTurretCanLockLaser); +PREP(keyLaserCodeUp); +PREP(keyLaserCodeDown); diff --git a/addons/laser/XEH_preStart.sqf b/addons/laser/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/laser/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/laser/XEH_pre_init.sqf b/addons/laser/XEH_pre_init.sqf index 20f31d9e5b..502f47a9dc 100644 --- a/addons/laser/XEH_pre_init.sqf +++ b/addons/laser/XEH_pre_init.sqf @@ -1,36 +1,16 @@ #include "script_component.hpp" -PREP(rotateVectLineGetMap); -PREP(rotateVectLine); -PREP(shootRay); -PREP(shootCone); -PREP(checkLos); +ADDON = false; -PREP(findStrongestRay); - -PREP(onLaserDesignatorDraw); - -PREP(seekerFindLaserSpot); -PREP(laserOn); -PREP(laserOff); -PREP(handleLaserOn); -PREP(handleLaserOff); - -PREP(drawVisibleLaserTargets); - -PREP(laser_init); -PREP(vanillaLaserSeekerHandler); -PREP(laserTargetPFH); +#include "XEH_PREP.hpp" GVAR(VanillaLasers) = []; -PREP(unitTurretCanLockLaser); -PREP(keyLaserCodeUp); -PREP(keyLaserCodeDown); - // Laser default variables ACE_DEFAULT_LASER_CODE = 1001; ACE_DEFAULT_LASER_WAVELENGTH = 1550; ACE_DEFAULT_LASER_BEAMSPREAD = 1; -GVAR(laserEmitters) = HASH_CREATE; \ No newline at end of file +GVAR(laserEmitters) = HASH_CREATE; + +ADDON = true; diff --git a/addons/laser/script_component.hpp b/addons/laser/script_component.hpp index 6620f63c4d..f3542f686f 100644 --- a/addons/laser/script_component.hpp +++ b/addons/laser/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT laser #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_LASER #define DEBUG_MODE_FULL #endif diff --git a/addons/laser/stringtable.xml b/addons/laser/stringtable.xml index 4a478096d0..f51b9cd127 100644 --- a/addons/laser/stringtable.xml +++ b/addons/laser/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/laser_selfdesignate/CfgEventhandlers.hpp b/addons/laser_selfdesignate/CfgEventhandlers.hpp index 4cef7be4a3..cfa8d65d7c 100644 --- a/addons/laser_selfdesignate/CfgEventhandlers.hpp +++ b/addons/laser_selfdesignate/CfgEventhandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_pre_init)); @@ -16,4 +23,4 @@ class Extended_Init_EventHandlers { init = QUOTE(_this call DFUNC(initDesignatorActions)); }; }; -}; \ No newline at end of file +}; diff --git a/addons/laser_selfdesignate/CfgVehicles.hpp b/addons/laser_selfdesignate/CfgVehicles.hpp index 3233a1e92c..3e47e13ffd 100644 --- a/addons/laser_selfdesignate/CfgVehicles.hpp +++ b/addons/laser_selfdesignate/CfgVehicles.hpp @@ -17,18 +17,18 @@ class CfgVehicles { class B_Heli_Attack_01_F: Heli_Attack_01_base_F { class Turrets: Turrets { class MainTurret: MainTurret { - GVAR(Enabled) = 1; // Enable laser self-designation + GVAR(Enabled) = 0; // Enable laser self-designation }; }; }; - + class Plane: Air {}; class Plane_Base_F: Plane { class Turrets { class CopilotTurret; }; }; - + /* @TODO: LGB GBU class Plane_CAS_01_base_F: Plane_Base_F { class Turrets: Turrets { diff --git a/addons/laser_selfdesignate/XEH_PREP.hpp b/addons/laser_selfdesignate/XEH_PREP.hpp new file mode 100644 index 0000000000..6c05680db4 --- /dev/null +++ b/addons/laser_selfdesignate/XEH_PREP.hpp @@ -0,0 +1,7 @@ + +PREP(initDesignatorActions); +PREP(laserHudDesignateOn); +PREP(laserHudDesignateOff); +PREP(unitTurretHasDesignator); + +PREP(findLaserSource); diff --git a/addons/laser_selfdesignate/XEH_preStart.sqf b/addons/laser_selfdesignate/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/laser_selfdesignate/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/laser_selfdesignate/XEH_pre_init.sqf b/addons/laser_selfdesignate/XEH_pre_init.sqf index 3f8c92e4db..aa41d7e9bb 100644 --- a/addons/laser_selfdesignate/XEH_pre_init.sqf +++ b/addons/laser_selfdesignate/XEH_pre_init.sqf @@ -1,12 +1,11 @@ #include "script_component.hpp" -PREP(initDesignatorActions); -PREP(laserHudDesignateOn); -PREP(laserHudDesignateOff); -PREP(unitTurretHasDesignator); +ADDON = false; -PREP(findLaserSource); +#include "XEH_PREP.hpp" GVAR(active) = false; FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; + +ADDON = true; diff --git a/addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf b/addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf index 27beed3c6a..955f1ea51d 100644 --- a/addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf +++ b/addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf @@ -3,28 +3,21 @@ * Handler function for laser network code. * * Argument: - * 0: Emitter - * 1: Owner - * - * Return value: - * [position, direction] + * 0: Emitter + * + * Return Value: + * 0: position + * 1: direction + * + * Public: No */ - //findLaserSource.sqf -//#define DEBUG_MODE_FULL #include "script_component.hpp" -private["_emmiter", "_owner", "_gunnerInfo", "_turretInfo", "_povPos", "_povDir"]; - -_emmiter = _this select 0; -_owner = _this select 1; +private["_gunnerInfo", "_turretInfo"]; +params ["_emmiter"]; _gunnerInfo = [_emmiter, (currentWeapon _emmiter)] call CBA_fnc_getFirer; _turretInfo = [_emmiter, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); -_povPos = _turretInfo select 0; -_povDir = _turretInfo select 1; +_turretInfo params [["_povPos", -1], ["_povDir", -1]]; -if(!isNil "_povPos" && !isNil "_povDir") exitWith { - [_povPos, _povDir] -}; - -[-1,-1] \ No newline at end of file +[_povPos, _povDir] diff --git a/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf b/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf index a75e58f533..5afc581619 100644 --- a/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf +++ b/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf @@ -2,15 +2,17 @@ * Author: esteldunedain * Initializes the actions for turning on/off the laser for vehicles that have them * - * Argument: + * Arguments: * 0: Vehicle * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -EXPLODE_1_PVT(_this,_vehicle); +params ["_vehicle"]; // Add action to class if it is not already done private ["_type", "_initializedClasses"]; diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf index aa46c383bd..300811cba2 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf @@ -6,15 +6,14 @@ * 0: Shooter, player shooting the laser * 1: LaserUUID, the UUID of the laser returned by EFUNC(laser,laserOn) * 2: Local laser target, unused. - * - * Return value: - * true + * + * Return Value: + * True */ #include "script_component.hpp" if( (count _this) > 2) then { - EXPLODE_3_PVT(_this,_shooter,_laserUuid,_localLaserTarget); - + params ["", "_laserUuid"]; [_laserUuid] call EFUNC(laser,laserOff); // @TODO: Nou gets to field all tickets about missing lasers. //deleteVehicle _localLaserTarget; @@ -27,4 +26,4 @@ if(!isNil QGVAR(selfDesignateHandle)) then { GVAR(selfDesignateHandle) = nil; }; -true \ No newline at end of file +true diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index a07b197236..e585a409ff 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -3,12 +3,14 @@ * Turns on laser self designation from this vehicle based on the turret. * There are no arguments, because it is all strictly based on the users vehicle. * - * Argument: + * Arguments: + * None * - * Return value: - * N/A + * Return Value: + * None + * + * Public: No */ - //#define DEBUG_MODE_FULL #include "script_component.hpp" TRACE_1("enter", _this); @@ -17,20 +19,18 @@ TRACE_1("enter", _this); FUNC(laserHudDesignatePFH) = { private["_strongestResultPos", "_args", "_localLaserTarget", "_laserResultPosition", "_laserResult", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turretInfo", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"]; - _args = _this select 0; - - _shooter = _args select 0; - _localLaserTarget = _args select 2; + params ["_args"]; + _args params ["_shooter", "_localLaserTarget"]; _vehicle = vehicle _shooter; TRACE_1("", _args); - - if((vehicle _shooter) == _shooter || {!alive _shooter} || {isNull _vehicle} || {!GVAR(active)} ) exitWith { + + if((vehicle _shooter) == _shooter || {!alive _shooter} || {isNull _vehicle} || {!GVAR(active)} ) exitWith { _args call FUNC(laserHudDesignateOff); }; if(!([_shooter] call FUNC(unitTurretHasDesignator)) ) exitWith { _args call FUNC(laserHudDesignateOff); }; - + if( (count _args) < 4) then { _args set[3, ACE_diagTime + FCS_UPDATE_DELAY]; }; @@ -38,15 +38,15 @@ FUNC(laserHudDesignatePFH) = { // @TODO: We don't have anything here we need to do the calculations for right now /* - + _gunnerInfo = [_vehicle, (currentWeapon _vehicle)] call CBA_fnc_getFirer; _turretInfo = [_vehicle, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); _povPos = _turretInfo select 0; - + _laserCode = (vehicle ACE_player) getVariable["ace_laser_code", ACE_DEFAULT_LASER_CODE]; _waveLength = (vehicle ACE_player) getVariable["ace_laser_waveLength", ACE_DEFAULT_LASER_WAVELENGTH]; - - + + _laserResult = [_povPos, [_waveLength,_waveLength], _laserCode] call EFUNC(laser,seekerFindLaserSpot); _laserResultPosition = _laserResult select 0; TRACE_1("Search", _laserResult); @@ -56,12 +56,12 @@ FUNC(laserHudDesignatePFH) = { //_localLaserTarget setPosASL _laserResultPosition; }; */ - + if(ACE_diagTime > _forceUpdateTime) then { ["ace_fcs_forceUpdate", []] call ace_common_fnc_localEvent; _args set[3, ACE_diagTime + FCS_UPDATE_DELAY]; }; - + _this set[0, _args]; }; @@ -69,23 +69,22 @@ private ["_laserTarget", "_handle", "_vehicle", "_laserUuid", "_waveLength", "_b if(!GVAR(active)) then { GVAR(active) = true; - + TRACE_1("Activating laser", ""); - + // Get the self-designation variables, or use defaults _laserCode = (vehicle ACE_player) getVariable["ace_laser_code", ACE_DEFAULT_LASER_CODE]; _waveLength = (vehicle ACE_player) getVariable["ace_laser_waveLength", ACE_DEFAULT_LASER_WAVELENGTH]; _beamSpread = (vehicle ACE_player) getVariable["ace_laser_beamSpread", ACE_DEFAULT_LASER_BEAMSPREAD]; - + _laserUuid = [(vehicle ACE_player), ACE_player, QFUNC(findLaserSource), _waveLength, _laserCode, _beamSpread] call EFUNC(laser,laserOn); - + // @TODO: Create the local target for the players side // @TODO: Nou gets to field all tickets about missing lasers. //_localLaserTarget = "LaserTargetW" createVehicleLocal (getpos ACE_player); - + GVAR(selfDesignateHandle) = [FUNC(laserHudDesignatePFH), 0.1, [ACE_player, _laserUuid, nil]] call CBA_fnc_addPerFrameHandler; } else { [] call FUNC(laserHudDesignateOff); [] call FUNC(laserHudDesignateOn); }; - diff --git a/addons/laser_selfdesignate/functions/fnc_unitTurretHasDesignator.sqf b/addons/laser_selfdesignate/functions/fnc_unitTurretHasDesignator.sqf index 291deb5015..46c3afaaa3 100644 --- a/addons/laser_selfdesignate/functions/fnc_unitTurretHasDesignator.sqf +++ b/addons/laser_selfdesignate/functions/fnc_unitTurretHasDesignator.sqf @@ -2,15 +2,17 @@ * Author: esteldunedain * Checks if the turret occupied by the given unit has a laser designator * - * Argument: + * Arguments: * 0: Unit * - * Return value: - * Has designator? + * Return Value: + * Has unit designator + * + * Public: No */ #include "script_component.hpp" -EXPLODE_1_PVT(_this,_unit); +params ["_unit"]; // Get the player turret path private ["_turret","_config","_turretConfig"]; diff --git a/addons/laser_selfdesignate/script_component.hpp b/addons/laser_selfdesignate/script_component.hpp index d0e095924d..fc0d608e32 100644 --- a/addons/laser_selfdesignate/script_component.hpp +++ b/addons/laser_selfdesignate/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT laser_selfdesignate #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_LASER_SELFDESIGNATE #define DEBUG_MODE_FULL #endif diff --git a/addons/laser_selfdesignate/stringtable.xml b/addons/laser_selfdesignate/stringtable.xml index cdd7439200..17c562a2bb 100644 --- a/addons/laser_selfdesignate/stringtable.xml +++ b/addons/laser_selfdesignate/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/laserpointer/CfgEventHandlers.hpp b/addons/laserpointer/CfgEventHandlers.hpp index 0cd959a047..becf395052 100644 --- a/addons/laserpointer/CfgEventHandlers.hpp +++ b/addons/laserpointer/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/laserpointer/XEH_PREP.hpp b/addons/laserpointer/XEH_PREP.hpp new file mode 100644 index 0000000000..c5dcd74a75 --- /dev/null +++ b/addons/laserpointer/XEH_PREP.hpp @@ -0,0 +1,4 @@ + +PREP(drawLaserpoint); +PREP(onDraw); +PREP(switchLaserLightMode); diff --git a/addons/laserpointer/XEH_preInit.sqf b/addons/laserpointer/XEH_preInit.sqf index 1460abda36..a7feade1c3 100644 --- a/addons/laserpointer/XEH_preInit.sqf +++ b/addons/laserpointer/XEH_preInit.sqf @@ -2,8 +2,6 @@ ADDON = false; -PREP(drawLaserpoint); -PREP(onDraw); -PREP(switchLaserLightMode); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/laserpointer/XEH_preStart.sqf b/addons/laserpointer/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/laserpointer/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/laserpointer/initKeybinds.sqf b/addons/laserpointer/initKeybinds.sqf index a4164d420e..2251ddfb71 100644 --- a/addons/laserpointer/initKeybinds.sqf +++ b/addons/laserpointer/initKeybinds.sqf @@ -5,7 +5,7 @@ // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false}; [ACE_player, currentWeapon ACE_player] call FUNC(switchLaserLightMode); true diff --git a/addons/laserpointer/script_component.hpp b/addons/laserpointer/script_component.hpp index 34c689cbbf..cee00afdca 100644 --- a/addons/laserpointer/script_component.hpp +++ b/addons/laserpointer/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT laserpointer #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_LASERPOINTER #define DEBUG_MODE_FULL #endif diff --git a/addons/laserpointer/stringtable.xml b/addons/laserpointer/stringtable.xml index 1a4182bd8e..afd11addb1 100644 --- a/addons/laserpointer/stringtable.xml +++ b/addons/laserpointer/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ Pointeur laser (rouge) Laserpointer (rot) Лазерный прицел (красный) - Laserové ukazovátko (červené) + Laserové ukazovátko (Červené) Wskaźnik laserowy (czerwony) Lézer-pointer (piros) Puntero láser (rojo) @@ -18,7 +18,7 @@ Pointeur laser (vert) Laserpointer (grün) Лазерный прицел (зелёный) - Laserové ukazovátko (zelené) + Laserové ukazovátko (Zelené) Wskaźnik laserowy (zielony) Lézer-pointer (zöld) Puntero láser (verde) @@ -86,4 +86,4 @@ Alternar entre Laser / Laser IV - + \ No newline at end of file diff --git a/addons/logistics_uavbattery/CfgEventHandlers.hpp b/addons/logistics_uavbattery/CfgEventHandlers.hpp index b928bc2de6..be284a9d70 100644 --- a/addons/logistics_uavbattery/CfgEventHandlers.hpp +++ b/addons/logistics_uavbattery/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/logistics_uavbattery/XEH_PREP.hpp b/addons/logistics_uavbattery/XEH_PREP.hpp new file mode 100644 index 0000000000..9631f53c24 --- /dev/null +++ b/addons/logistics_uavbattery/XEH_PREP.hpp @@ -0,0 +1,3 @@ + +PREP(canRefuelUAV); +PREP(refuelUAV); diff --git a/addons/logistics_uavbattery/XEH_preInit.sqf b/addons/logistics_uavbattery/XEH_preInit.sqf index f41b2c4ce8..a7feade1c3 100644 --- a/addons/logistics_uavbattery/XEH_preInit.sqf +++ b/addons/logistics_uavbattery/XEH_preInit.sqf @@ -2,7 +2,6 @@ ADDON = false; -PREP(canRefuelUAV); -PREP(refuelUAV); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/logistics_uavbattery/XEH_preStart.sqf b/addons/logistics_uavbattery/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/logistics_uavbattery/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/logistics_uavbattery/script_component.hpp b/addons/logistics_uavbattery/script_component.hpp index 01ea3608e7..836a39c415 100644 --- a/addons/logistics_uavbattery/script_component.hpp +++ b/addons/logistics_uavbattery/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT logistics_uavbattery #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_LOGISTICS_UAVBATTERY #define DEBUG_MODE_FULL #endif diff --git a/addons/logistics_uavbattery/stringtable.xml b/addons/logistics_uavbattery/stringtable.xml index 5b3a219a30..c38c3daae3 100644 --- a/addons/logistics_uavbattery/stringtable.xml +++ b/addons/logistics_uavbattery/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -62,16 +62,16 @@ Используется для зарядки переносных БПЛА - Recharging ... - Aufladen ... - Recargando ... - Rechargement ... - Ładowanie ... - Akku feltöltése ... - Dobíjení ... - Recarregando ... - In ricarica ... - Заряжается ... + Recharging... + Aufladen... + Recargando... + Rechargement... + Ładowanie... + Akku feltöltése... + Dobíjení... + Recarregando... + In ricarica... + Заряжается... \ No newline at end of file diff --git a/addons/logistics_wirecutter/CfgEventHandlers.hpp b/addons/logistics_wirecutter/CfgEventHandlers.hpp index 3daad1425a..47564cbd2d 100644 --- a/addons/logistics_wirecutter/CfgEventHandlers.hpp +++ b/addons/logistics_wirecutter/CfgEventHandlers.hpp @@ -1,8 +1,16 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; + class Extended_PostInit_EventHandlers { class ADDON { clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); diff --git a/addons/logistics_wirecutter/XEH_PREP.hpp b/addons/logistics_wirecutter/XEH_PREP.hpp new file mode 100644 index 0000000000..d52c83547b --- /dev/null +++ b/addons/logistics_wirecutter/XEH_PREP.hpp @@ -0,0 +1,4 @@ + +PREP(cutDownFence); +PREP(interactEH); +PREP(isFence); diff --git a/addons/logistics_wirecutter/XEH_preInit.sqf b/addons/logistics_wirecutter/XEH_preInit.sqf index 39620bf35c..a7feade1c3 100644 --- a/addons/logistics_wirecutter/XEH_preInit.sqf +++ b/addons/logistics_wirecutter/XEH_preInit.sqf @@ -2,8 +2,6 @@ ADDON = false; -PREP(cutDownFence); -PREP(interactEH); -PREP(isFence); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/logistics_wirecutter/XEH_preStart.sqf b/addons/logistics_wirecutter/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/logistics_wirecutter/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/logistics_wirecutter/script_component.hpp b/addons/logistics_wirecutter/script_component.hpp index a86ace1592..a66a7bba08 100644 --- a/addons/logistics_wirecutter/script_component.hpp +++ b/addons/logistics_wirecutter/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_LOGISTICS_WIRECUTTER #define DEBUG_MODE_FULL diff --git a/addons/logistics_wirecutter/stringtable.xml b/addons/logistics_wirecutter/stringtable.xml index 085971264c..ef5d0522e3 100644 --- a/addons/logistics_wirecutter/stringtable.xml +++ b/addons/logistics_wirecutter/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -38,16 +38,16 @@ Разрезать забор - Cutting Fences / Wires ... - Zaun / Draht schneiden ... - Cortando alambrado / cables ... - Przecinanie płotu / drutów ... - Přestřihávám plot / dráty ... - Cisaille l'obstacle ... - Cortando Cerca / Arame ... - Sto tagliando ... - Drótok elvágása ... - Разрезаем забор / провода ... + Cutting Fences / Wires... + Zaun / Draht schneiden... + Cortando alambrado / cables... + Przecinanie płotu / drutów... + Přestřihávám plot / dráty... + Cisaille l'obstacle... + Cortando Cerca / Arame... + Sto tagliando... + Drótok elvágása... + Разрезаем забор / провода... Fence cut diff --git a/addons/magazinerepack/CfgEventHandlers.hpp b/addons/magazinerepack/CfgEventHandlers.hpp index b928bc2de6..be284a9d70 100644 --- a/addons/magazinerepack/CfgEventHandlers.hpp +++ b/addons/magazinerepack/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/magazinerepack/XEH_PREP.hpp b/addons/magazinerepack/XEH_PREP.hpp new file mode 100644 index 0000000000..fc1861dc3d --- /dev/null +++ b/addons/magazinerepack/XEH_PREP.hpp @@ -0,0 +1,6 @@ + +PREP(getMagazineChildren); +PREP(magazineRepackFinish); +PREP(magazineRepackProgress); +PREP(simulateRepackEvents); +PREP(startRepackingMagazine); diff --git a/addons/magazinerepack/XEH_preInit.sqf b/addons/magazinerepack/XEH_preInit.sqf index f78cf34ee4..a7feade1c3 100644 --- a/addons/magazinerepack/XEH_preInit.sqf +++ b/addons/magazinerepack/XEH_preInit.sqf @@ -2,10 +2,6 @@ ADDON = false; -PREP(getMagazineChildren); -PREP(magazineRepackFinish); -PREP(magazineRepackProgress); -PREP(simulateRepackEvents); -PREP(startRepackingMagazine); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/magazinerepack/XEH_preStart.sqf b/addons/magazinerepack/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/magazinerepack/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/magazinerepack/script_component.hpp b/addons/magazinerepack/script_component.hpp index 7b390f7126..947c8c1ca1 100644 --- a/addons/magazinerepack/script_component.hpp +++ b/addons/magazinerepack/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT magazinerepack #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MAGAZINEREPACK #define DEBUG_MODE_FULL #endif diff --git a/addons/magazinerepack/stringtable.xml b/addons/magazinerepack/stringtable.xml index c6879280da..1fc873f0c3 100644 --- a/addons/magazinerepack/stringtable.xml +++ b/addons/magazinerepack/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -7,8 +7,8 @@ Reorganizar cargadores Réorganiser les chargeurs Przepakuj magazynki - Přepáskovat Zásobníky - Ricarica caricatori + Přepáskovat zásobníky + Riempi i caricatori Reorganizar Carregadores Újratárazás Перепаковать магазины @@ -19,7 +19,7 @@ Menú de selección de cargador Sélectionner menu des chargeurs Menu wyboru magazynków - Zvolit Menu zásobníků + Zvolit menu zásobníků Seleziona menù di ricarica Menu de Seleção de Carregador Fegyvertár menü kiválasztás @@ -31,23 +31,23 @@ Seleccionar cargador Sélectionner chargeur Wybierz magazynek - Zvolit zásobník + Vyber zásobník Seleziona caricatore Selecionar Carregador Tár kiválasztása Выбрать магазин - Repacking Magazines ... - Magazine umpacken ... - Reorganizando cargadores ... - Réorganisation des chargeurs ... - Przepakowywanie magazynków ... - Páskuji zásobníky ... - Sto ricaricando le munizioni ... - Reorganizando Carregadores ... - Újratárazás ... - Перепаковка магазинов ... + Repacking Magazines... + Magazine umpacken... + Reorganizando cargadores... + Réorganisation des chargeurs... + Przepakowywanie magazynków... + Přepáskovávám zásobník... + Sto riempendo i caricatori... + Reorganizando Carregadores... + Újratárazás... + Перепаковка магазинов... Repacked Magazines @@ -56,7 +56,7 @@ Chargeurs réorganisés Magazynki przepakowane Přepáskované zásobníky - Caricatore ricaricato + Caricatore riempito Carregadores Reorganizados Újratárazott tárak Магазины перепакованы @@ -68,7 +68,7 @@ %1 chargeur(s) plein(s) et %2 cartouche(s) en rab Pełnych magazynków: %1.<br/>Dodatkowych naboi: %2. %1 plný zásobník(y) a %2 munice navíc - %1 caricatore(i) pieno e %2 munizioni extra + %1 caricatore(i) pieno e %2 munizione(i) extra %1 carregador(es) cheio(s) e %2 disparo(s) a mais %1 teljes tár és %2 extra lőszer %1 полных магазина(ов) и %2 патрона(ов) @@ -82,7 +82,7 @@ Páskování dokončeno Przepakowywanie zakończone Újratárazás befejezve - Riempi caricatore + Caricatori riempiti Reorganização Terminada @@ -100,7 +100,7 @@ %1 Full and %2 Partial %1 plein(s) et %2 partiel(s) - %1 Vollständigen und %2 Teilweisen + %1 volle Magazine und 1 Magazin mit %2 Partronen %1 Llenos y %2 Incompletos %1 полных и %2 неполных %1 plný a %2 částečně @@ -110,4 +110,4 @@ %1 Total e %2 Parcial - \ No newline at end of file + diff --git a/addons/main/config.cpp b/addons/main/config.cpp index a013d8e971..57e2c782b8 100644 --- a/addons/main/config.cpp +++ b/addons/main/config.cpp @@ -564,3 +564,10 @@ class CfgMods { #include "CfgModuleCategories.hpp" #include "CfgVehicleClasses.hpp" + +// @todo delete this after CBA update, defines undefined global variable +class Extended_PreStart_EventHandlers { + class ADDON { + init = "with uiNamespace do {SLX_XEH_COMPILE_NEW = CBA_fnc_compileFunction};"; + }; +}; diff --git a/addons/main/script_component.hpp b/addons/main/script_component.hpp index 3ac1d0b7aa..dd7f17429e 100644 --- a/addons/main/script_component.hpp +++ b/addons/main/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MAIN #define DEBUG_MODE_FULL diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 62d0b33a6c..544cff6842 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -38,30 +38,53 @@ #define MACRO_ADDWEAPON(WEAPON,COUNT) class _xx_##WEAPON { \ - weapon = #WEAPON; \ - count = COUNT; \ + weapon = #WEAPON; \ + count = COUNT; \ } #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ + name = #ITEM; \ + count = COUNT; \ } #define MACRO_ADDMAGAZINE(MAGAZINE,COUNT) class _xx_##MAGAZINE { \ - magazine = #MAGAZINE; \ - count = COUNT; \ + magazine = #MAGAZINE; \ + count = COUNT; \ } #define MACRO_ADDBACKPACK(BACKPACK,COUNT) class _xx_##BACKPACK { \ - backpack = #BACKPACK; \ - count = COUNT; \ + backpack = #BACKPACK; \ + count = COUNT; \ } +// item types +#define TYPE_DEFAULT 0 +#define TYPE_MUZZLE 101 +#define TYPE_OPTICS 201 +#define TYPE_FLASHLIGHT 301 +#define TYPE_BIPOD 302 +#define TYPE_FIRST_AID_KIT 401 +#define TYPE_FINS 501 // not implemented +#define TYPE_BREATHING_BOMB 601 // not implemented +#define TYPE_NVG 602 +#define TYPE_GOGGLE 603 +#define TYPE_SCUBA 604 // not implemented +#define TYPE_HEADGEAR 605 +#define TYPE_FACTOR 607 +#define TYPE_RADIO 611 +#define TYPE_HMD 616 +#define TYPE_BINOCULAR 617 +#define TYPE_MEDIKIT 619 +#define TYPE_TOOLKIT 620 +#define TYPE_UAV_TERMINAL 621 +#define TYPE_VEST 701 +#define TYPE_UNIFORM 801 +#define TYPE_BACKPACK 901 #ifdef DISABLE_COMPILE_CACHE #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)) #else - #define PREP(fncName) DFUNC(fncName) = QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)) call SLX_XEH_COMPILE + #define PREP(fncName) [QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)), QFUNC(fncName)] call SLX_XEH_COMPILE_NEW #endif #define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QUOTE(PATHTOF(folder\__PREP__.sqf)) @@ -175,4 +198,13 @@ #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) +#define PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \ + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9, I=%10 J=%11', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H), RETNIL(I), RETNIL(J)] +#ifdef DEBUG_MODE_FULL +#define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \ + [THIS_FILE_, __LINE__, PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J)] call CBA_fnc_log +#else + #define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) /* disabled */ +#endif + #include "script_debug.hpp" diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index 91041e1f4c..55a478b52f 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -5,7 +5,7 @@ #define MAJOR 3 #define MINOR 4 -#define PATCHLVL 1 +#define PATCHLVL 3 #define BUILD 0 #define VERSION MAJOR.MINOR.PATCHLVL.BUILD diff --git a/addons/main/stringtable.xml b/addons/main/stringtable.xml index 02021520b4..b1baef93a9 100644 --- a/addons/main/stringtable.xml +++ b/addons/main/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -9,6 +9,7 @@ ACE: логистика ACE Logistika ACE Logística + Logistica ACE - + \ No newline at end of file diff --git a/addons/map/CfgEventHandlers.hpp b/addons/map/CfgEventHandlers.hpp index 49b87fb4fd..5c77927e53 100644 --- a/addons/map/CfgEventHandlers.hpp +++ b/addons/map/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/map/XEH_PREP.hpp b/addons/map/XEH_PREP.hpp new file mode 100644 index 0000000000..6737249165 --- /dev/null +++ b/addons/map/XEH_PREP.hpp @@ -0,0 +1,13 @@ + +PREP(blueForceTrackingModule); +PREP(blueForceTrackingUpdate); +PREP(compileFlashlightMenu); +PREP(determineMapLight); +PREP(determineZoom); +PREP(flashlightGlow); +PREP(getUnitFlashlights); +PREP(moduleMap); +PREP(onDrawMap); +PREP(simulateMapLight); +PREP(switchFlashlight); +PREP(updateMapEffects); diff --git a/addons/map/XEH_preInit.sqf b/addons/map/XEH_preInit.sqf index 9e123a3877..7d00e938cf 100644 --- a/addons/map/XEH_preInit.sqf +++ b/addons/map/XEH_preInit.sqf @@ -3,17 +3,6 @@ ADDON = false; 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); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/map/XEH_preStart.sqf b/addons/map/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/map/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/map/functions/fnc_blueForceTrackingUpdate.sqf b/addons/map/functions/fnc_blueForceTrackingUpdate.sqf index e9a619b5a4..3e966ca5f6 100644 --- a/addons/map/functions/fnc_blueForceTrackingUpdate.sqf +++ b/addons/map/functions/fnc_blueForceTrackingUpdate.sqf @@ -16,15 +16,14 @@ if (GVAR(BFT_Enabled) and {(!isNil "ACE_player") and {alive ACE_player}}) then { _groupsToDrawMarkers = []; _playerSide = call EFUNC(common,playerSide); - if !(GVAR(BFT_HideAiGroups)) then { - _groupsToDrawMarkers = [allGroups, {side _this == _playerSide}] call EFUNC(common,filter); - } else { - _groupsToDrawMarkers = [allGroups, { - _anyPlayers = { - [_x] call EFUNC(common,isPlayer); - } count units _this; - (side _this == _playerSide) && _anyPlayers > 0 - }] call EFUNC(common,filter); + _groupsToDrawMarkers = allGroups select {side _x == _playerSide}; + + if (GVAR(BFT_HideAiGroups)) then { + _groupsToDrawMarkers = _groupsToDrawMarkers select { + { + _x call EFUNC(common,isPlayer); + } count units _x > 0; + }; }; { diff --git a/addons/map/functions/fnc_determineMapLight.sqf b/addons/map/functions/fnc_determineMapLight.sqf index 9712b84515..c647e93e0c 100644 --- a/addons/map/functions/fnc_determineMapLight.sqf +++ b/addons/map/functions/fnc_determineMapLight.sqf @@ -90,26 +90,21 @@ TRACE_1("Player is on foot or in an open vehicle",""); _lightLevel = _lightLevel max ([_unit, _x] call EFUNC(common,lightIntensityFromObject)); } forEach nearestObjects [_unit, ["All"], 40]; - // @todo: Illumination flares (timed) - // Using chemlights -_nearObjects = [_unit nearObjects ["SmokeShell", 4], { - alive _this && {(typeOf _this == "Chemlight_red") || { - (typeOf _this == "Chemlight_green") || { - (typeOf _this == "Chemlight_blue") || { - (typeOf _this == "Chemlight_yellow")}}}}}] call EFUNC(common,filter); +_nearObjects = (_unit nearObjects ["SmokeShell", 4]) select {alive _x && {toLower typeOf _x in ["chemlight_red", "chemlight_green", "chemlight_blue", "chemlight_yellow"]}}; + if (count (_nearObjects) > 0) then { _light = _nearObjects select 0; _ll = (1 - ((((_unit distance _light) - 2)/2) max 0)) * 0.4; if (_ll > _lightLevel) then { - _flareTint = switch (typeOf _light) do { - case "Chemlight_red" : {[1,0,0,1]}; - case "Chemlight_green" : {[0,1,0,1]}; - case "Chemlight_blue" : {[0,0,1,1]}; - case "Chemlight_yellow" : {[1,1,0,1]}; + _flareTint = switch (toLower typeOf _light) do { + case "chemlight_red" : {[1,0,0,1]}; + case "chemlight_green" : {[0,1,0,1]}; + case "chemlight_blue" : {[0,0,1,1]}; + case "chemlight_yellow" : {[1,1,0,1]}; }; _lightTint = [_lightTint, _flareTint, (_ll - _lightLevel)/(1 - _lightLevel)] call _fnc_blendColor; _lightLevel = _ll; diff --git a/addons/map/script_component.hpp b/addons/map/script_component.hpp index c62086b03a..c8767d76a0 100644 --- a/addons/map/script_component.hpp +++ b/addons/map/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT map #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MAP #define DEBUG_MODE_FULL #endif diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index a7eb5482e2..1ed523bef6 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -11,6 +11,7 @@ Carte Térkép Карта + Mappa Map illumination? @@ -22,15 +23,18 @@ Luminosité Térkép megvilágítása? Освещение карты? + Illuminazione Mappa? Simulate map lighting based on ambient lighting and player's items? Simuliere Kartenbeleuchtung auf Basis des Umgebungslichts sowie der mitgeführten Gegenstände? 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 + 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? + Simulovat nasvícení mapy v závisloti na okolí a předmětů hráče? + Simula illuminazione della mappa in base alla luce ambientale e agli oggetti del giocatore? Map flashlight glow? @@ -39,14 +43,19 @@ Свет фонаря на карте? Brilho de lanterna no mapa? Resplandor de linterna en el mapa? + Nasvícení mapy pomocí baterky? + Luce della torcia in mappa? Add external glow to players who use flashlight on map? Kartenbeleuchtung mittels Taschenlampe durch Dritte erkennbar? Pokaż poświatę światła latarki na graczu, który używa latarki na widoku mapy? + Ajouter un effet de lumière sur un joueur utilisant une lampe torche sur la carte ? Добавить свет при использовании фонаря на карте? Adicionar brilho externo para jogadores que usam lanterna no mapa? Añadir resplandor externo a los jugadores que utilizan la linterna en el mapa? + Přidat externí záři hráči který používá baterku v mapě? + Aggiungi luce esterna a giocatori che usano la torcia in mappa? Map shake? @@ -58,6 +67,7 @@ Tremblement de la carte? Térkép-rázkódás? Тряска карты? + Scuoti la mappa? Make map shake when walking? @@ -66,9 +76,10 @@ Kamerawackeln beim Gehen? Umožnit třesení mapy za pochodu? Tremer o mapa enquanto caminha? - La carte tremble lors d'un déplacement? + La carte tremble lors d'un déplacement ? Rázkódjon-e a térkép mozgáskor? Заставлять карту трястись при ходьбе? + Far scuotere la mappa mentre cammini? Limit map zoom? @@ -80,6 +91,7 @@ Limiter le zoom de la carte? Térkép-nagyítás korlátozása? Ограничить приближение карты? + Limita lo zoom in mappa? Limit the amount of zoom available for the map? @@ -91,6 +103,7 @@ Limite le zoom maximum pour la carte? Korlátozva legyen-e a nagyítás mennyisége a térképnél? Ограничить максимальное приближение, доступное на карте? + Limita l'ammontare di zoom disponibile per la mappa? Show cursor coordinates? @@ -99,9 +112,10 @@ Zeige Mauszeiger-Koordinaten? Zobrazit souřadnice u kurzoru? Mostrar coordenadas no cursor? - Afficher les coordonnées sur le curseur? + Afficher les coordonnées sur le curseur ? Kurzor-koordináták mutatása? Показывать координаты курсора? + Mostra coordinate sul cursore? Show the grid coordinates on the mouse pointer? @@ -110,9 +124,10 @@ 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? + Affiche les coordonnées à coté du curseur ? Mutatva legyen-e a kurzornál található rész rácskoordinátája? Показывать координаты около курсора мыши? + Mostra la griglia coordinate sul cursore mouse? This module allows you to customize the map screen. @@ -124,6 +139,7 @@ Ez a modul lehetővé teszi a térképnézet testreszabását. Этот модуль позволяет настроить отображение карты. Este módulo permite personalizar la pantalla del mapa. + Questo modulo ti permette di customizzare lo schermo della mappa. Blue Force Tracking @@ -135,6 +151,7 @@ Blue Force Tracking Blue Force követés Система слежения Blue Force Tracking + Blue Force Tracking BFT Enable @@ -146,6 +163,7 @@ Activer le Suivi des Forces Alliées BFT engedélyezése Включить BFT + Abilita BFT Enable Blue Force Tracking. Default: No @@ -157,6 +175,7 @@ Activer le SFA. Défaut: non Blue Force követés engedélyezése. Alapértelmezett: Nem Включает систему служения BFT. По-умолчанию: Нет + Abilita Blue Force Tracking. Default: No Interval @@ -168,6 +187,7 @@ Intervalle Intervallum Интервал + Intervallo How often the markers should be refreshed (in seconds) @@ -176,9 +196,10 @@ 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? + Fréquence de rafraîchissement des marqueurs ? Milyen gyakran frissüljenek a jelölők (másodpercben) Как часто должны обновляться маркеры (в секундах) + Quanto spesso vengono aggiornati i marker (in secondi) Hide AI groups? @@ -187,9 +208,10 @@ KI-Gruppen verstecken? Skrýt AI skupiny? Esconder grupos de IA? - Cacher les groupes IA? + Cacher les groupes IA ? AI csoportok elrejtése? Скрыть группы ботов? + Nascondere gruppi IA? Hide markers for 'AI only' groups? @@ -198,9 +220,10 @@ 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? + Cacher les marqueurs pour les groupes d'IA seulement ? Jelölők elrejtése "csak AI" csoportoknál? Скрыть маркеры групп, которые состоят полностью из ботов? + Nascondi markers per gruppi di sole IA? This module allows the tracking of allied units with BFT map markers. @@ -212,60 +235,73 @@ 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. + Questo modulo permette il tracciamento di unità alleate con i marker BFT in mappa Flashlights Taschenlampen Latarki + Lampes de poche Lanternas Фонари Svítilny Linternas + Torcia NVG NSG Noktowizja Óculos de Visão Noturna + Lunettes de vision nocturne ПНВ NVG NVG + NVG On Ein Włącz Ligado + Allumer Вкл. Zapnout Encendido + Acceso Off Aus Wyłącz Desligado + Éteindre Выкл. Vypnout Apagado + Spento Increase Brightness Erhöhe Helligkeit Zwiększ czułość Aumentar brilho + Augmenter la luminosité Увеличить яркость Zvýšit jas Aumentar brillo + Aumenta Luminosità Decrease Brightness Veringere Helligkeit Zmniejsz czułość Diminuir brilho + Diminuer la luminosité Уменьшить яркость Snížit jas Reducir brillo + Diminuisci Luminosità Turn On %1 @@ -297,6 +333,8 @@ Ust. domyślny kanał Definir canal no início Установить канал на старте + Zvolit kanál po startu + Imposta Canale all'Avvio Change the starting marker channel at mission start @@ -304,6 +342,8 @@ Ustaw domyślny kanał dla markerów przy starcie misji Muda o canal do marcador no início da missão Изменить начальный канал для установки маркеров при запуске миссии + Nastavit kanál po startu mise + Cambia il canale marker iniziale all'avvio di missione diff --git a/addons/map_gestures/CfgEventHandlers.hpp b/addons/map_gestures/CfgEventHandlers.hpp index 7e0c8d2ce3..b0848d0248 100644 --- a/addons/map_gestures/CfgEventHandlers.hpp +++ b/addons/map_gestures/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/map_gestures/XEH_PREP.hpp b/addons/map_gestures/XEH_PREP.hpp new file mode 100644 index 0000000000..eba9f5bfe8 --- /dev/null +++ b/addons/map_gestures/XEH_PREP.hpp @@ -0,0 +1,12 @@ + +PREP(assignClientIDOnServer); +PREP(drawMapGestures); +PREP(endTransmit); +PREP(getProximityPlayers); +PREP(initTransmit); +PREP(isValidColorArray); +PREP(moduleGroupSettings); +PREP(moduleSettings); +PREP(receiverInit); +PREP(transmit); +PREP(transmitterInit); diff --git a/addons/map_gestures/XEH_preInit.sqf b/addons/map_gestures/XEH_preInit.sqf index 8154106fd6..a7feade1c3 100644 --- a/addons/map_gestures/XEH_preInit.sqf +++ b/addons/map_gestures/XEH_preInit.sqf @@ -2,16 +2,6 @@ ADDON = false; -PREP(assignClientIDOnServer); -PREP(drawMapGestures); -PREP(endTransmit); -PREP(getProximityPlayers); -PREP(initTransmit); -PREP(isValidColorArray); -PREP(moduleGroupSettings); -PREP(moduleSettings); -PREP(receiverInit); -PREP(transmit); -PREP(transmitterInit); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/map_gestures/XEH_preStart.sqf b/addons/map_gestures/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/map_gestures/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/map_gestures/script_component.hpp b/addons/map_gestures/script_component.hpp index 1a5ecada12..2bc9b212d0 100644 --- a/addons/map_gestures/script_component.hpp +++ b/addons/map_gestures/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT map_gestures #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MAP_GESTURES #define DEBUG_MODE_FULL #endif diff --git a/addons/map_gestures/stringtable.xml b/addons/map_gestures/stringtable.xml index b53508e538..9da73c36ca 100644 --- a/addons/map_gestures/stringtable.xml +++ b/addons/map_gestures/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -6,61 +6,77 @@ Gestos no mapa Gesty na mapie Жесты на карте + Ukazování v mapě + Gesti Mappa Enabled Ativado Aktywne Включено - Povoleno + Povolit + Abilita Map Gesture Max Range Distância para gestos no mapa Maks. zasięg gestów Макс. дистанция жестов на карте + Max. vzdálenost pro ukazování v mapě + Distanza Massima Gesti Mappa Max range between players to show the map gesture indicator [default: 7 meters] Distância max. entre os jogadores para mostrar o indicador de gesto no mapa [padrão: 7 metros] Maksymalny zasięg, w obrębie którego gesty będą widoczne dla graczy [domyślnie: 7 metrów] Макс. дистанция между игроками для отображения жестов на карте [по-умолчанию: 7 метров] + Maximální vzdálenost mezi hráči pro zobrazení indikátoru ukázání v mapě [výchozí: 7 metrů] + Distanza massima tra giocatori per mostrare i gesti in mappa [default: 7 metri] Lead Default Color Cor padrão para o líder Domyślny kolor lidera Лид. цвет по-умолчанию + Výchozí barva velitele + Colore Default Caposquadra Fallback Color value for group leaders when there is no group setting. [Module: leave blank to not force on clients] Valor de cor alternativa para líderes de grupo Domyślny kolor dla liderów grup. Значение цвета для лидеров групп. + Colore di riserva dei capisquadra quando non c'è nessuna impostazione gruppo. [Modulo: lascia vuoto per non forzare su clients] Default Color Cor padrão Kolor domyślny Цвет по-умолчанию + Výchozí barva + Colore Default Fallback Color value when there is no group setting. [Module: leave blank to not force on clients] Valor alternativo de cor Kolor domyślny Значение цвета. + Colore di riserva quando non ci sono impostazioni gruppo. [Modulo: lascia vuto per non forzare sui clients] Lead Color Cor do líder Kolor lidera Лид. цвет + Barva velitele + Colore Caposquadra Color value for group leaders of groups synced with this module. Valor de cor para líderes de grupo sincronizados com este módulo. Kolor dla liderów grup zsynchronizowanych z tym modułem. Значение цвета для лидеров групп, которые [группы] синхронизированы с этим модулем. + Colore dei Caposquadra per gruppi sincronizzati con questo modulo. Color @@ -68,18 +84,22 @@ Kolor Цвет Barva + Colore Color value for group members of groups synced with this module. Valor de cor para membros de grupo sincronizados com este módulo. Kolor dla członków grup zsynchronizowanych z tym modułem. Значение цвета для членов групп, которые [группы] синхронизированы с этим модулем. + Colore per membri di gruppi sincronizzati con questo modulo. Map Gestures - Group Settings Gestos no mapa - Definições de Grupo Gesty na mapie - ustawienia grup Жесты на карте - настройки групп + Ukazování v mapě - nastavení skupiny + Gesti Mappa - Impostazioni Gruppi Update Interval @@ -87,6 +107,7 @@ Interwał aktualizacji Интервал обновления Interval aktualizace + Intervallo Aggiornamento Time between data updates. @@ -94,54 +115,67 @@ Odstęp pomiędzy aktualizacjami danych Время между обновлениями данных. Čas mezi aktualizacemi dat. + Intervallo tra aggiornamenti dati. Group color configurations Configurações de cores de grupo Konf. koloru grup Конфигурация цвета групп + Konfigurace barvy pro skupinu + Configurazioni colori dei gruppi Group color configuration containing arrays of color pairs ([leadColor, color]). Configuração de cores de grupo contendo arrays com pares de cores ([leadColor, color]). Konfiguracja kolorów grup zawierająca tablice par kolorów ([kolorLidera, kolor]). Конфигурация цвета групп содержит массив цветовых пар ([лид. цвет, цвет]). + Configurazioni colori gruppi contenenti array di coppie di colori ([leadColor, color]). Hash of Group ID mapped to the Group color configuration index. Hashes de ID de grupos mapeados para o índice de configuração de cor de grupos. Hasz ID grup zmapowanych w indeksie konfiguracji koloru grup. Хеш ID групп, соответствующих индексам конфигурации цвета групп. + Hash degli ID Gruppi mappati nell'indice configurazioni colori gruppi. GroupID Color configuration mapping Mapeamento de configuração para cores de GroupID Mapowanie kolorów poprzez GroupID Соответствие ID групп конфигурации цвета групп + Mappatura configurazioni colori GroupID Enables the Map Gestures. Ativa os gestos no mapa Aktywuje gesty na mapie. Включает указания на карте. + Povolit ukazování v mapě + Abilita i Gesti Mappa Name Text Color Cor do texto do nome Kolor nazw Цвет текста имени + Barva textu pro jména + Colore Testo Nome Color of the name tag text besides the map gestures mark. Cor do texto da etiqueta de nome que fica embaixo da marcação de gestos no mapa. Kolor nazwy gracza obok markera gestu mapy. Цвет инмени игрока рядом с маркером жестов. + Colore del testo dei nametag oltre a quello dei Gesti Mappa Map Gestures Gestos no mapa Gesty na mapie Жесты на карте + Ukazovní v mapě + Gesti Mappa - + \ No newline at end of file diff --git a/addons/maptools/CfgEventHandlers.hpp b/addons/maptools/CfgEventHandlers.hpp index 27bbf326d3..5c876708f2 100644 --- a/addons/maptools/CfgEventHandlers.hpp +++ b/addons/maptools/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/maptools/XEH_PREP.hpp b/addons/maptools/XEH_PREP.hpp new file mode 100644 index 0000000000..cff37aa65d --- /dev/null +++ b/addons/maptools/XEH_PREP.hpp @@ -0,0 +1,20 @@ + +PREP(addLineMarker); +PREP(calculateMapScale); +PREP(cancelDrawing); +PREP(canDraw); +PREP(canUseMapTools); +PREP(canUseMapGPS); +PREP(copyMapReceiveMarkers); +PREP(copyMapRemoteSend); +PREP(copyMapStart); +PREP(handleKeyDown); +PREP(handleMouseButton); +PREP(handleMouseMove); +PREP(handleMouseZChanged); +PREP(isInsideMapTool); +PREP(openMapGps); +PREP(openMapGpsUpdate); +PREP(removeLineMarker); +PREP(updateMapToolMarkers); +PREP(updateLineMarker); diff --git a/addons/maptools/XEH_preInit.sqf b/addons/maptools/XEH_preInit.sqf index 2bcd68385a..3022d53753 100644 --- a/addons/maptools/XEH_preInit.sqf +++ b/addons/maptools/XEH_preInit.sqf @@ -2,25 +2,7 @@ ADDON = false; -PREP(addLineMarker); -PREP(calculateMapScale); -PREP(cancelDrawing); -PREP(canDraw); -PREP(canUseMapTools); -PREP(canUseMapGPS); -PREP(copyMapReceiveMarkers); -PREP(copyMapRemoteSend); -PREP(copyMapStart); -PREP(handleKeyDown); -PREP(handleMouseButton); -PREP(handleMouseMove); -PREP(handleMouseZChanged); -PREP(isInsideMapTool); -PREP(openMapGps); -PREP(openMapGpsUpdate); -PREP(removeLineMarker); -PREP(updateMapToolMarkers); -PREP(updateLineMarker); +#include "XEH_PREP.hpp" if (isServer) then { GVAR(drawing_serverLineMarkers) = []; diff --git a/addons/maptools/XEH_preStart.sqf b/addons/maptools/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/maptools/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/maptools/script_component.hpp b/addons/maptools/script_component.hpp index 5d5c524419..497ee14dc1 100644 --- a/addons/maptools/script_component.hpp +++ b/addons/maptools/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT maptools #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MAPTOOLS #define DEBUG_MODE_FULL #endif diff --git a/addons/maptools/stringtable.xml b/addons/maptools/stringtable.xml index 07b2e5dc88..cde1096170 100644 --- a/addons/maptools/stringtable.xml +++ b/addons/maptools/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -46,7 +46,7 @@ Ocultar Ferramenta de Mapa Térképészeti eszközök elrejtése Ukryj narzędzia nawigacyjne - Schovat pomůcku k mapě + Schovat pomůcky k mapě Скрыть инструменты @@ -58,7 +58,7 @@ Mostrar Ferramenta de Mapa Padrão Térképészeti eszköz megjelenítése (normál méret) Pokaż normalne narzędzia nawigacyjne - Zobrazit normální pomůcku k mapě + Zobrazit pomůcku k mapě (Velkou) Показать инструменты (средн. размер) @@ -70,7 +70,7 @@ Mostrar Ferramenta de Mapa Pequena Térképészeti eszköz megjelenítése (kicsinyített) Pokaż pomniejszone narzędzia nawigacyjne - Zobrazit malou pomůcku k mapě + Zobrazit pomůcku k mapě (Malou) Показать инструменты (малый размер) @@ -101,7 +101,7 @@ Show GPS on Map Zeige GPS auf der Karte Mostrar el GPS sobre el mapa - Ranger le GPS + Montrer le GPS Visualizza il GPS sulla mappa Mostrar GPS no Mapa GPS megjelenítése a térképen @@ -113,7 +113,7 @@ Hide GPS on Map Verstecke GPS auf der Karte Ocultar el GPS del mapa - Montrer le GPS + Ranger le GPS Nascondi il GPS sulla mappa Ocultar GPS no Mapa GPS elrejtése a térképről @@ -146,4 +146,4 @@ Direção: %1 - + \ No newline at end of file diff --git a/addons/markers/CfgEventHandlers.hpp b/addons/markers/CfgEventHandlers.hpp index 0cd959a047..becf395052 100644 --- a/addons/markers/CfgEventHandlers.hpp +++ b/addons/markers/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/markers/XEH_PREP.hpp b/addons/markers/XEH_PREP.hpp new file mode 100644 index 0000000000..67344454ec --- /dev/null +++ b/addons/markers/XEH_PREP.hpp @@ -0,0 +1,12 @@ + +PREP(getEnabledChannels); +PREP(initInsertMarker); +PREP(mapDrawEH); +PREP(onLBSelChangedChannel); +PREP(onLBSelChangedColor); +PREP(onLBSelChangedShape); +PREP(onSliderPosChangedAngle); +PREP(placeMarker); +PREP(sendMarkersJIP); +PREP(setMarkerJIP); +PREP(setMarkerNetwork); diff --git a/addons/markers/XEH_preInit.sqf b/addons/markers/XEH_preInit.sqf index 477632d225..5308117754 100644 --- a/addons/markers/XEH_preInit.sqf +++ b/addons/markers/XEH_preInit.sqf @@ -2,17 +2,7 @@ ADDON = false; -PREP(getEnabledChannels); -PREP(initInsertMarker); -PREP(mapDrawEH); -PREP(onLBSelChangedChannel); -PREP(onLBSelChangedColor); -PREP(onLBSelChangedShape); -PREP(onSliderPosChangedAngle); -PREP(placeMarker); -PREP(sendMarkersJIP); -PREP(setMarkerJIP); -PREP(setMarkerNetwork); +#include "XEH_PREP.hpp" // init marker types if (isNil QGVAR(MarkersCache)) then { diff --git a/addons/markers/XEH_preStart.sqf b/addons/markers/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/markers/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/markers/script_component.hpp b/addons/markers/script_component.hpp index 80ffa23b5b..1da213875a 100644 --- a/addons/markers/script_component.hpp +++ b/addons/markers/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT markers #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MARKERS #define DEBUG_MODE_FULL #endif diff --git a/addons/markers/stringtable.xml b/addons/markers/stringtable.xml index 44d64eb1e0..9d015b0403 100644 --- a/addons/markers/stringtable.xml +++ b/addons/markers/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/medical/ACE_Medical_Actions.hpp b/addons/medical/ACE_Medical_Actions.hpp index 48cf6c87dc..5934203333 100644 --- a/addons/medical/ACE_Medical_Actions.hpp +++ b/addons/medical/ACE_Medical_Actions.hpp @@ -250,6 +250,13 @@ class ACE_ArmLeft { EXCEPTIONS icon = PATHTOF(UI\icons\autoInjector.paa); }; + class Adenosine: Morphine { + displayName = CSTRING(Inject_Adenosine); + condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Adenosine')] call DFUNC(canTreatCached)); + statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Adenosine')] call DFUNC(treatment)); + EXCEPTIONS + icon = PATHTOF(UI\icons\autoInjector.paa); + }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Atropine')] call DFUNC(canTreatCached)); @@ -404,6 +411,14 @@ class ACE_ArmRight { EXCEPTIONS icon = PATHTOF(UI\icons\autoInjector.paa); }; + + class Adenosine: Morphine { + displayName = CSTRING(Inject_Adenosine); + condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Adenosine')] call DFUNC(canTreatCached)); + statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Adenosine')] call DFUNC(treatment)); + EXCEPTIONS + icon = PATHTOF(UI\icons\autoInjector.paa); + }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Atropine')] call DFUNC(canTreatCached)); @@ -558,6 +573,13 @@ class ACE_LegLeft { EXCEPTIONS icon = PATHTOF(UI\icons\autoInjector.paa); }; + class Adenosine: Morphine { + displayName = CSTRING(Inject_Atropine); + condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Adenosine')] call DFUNC(canTreatCached)); + statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Adenosine')] call DFUNC(treatment)); + EXCEPTIONS + icon = PATHTOF(UI\icons\autoInjector.paa); + }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Atropine')] call DFUNC(canTreatCached)); @@ -699,6 +721,13 @@ class ACE_LegRight { EXCEPTIONS icon = PATHTOF(UI\icons\autoInjector.paa); }; + class Adenosine: Morphine { + displayName = CSTRING(Inject_Atropine); + condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Adenosine')] call DFUNC(canTreatCached)); + statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Adenosine')] call DFUNC(treatment)); + EXCEPTIONS + icon = PATHTOF(UI\icons\autoInjector.paa); + }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Atropine')] call DFUNC(canTreatCached)); diff --git a/addons/medical/ACE_Medical_SelfActions.hpp b/addons/medical/ACE_Medical_SelfActions.hpp index 4217e43e91..54a8ba60f5 100644 --- a/addons/medical/ACE_Medical_SelfActions.hpp +++ b/addons/medical/ACE_Medical_SelfActions.hpp @@ -204,6 +204,13 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Morphine')] call DFUNC(treatment)); icon = PATHTOF(UI\icons\autoInjector.paa); }; + class Adenosine: Morphine { + displayName = CSTRING(Inject_Atropine); + condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Adenosine')] call DFUNC(canTreatCached)); + exceptions[] = {"isNotInside"}; + statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Adenosine')] call DFUNC(treatment)); + icon = PATHTOF(UI\icons\autoInjector.paa); + }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Atropine')] call DFUNC(canTreatCached)); @@ -302,6 +309,13 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Morphine')] call DFUNC(treatment)); icon = PATHTOF(UI\icons\autoInjector.paa); }; + class Adenosine: Morphine { + displayName = CSTRING(Inject_Atropine); + condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Adenosine')] call DFUNC(canTreatCached)); + exceptions[] = {"isNotInside"}; + statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Adenosine')] call DFUNC(treatment)); + icon = PATHTOF(UI\icons\autoInjector.paa); + }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Atropine')] call DFUNC(canTreatCached)); @@ -399,6 +413,13 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Morphine')] call DFUNC(treatment)); icon = PATHTOF(UI\icons\autoInjector.paa); }; + class Adenosine: Morphine { + displayName = CSTRING(Inject_Atropine); + condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Adenosine')] call DFUNC(canTreatCached)); + exceptions[] = {"isNotInside"}; + statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Adenosine')] call DFUNC(treatment)); + icon = PATHTOF(UI\icons\autoInjector.paa); + }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Atropine')] call DFUNC(canTreatCached)); @@ -484,6 +505,13 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Morphine')] call DFUNC(treatment)); icon = PATHTOF(UI\icons\autoInjector.paa); }; + class Adenosine: Morphine { + displayName = CSTRING(Inject_Atropine); + condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Adenosine')] call DFUNC(canTreatCached)); + exceptions[] = {"isNotInside"}; + statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Adenosine')] call DFUNC(treatment)); + icon = PATHTOF(UI\icons\autoInjector.paa); + }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Atropine')] call DFUNC(canTreatCached)); diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 51fb4ca701..47d78d23e1 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -50,12 +50,13 @@ class ACE_Medical_Actions { allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; allowSelfTreatment = 1; category = "medication"; - requiredMedic = 1; + requiredMedic = QGVAR(medicSetting_basicEpi); treatmentTime = 3; items[] = {"ACE_epinephrine"}; callbackSuccess = QUOTE(DFUNC(treatmentBasic_epipen)); animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} }; + treatmentLocations[] = {QGVAR(useLocation_basicEpi)}; }; class BloodIV: Bandage { displayName = CSTRING(Transfuse_Blood); @@ -214,6 +215,12 @@ class ACE_Medical_Actions { animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} }; }; + class Adenosine: Morphine { + displayName = CSTRING(Inject_Adenosine); + displayNameProgress = CSTRING(Injecting_Adenosine); + items[] = {"ACE_adenosine"}; + litter[] = { {"All", "", {"ACE_MedicalLitter_adenosine"}} }; + }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); displayNameProgress = CSTRING(Injecting_Atropine); @@ -651,12 +658,12 @@ class ACE_Medical_Advanced { selectionSpecific = 0; }; class vehiclecrash { - thresholds[] = {{0.25, 5}}; + thresholds[] = {{0.25, 5}, {0.05, 1}}; selectionSpecific = 0; lethalDamage = 0.2; }; class backblast { - thresholds[] = {{0, 2},{0.55, 5}, {1, 6}}; + thresholds[] = {{1, 6}, {0.55, 5}, {0, 2}}; selectionSpecific = 0; lethalDamage = 1; }; @@ -692,23 +699,56 @@ class ACE_Medical_Advanced { reopeningMinDelay = 120; reopeningMaxDelay = 200; class Abrasion { - effectiveness = 1; + effectiveness = 3; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; - class AbrasionMinor: Abrasion {}; - class AbrasionMedium: Abrasion {}; - class AbrasionLarge: Abrasion {}; - class Avulsions: Abrasion { - effectiveness = 0.3; - reopeningChance = 0.5; - reopeningMinDelay = 120; - reopeningMaxDelay = 200; + class AbrasionMinor: Abrasion { + effectiveness = 5; + reopeningChance = 0; + reopeningMinDelay = 1000; + reopeningMaxDelay = 5000; }; - class AvulsionsMinor: Avulsions {}; - class AvulsionsMedium: Avulsions {}; - class AvulsionsLarge: Avulsions {}; + class AbrasionMedium: Abrasion { + effectiveness = 3; + reopeningChance = 0.7; + reopeningMinDelay = 750; + reopeningMaxDelay = 3000; + }; + class AbrasionLarge: Abrasion { + effectiveness = 2; + reopeningChance = 0.9; + reopeningMinDelay = 300; + reopeningMaxDelay = 1000; + }; + + + class Avulsions: Abrasion { + effectiveness = 0.2; + reopeningChance = 0.8; + reopeningMinDelay = 5; + reopeningMaxDelay = 20; + }; + class AvulsionsMinor: Avulsions { + effectiveness = 0.4; + reopeningChance = 0.75; + reopeningMinDelay = 5; + reopeningMaxDelay = 20; + }; + class AvulsionsMedium: Avulsions { + effectiveness = 0.3; + reopeningChance = 0.85; + reopeningMinDelay = 5; + reopeningMaxDelay = 10; + }; + class AvulsionsLarge: Avulsions { + effectiveness = 0.1; + reopeningChance = 0.9; + reopeningMinDelay = 2; + reopeningMaxDelay = 10; + }; + class Contusion: Abrasion { effectiveness = 1; reopeningChance = 0; @@ -718,73 +758,183 @@ class ACE_Medical_Advanced { class ContusionMinor: Contusion {}; class ContusionMedium: Contusion {}; class ContusionLarge: Contusion {}; + class CrushWound: Abrasion { - effectiveness = 0.6; - reopeningChance = 0.2; + effectiveness = 1; + reopeningChance = 0.4; reopeningMinDelay = 120; reopeningMaxDelay = 200; }; - class CrushWoundMinor: CrushWound {}; - class CrushWoundMedium: CrushWound {}; - class CrushWoundLarge: CrushWound {}; - class Cut: Abrasion { + class CrushWoundMinor: CrushWound { + effectiveness = 1; + reopeningChance = 0.4; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + }; + class CrushWoundMedium: CrushWound { effectiveness = 0.4; - reopeningChance = 0.5; + reopeningChance = 0.3; + reopeningMinDelay = 100; + reopeningMaxDelay = 150; + }; + class CrushWoundLarge: CrushWound { + effectiveness = 0.2; + reopeningChance = 0.2; + reopeningMinDelay = 50; + reopeningMaxDelay = 70; + }; + + class Cut: Abrasion { + effectiveness = 3; + reopeningChance = 0.3; + reopeningMinDelay = 2000; + reopeningMaxDelay = 5000; + }; + class CutMinor: Cut { + effectiveness = 6; + reopeningChance = 0.1; + reopeningMinDelay = 5000; + reopeningMaxDelay = 8000; + }; + class CutMedium: Cut { + effectiveness = 3; + reopeningChance = 0.3; + reopeningMinDelay = 1200; + reopeningMaxDelay = 2000; + }; + class CutLarge: Cut { + effectiveness = 1; + reopeningChance = 0.6; reopeningMinDelay = 220; reopeningMaxDelay = 260; }; - class CutMinor: Cut {}; - class CutMedium: Cut {}; - class CutLarge: Cut {}; class Laceration: Abrasion { - effectiveness = 0.7; + effectiveness = 0.8; reopeningChance = 0.3; + reopeningMinDelay = 220; + reopeningMaxDelay = 500; + }; + class LacerationMinor: Laceration { + effectiveness = 0.8; + reopeningChance = 0.3; + reopeningMinDelay = 400; + reopeningMaxDelay = 800; + }; + class LacerationMedium: Laceration { + effectiveness = 0.5; + reopeningChance = 0.5; + reopeningMinDelay = 220; + reopeningMaxDelay = 500; + }; + class LacerationLarge: Laceration { + effectiveness = 0.3; + reopeningChance = 0.7; reopeningMinDelay = 120; reopeningMaxDelay = 260; }; - class LacerationMinor: Laceration {}; - class LacerationMedium: Laceration {}; - class LacerationLarge: Laceration {}; class velocityWound: Abrasion { + effectiveness = 0.5; + reopeningChance = 0.7; + reopeningMinDelay = 100; + reopeningMaxDelay = 300; + }; + class velocityWoundMinor: velocityWound { + effectiveness = 0.8; + reopeningChance = 0.4; + reopeningMinDelay = 300; + reopeningMaxDelay = 550; + }; + class velocityWoundMedium: velocityWound { + effectiveness = 0.6; + reopeningChance = 0.8; + reopeningMinDelay = 100; + reopeningMaxDelay = 300; + }; + class velocityWoundLarge: velocityWound { + effectiveness = 0.3; + reopeningChance = 0.9; + reopeningMinDelay = 50; + reopeningMaxDelay = 170; + }; + + class punctureWound: Abrasion { + effectiveness = 0.6; + reopeningChance = 0.3; + reopeningMinDelay = 200; + reopeningMaxDelay = 300; + }; + class punctureWoundMinor: punctureWound { + effectiveness = 0.8; + reopeningChance = 0.5; + reopeningMinDelay = 500; + reopeningMaxDelay = 800; + }; + class punctureWoundMedium: punctureWound { + effectiveness = 0.6; + reopeningChance = 0.3; + reopeningMinDelay = 400; + reopeningMaxDelay = 600; + }; + class punctureWoundLarge: punctureWound { effectiveness = 0.3; reopeningChance = 0.8; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; - class velocityWoundMinor: velocityWound {}; - class velocityWoundMedium: velocityWound {}; - class velocityWoundLarge: velocityWound {}; - class punctureWound: Abrasion { - effectiveness = 0.5; - reopeningChance = 0.8; - reopeningMinDelay = 20; - reopeningMaxDelay = 300; - }; - class punctureWoundMinor: punctureWound {}; - class punctureWoundMedium: punctureWound {}; - class punctureWoundLarge: punctureWound {}; }; class PackingBandage: fieldDressing { class Abrasion { - effectiveness = 1; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; + effectiveness = 0.1; + reopeningChance = 0.9; + reopeningMinDelay = 5; + reopeningMaxDelay = 10; }; - class AbrasionMinor: Abrasion {}; - class AbrasionMedium: Abrasion {}; - class AbrasionLarge: Abrasion {}; + class AbrasionMinor: Abrasion { + effectiveness = 0.1; + reopeningChance = 0.9; + reopeningMinDelay = 5; + reopeningMaxDelay = 10; + }; + class AbrasionMedium: Abrasion { + effectiveness = 0.1; + reopeningChance = 0.9; + reopeningMinDelay = 5; + reopeningMaxDelay = 10; + }; + class AbrasionLarge: Abrasion { + effectiveness = 1; + reopeningChance = 0.9; + reopeningMinDelay = 5; + reopeningMaxDelay = 10; + }; + class Avulsions: Abrasion { effectiveness = 1; reopeningChance = 0.3; reopeningMinDelay = 120; reopeningMaxDelay = 200; }; - class AvulsionsMinor: Avulsions {}; - class AvulsionsMedium: Avulsions {}; - class AvulsionsLarge: Avulsions {}; + class AvulsionsMinor: Avulsions { + effectiveness = 1; + reopeningChance = 0.2; + reopeningMinDelay = 500; + reopeningMaxDelay = 1000; + }; + class AvulsionsMedium: Avulsions { + effectiveness = 0.7; + reopeningChance = 0.4; + reopeningMinDelay = 250; + reopeningMaxDelay = 750; + }; + class AvulsionsLarge: Avulsions { + effectiveness = 0.5; + reopeningChance = 0.5; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + }; + class Contusion: Abrasion { effectiveness = 1; reopeningChance = 0; @@ -793,72 +943,168 @@ class ACE_Medical_Advanced { }; class ContusionMinor: Contusion {}; class ContusionMedium: Contusion {}; - class ContusionLarge: Contusion {}; + class ContusionLarge: Contusion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class CrushWound: Abrasion { effectiveness = 0.6; reopeningChance = 0.2; reopeningMinDelay = 120; reopeningMaxDelay = 200; }; - class CrushWoundMinor: CrushWound {}; - class CrushWoundMedium: CrushWound {}; - class CrushWoundLarge: CrushWound {}; + class CrushWoundMinor: CrushWound { + effectiveness = 0.8; + reopeningChance = 0.4; + reopeningMinDelay = 500; + reopeningMaxDelay = 1000; + }; + class CrushWoundMedium: CrushWound { + effectiveness = 0.6; + reopeningChance = 0.6; + reopeningMinDelay = 280; + reopeningMaxDelay = 320; + }; + class CrushWoundLarge: CrushWound { + effectiveness = 0.4; + reopeningChance = 0.8; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + }; + class Cut: Abrasion { effectiveness = 0.2; - reopeningChance = 0.6; - reopeningMinDelay = 30; - reopeningMaxDelay = 260; + reopeningChance = 0.4; + reopeningMinDelay = 10000; + reopeningMaxDelay = 20000; }; - class CutMinor: Cut {}; - class CutMedium: Cut {}; - class CutLarge: Cut {}; + class CutMinor: Cut { + effectiveness = 1; + reopeningChance = 0.1; + reopeningMinDelay = 20000; + reopeningMaxDelay = 30000; + }; + class CutMedium: Cut { + effectiveness = 0.5; + reopeningChance = 0.4; + reopeningMinDelay = 2000; + reopeningMaxDelay = 3000; + }; + class CutLarge: Cut { + effectiveness = 0.7; + reopeningChance = 0.6; + reopeningMinDelay = 300; + reopeningMaxDelay = 2060; + }; + class Laceration: Abrasion { - effectiveness = 0.3; - reopeningChance = 0.3; + effectiveness = 0.5; + reopeningChance = 0.5; reopeningMinDelay = 120; reopeningMaxDelay = 260; }; - class LacerationMinor: Laceration {}; - class LacerationMedium: Laceration {}; - class LacerationLarge: Laceration {}; + class LacerationMinor: Laceration { + effectiveness = 1; + reopeningChance = 0.1; + reopeningMinDelay = 500; + reopeningMaxDelay = 700; + }; + class LacerationMedium: Laceration { + effectiveness = 0.7; + reopeningChance = 0.3; + reopeningMinDelay = 300; + reopeningMaxDelay = 600; + }; + class LacerationLarge: Laceration { + effectiveness = 0.3; + reopeningChance = 0.5; + reopeningMinDelay = 220; + reopeningMaxDelay = 360; + }; class velocityWound: Abrasion { effectiveness = 1; reopeningChance = 0.5; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; - class velocityWoundMinor: velocityWound {}; - class velocityWoundMedium: velocityWound {}; - class velocityWoundLarge: velocityWound {}; - class punctureWound: Abrasion { + class velocityWoundMinor: velocityWound { + effectiveness = 1; + reopeningChance = 0.7; + reopeningMinDelay = 800; + reopeningMaxDelay = 1000; + }; + class velocityWoundMedium: velocityWound { + effectiveness = 0.6; + reopeningChance = 0.6; + reopeningMinDelay = 500; + reopeningMaxDelay = 800; + }; + class velocityWoundLarge: velocityWound { effectiveness = 0.3; reopeningChance = 0.5; + reopeningMinDelay = 300; + reopeningMaxDelay = 500; + }; + class punctureWound: Abrasion { + effectiveness = 0.1; + reopeningChance = 0.5; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; class punctureWoundMinor: punctureWound {}; - class punctureWoundMedium: punctureWound {}; - class punctureWoundLarge: punctureWound {}; + class punctureWoundMedium: punctureWound { + effectiveness = 0.2; + reopeningChance = 0.5; + }; + class punctureWoundLarge: punctureWound { + effectiveness = 0.3; + reopeningChance = 0.5; + reopeningMinDelay = 20; + reopeningMaxDelay = 300; + }; }; + class ElasticBandage: fieldDressing { class Abrasion { - effectiveness = 1; + effectiveness = 2; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; class AbrasionMinor: Abrasion {}; - class AbrasionMedium: Abrasion {}; - class AbrasionLarge: Abrasion {}; + class AbrasionMedium: Abrasion { + effectiveness = 1.5; + }; + class AbrasionLarge: Abrasion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + }; + class Avulsions: Abrasion { effectiveness = 0.3; reopeningChance = 0.4; reopeningMinDelay = 120; reopeningMaxDelay = 200; }; - class AvulsionsMinor: Avulsions {}; - class AvulsionsMedium: Avulsions {}; - class AvulsionsLarge: Avulsions {}; + class AvulsionsMinor: Avulsions { + effectiveness = 0.9; + reopeningChance = 0.2; + }; + class AvulsionsMedium: Avulsions { + effectiveness = 0.7; + reopeningChance = 0.4; + }; + class AvulsionsLarge: Avulsions { + effectiveness = 0.3; + reopeningChance = 0.4; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + }; + class Contusion: Abrasion { effectiveness = 1; reopeningChance = 0; @@ -868,6 +1114,7 @@ class ACE_Medical_Advanced { class ContusionMinor: Contusion {}; class ContusionMedium: Contusion {}; class ContusionLarge: Contusion {}; + class CrushWound: Abrasion { effectiveness = 1; reopeningChance = 0; @@ -876,16 +1123,31 @@ class ACE_Medical_Advanced { }; class CrushWoundMinor: CrushWound {}; class CrushWoundMedium: CrushWound {}; - class CrushWoundLarge: CrushWound {}; - class Cut: Abrasion { + class CrushWoundLarge: CrushWound { effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + + class Cut: Abrasion { + effectiveness = 1.5; reopeningChance = 0.2; reopeningMinDelay = 10; reopeningMaxDelay = 400; }; class CutMinor: Cut {}; - class CutMedium: Cut {}; - class CutLarge: Cut {}; + class CutMedium: Cut { + effectiveness = 1.2; + reopeningChance = 0.3; + }; + class CutLarge: Cut { + effectiveness = 1; + reopeningChance = 0.5; + reopeningMinDelay = 10; + reopeningMaxDelay = 400; + }; + class Laceration: Abrasion { effectiveness = 1; reopeningChance = 0.3; @@ -893,26 +1155,50 @@ class ACE_Medical_Advanced { reopeningMaxDelay = 260; }; class LacerationMinor: Laceration {}; - class LacerationMedium: Laceration {}; - class LacerationLarge: Laceration {}; - class velocityWound: Abrasion { + class LacerationMedium: Laceration { + effectiveness = 0.75; + }; + class LacerationLarge: Laceration { effectiveness = 0.5; + reopeningChance = 0.3; + reopeningMinDelay = 120; + reopeningMaxDelay = 260; + }; + + class velocityWound: Abrasion { + effectiveness = 0.7; reopeningChance = 0.5; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; class velocityWoundMinor: velocityWound {}; - class velocityWoundMedium: velocityWound {}; - class velocityWoundLarge: velocityWound {}; + class velocityWoundMedium: velocityWound { + effectiveness = 0.5; + }; + class velocityWoundLarge: velocityWound { + effectiveness = 0.25; + reopeningChance = 0.7; + reopeningMinDelay = 20; + reopeningMaxDelay = 300; + }; + class punctureWound: Abrasion { - effectiveness = 0.85; - reopeningChance = 0.5; + effectiveness = 0.9; + reopeningChance = 0.3; reopeningMinDelay = 20; reopeningMaxDelay = 300; }; class punctureWoundMinor: punctureWound {}; - class punctureWoundMedium: punctureWound {}; - class punctureWoundLarge: punctureWound {}; + class punctureWoundMedium: punctureWound { + effectiveness = 0.9; + reopeningChance = 0.5; + }; + class punctureWoundLarge: punctureWound { + effectiveness = 0.85; + reopeningChance = 0.7; + reopeningMinDelay = 20; + reopeningMaxDelay = 300; + }; }; class QuikClot: fieldDressing { class Abrasion { @@ -923,16 +1209,30 @@ class ACE_Medical_Advanced { }; class AbrasionMinor: Abrasion {}; class AbrasionMedium: Abrasion {}; - class AbrasionLarge: Abrasion {}; + class AbrasionLarge: Abrasion { + effectiveness = 0.7; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class Avulsions: Abrasion { - effectiveness = 0.2; + effectiveness = 0.6; reopeningChance = 0.1; reopeningMinDelay = 300; reopeningMaxDelay = 350; }; class AvulsionsMinor: Avulsions {}; - class AvulsionsMedium: Avulsions {}; - class AvulsionsLarge: Avulsions {}; + class AvulsionsMedium: Avulsions { + effectiveness = 0.4; + }; + class AvulsionsLarge: Avulsions { + effectiveness = 0.2; + reopeningChance = 0.1; + reopeningMinDelay = 300; + reopeningMaxDelay = 350; + }; + class Contusion: Abrasion { effectiveness = 0.7; reopeningChance = 0; @@ -941,25 +1241,49 @@ class ACE_Medical_Advanced { }; class ContusionMinor: Contusion {}; class ContusionMedium: Contusion {}; - class ContusionLarge: Contusion {}; - class CrushWound: Abrasion { + class ContusionLarge: Contusion { effectiveness = 0.7; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; + + class CrushWound: Abrasion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; class CrushWoundMinor: CrushWound {}; - class CrushWoundMedium: CrushWound {}; - class CrushWoundLarge: CrushWound {}; + class CrushWoundMedium: CrushWound { + effectiveness = 0.9; + reopeningChance = 0.05; + }; + class CrushWoundLarge: CrushWound { + effectiveness = 0.7; + reopeningChance = 0.1; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class Cut: Abrasion { effectiveness = 0.7; - reopeningChance = 0.2; + reopeningChance = 0; reopeningMinDelay = 100; reopeningMaxDelay = 400; }; class CutMinor: Cut {}; - class CutMedium: Cut {}; - class CutLarge: Cut {}; + class CutMedium: Cut { + effectiveness = 0.6; + reopeningChance = 0; + }; + class CutLarge: Cut { + effectiveness = 0.5; + reopeningChance = 0.2; + reopeningMinDelay = 100; + reopeningMaxDelay = 400; + }; + class Laceration: Abrasion { effectiveness = 0.7; reopeningChance = 0; @@ -967,26 +1291,50 @@ class ACE_Medical_Advanced { reopeningMaxDelay = 0; }; class LacerationMinor: Laceration {}; - class LacerationMedium: Laceration {}; - class LacerationLarge: Laceration {}; + class LacerationMedium: Laceration { + effectiveness = 0.6; + }; + class LacerationLarge: Laceration { + effectiveness = 0.5; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class velocityWound: Abrasion { effectiveness = 0.7; - reopeningChance = 0.1; + reopeningChance = 0; reopeningMinDelay = 200; reopeningMaxDelay = 300; }; class velocityWoundMinor: velocityWound {}; - class velocityWoundMedium: velocityWound {}; - class velocityWoundLarge: velocityWound {}; - class punctureWound: Abrasion { + class velocityWoundMedium: velocityWound { + effectiveness = 0.6; + }; + class velocityWoundLarge: velocityWound { effectiveness = 0.5; reopeningChance = 0.1; reopeningMinDelay = 200; reopeningMaxDelay = 300; }; + + class punctureWound: Abrasion { + effectiveness = 0.5; + reopeningChance = 0.05; + reopeningMinDelay = 200; + reopeningMaxDelay = 300; + }; class punctureWoundMinor: punctureWound {}; - class punctureWoundMedium: punctureWound {}; - class punctureWoundLarge: punctureWound {}; + class punctureWoundMedium: punctureWound { + effectiveness = 0.4; + reopeningChance = 0.1; + }; + class punctureWoundLarge: punctureWound { + effectiveness = 0.3; + reopeningChance = 0.15; + reopeningMinDelay = 200; + reopeningMaxDelay = 300; + }; }; }; @@ -1022,18 +1370,27 @@ class ACE_Medical_Advanced { }; class Epinephrine { painReduce = 0; - hrIncreaseLow[] = {10, 20, 30}; - hrIncreaseNormal[] = {10, 50, 20}; - hrIncreaseHigh[] = {10, 40, 10}; + hrIncreaseLow[] = {10, 20, 15}; + hrIncreaseNormal[] = {10, 50, 10}; + hrIncreaseHigh[] = {10, 40, 5}; timeInSystem = 120; maxDose = 10; inCompatableMedication[] = {}; }; + class Adenosine { + painReduce = 0; + hrIncreaseLow[] = {-7, -10, 15}; + hrIncreaseNormal[] = {-15, -30, 20}; + hrIncreaseHigh[] = {-15, -35, 10}; + timeInSystem = 120; + maxDose = 6; + inCompatableMedication[] = {}; + }; class Atropine { painReduce = 0; - hrIncreaseLow[] = {-5, -7, 15}; - hrIncreaseNormal[] = {-10, -30, 20}; - hrIncreaseHigh[] = {-10, -20, 10}; + hrIncreaseLow[] = {-2, -5, 15}; + hrIncreaseNormal[] = {-10, -15, 20}; + hrIncreaseHigh[] = {-5, -20, 10}; timeInSystem = 120; maxDose = 6; inCompatableMedication[] = {}; diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 890ac99fb6..130eb059ac 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -11,6 +11,13 @@ class ACE_Settings { typeName = "SCALAR"; values[] = {"Disabled", "Normal", "Advanced"}; }; + class GVAR(increaseTrainingInLocations) { + category = CSTRING(Category_Medical); + displayName = CSTRING(MedicalSettings_increaseTrainingInLocations_DisplayName); + description = CSTRING(MedicalSettings_increaseTrainingInLocations_Description); + value = 0; + typeName = "BOOL"; + }; class GVAR(enableFor) { category = CSTRING(Category_Medical); value = 0; @@ -126,6 +133,12 @@ class ACE_Settings { typeName = "SCALAR"; value = 0; }; + class GVAR(medicSetting_basicEpi) { + category = CSTRING(Category_Medical); + typeName = "SCALAR"; + value = 1; + values[] = {"Anyone", "Medics only", "Doctors only"}; + }; class GVAR(medicSetting_PAK) { category = CSTRING(Category_Medical); typeName = "SCALAR"; @@ -150,6 +163,12 @@ class ACE_Settings { value = 0; values[] = {"No", "Yes"}; }; + class GVAR(useLocation_basicEpi) { + category = CSTRING(Category_Medical); + typeName = "SCALAR"; + value = 0; + values[] = {CSTRING(AdvancedMedicalSettings_anywhere), CSTRING(AdvancedMedicalSettings_vehicle), CSTRING(AdvancedMedicalSettings_facility), CSTRING(AdvancedMedicalSettings_vehicleAndFacility), ECSTRING(common,Disabled)}; + }; class GVAR(useLocation_PAK) { category = CSTRING(Category_Medical); typeName = "SCALAR"; diff --git a/addons/medical/CfgEden.hpp b/addons/medical/CfgEden.hpp new file mode 100644 index 0000000000..8adc47e94d --- /dev/null +++ b/addons/medical/CfgEden.hpp @@ -0,0 +1,48 @@ +class Cfg3DEN { + class Object { + class AttributeCategories { + class ace_attributes { + class Attributes { + class ace_isMedic { + property = QUOTE(ace_isMedic); + value = 0; + control = "Combo"; + displayName = CSTRING(AssignMedicRoles_role_DisplayName); + tooltip = CSTRING(Attributes_isMedic_Description); + expression = QUOTE(_this setVariable [ARR_2(QUOTE(QGVAR(medicClass)),_value)];); + typeName = "NUMBER"; + condition = "objectBrain"; + defaultValue = 0; + class values { + class none {name = CSTRING(AssignMedicRoles_role_none); value = 0; default = 1;}; + class medic {name = CSTRING(AssignMedicRoles_role_medic); value = 1; default = 0;}; + class doctor {name = CSTRING(AssignMedicRoles_role_doctor); value = 2; default = 0;}; + }; + }; + class ace_isMedicalVehicle { + property = QUOTE(ace_isMedicalVehicle); + value = 0; + control = "CheckboxNumber"; + displayName = CSTRING(AssignMedicVehicle_enabled_DisplayName); + tooltip = CSTRING(Attributes_isMedicalVehicle_Description); + expression = QUOTE(_this setVariable [ARR_2(QUOTE(QGVAR(medicClass)),_value)];); + typeName = "NUMBER"; + condition = "objectVehicle"; + defaultValue = 0; + }; + class ace_isMedicalFacility { + property = QUOTE(ace_isMedicalFacility); + value = 0; + control = "Checkbox"; + displayName = CSTRING(AssignMedicalFacility_enabled_DisplayName); + tooltip = CSTRING(AssignMedicalFacility_enabled_Description); + expression = QUOTE(_this setVariable [ARR_2(QUOTE(QGVAR(isMedicalFacility)),_value)];); + typeName = "BOOL"; + condition = "(1 - objectBrain) * (1 - objectVehicle)"; + defaultValue = "false"; + }; + }; + }; + }; + }; +}; diff --git a/addons/medical/CfgEventHandlers.hpp b/addons/medical/CfgEventHandlers.hpp index 2fe5d0a9e5..ab7c1868ab 100644 --- a/addons/medical/CfgEventHandlers.hpp +++ b/addons/medical/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 8746e1e0d9..e15434bef6 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -58,6 +58,12 @@ class CfgVehicles { }; }; }; + class increaseTrainingInLocations { + displayName = CSTRING(MedicalSettings_increaseTrainingInLocations_DisplayName); + description = CSTRING(MedicalSettings_increaseTrainingInLocations_Description); + typeName = "BOOL"; + defaultValue = 0; + }; class allowLitterCreation { displayName = CSTRING(MedicalSettings_allowLitterCreation_DisplayName); description = CSTRING(MedicalSettings_allowLitterCreation_Description); @@ -152,7 +158,48 @@ class CfgVehicles { sync[] = {}; }; }; + class ACE_moduleBasicMedicalSettings: ACE_Module { + scope = 2; + displayName = CSTRING(BasicMedicalSettings_Module_DisplayName); + icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); + category = "ACE_medical"; + function = QUOTE(FUNC(moduleBasicMedicalSettings)); + functionPriority = 10; + isGlobal = 2; + isSingular = 1; + isTriggerActivated = 0; + isDisposable = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class medicSetting_basicEpi { + displayName = CSTRING(BasicMedicalSettings_medicSetting_basicEpi_DisplayName); + description = CSTRING(BasicMedicalSettings_medicSetting_basicEpi_Description); + typeName = "NUMBER"; + class values { + class anyone { name = CSTRING(AdvancedMedicalSettings_anyone); value = 0; }; + class Medic { name = CSTRING(AdvancedMedicalSettings_Medic); value = 1; default = 1; }; + class Special { name = CSTRING(AdvancedMedicalSettings_Special); value = 2; }; + }; + }; + class useLocation_basicEpi { + displayName = CSTRING(BasicMedicalSettings_useLocation_basicEpi_DisplayName); + description = CSTRING(BasicMedicalSettings_useLocation_basicEpi_Description); + typeName = "NUMBER"; + class values { + class anywhere { name = CSTRING(AdvancedMedicalSettings_anywhere); value = 0; default = 1; }; + class vehicle { name = CSTRING(AdvancedMedicalSettings_vehicle); value = 1; }; + class facility { name = CSTRING(AdvancedMedicalSettings_facility); value = 2; }; + class vehicleAndFacility { name = CSTRING(AdvancedMedicalSettings_vehicleAndFacility); value = 3; }; + class disabled { name = ECSTRING(common,Disabled); value = 4;}; + }; + }; + }; + class ModuleDescription { + description = CSTRING(BasicMedicalSettings_Module_Description); + sync[] = {}; + }; + }; class ACE_moduleAdvancedMedicalSettings: ACE_Module { scope = 2; displayName = CSTRING(AdvancedMedicalSettings_Module_DisplayName); @@ -661,6 +708,9 @@ class CfgVehicles { class ACE_MedicalLitter_gloves: ACE_MedicalLitterBase { model = QUOTE(PATHTOF(data\littergeneric_gloves.p3d)); }; + class ACE_MedicalLitter_adenosine: ACE_MedicalLitterBase { + model = QUOTE(PATHTOF(data\littergeneric_adenosine.p3d)); + }; class ACE_MedicalLitter_atropine: ACE_MedicalLitterBase { model = QUOTE(PATHTOF(data\littergeneric_atropine.p3d)); }; @@ -724,6 +774,16 @@ class CfgVehicles { MACRO_ADDITEM(ACE_morphine,1); }; }; + class ACE_adenosineItem: Item_Base_F { + scope = 2; + scopeCurator = 2; + displayName = CSTRING(Adenosine_Display); + author = ECSTRING(common,ACETeam); + vehicleClass = "Items"; + class TransportItems { + MACRO_ADDITEM(ACE_adenosine,1); + }; + }; class ACE_atropineItem: Item_Base_F { scope = 2; scopeCurator = 2; @@ -842,6 +902,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_elasticBandage,25); MACRO_ADDITEM(ACE_tourniquet,15); MACRO_ADDITEM(ACE_morphine,15); + MACRO_ADDITEM(ACE_adenosine,15); MACRO_ADDITEM(ACE_atropine,15); MACRO_ADDITEM(ACE_epinephrine,15); MACRO_ADDITEM(ACE_plasmaIV,7); diff --git a/addons/medical/CfgWeapons.hpp b/addons/medical/CfgWeapons.hpp index 6de00eff22..4bd5452794 100644 --- a/addons/medical/CfgWeapons.hpp +++ b/addons/medical/CfgWeapons.hpp @@ -75,6 +75,17 @@ class CfgWeapons { mass = 1; }; }; + class ACE_adenosine: ACE_ItemCore { + scope = 2; + displayName = CSTRING(Adenosine_Display); + picture = QUOTE(PATHTOF(ui\items\adenosine_x_ca.paa)); + model = QUOTE(PATHTOF(data\adenosine.p3d)); + descriptionShort = CSTRING(adenosine_Desc_Short); + descriptionUse = CSTRING(adenosine_Desc_Use); + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; + }; class ACE_atropine: ACE_ItemCore { scope = 2; displayName = CSTRING(Atropine_Display); @@ -84,7 +95,6 @@ class CfgWeapons { descriptionUse = CSTRING(Atropine_Desc_Use); class ItemInfo: InventoryItem_Base_F { mass = 1; - }; }; class ACE_epinephrine: ACE_ItemCore { diff --git a/addons/medical/XEH_PREP.hpp b/addons/medical/XEH_PREP.hpp new file mode 100644 index 0000000000..4184f096f7 --- /dev/null +++ b/addons/medical/XEH_PREP.hpp @@ -0,0 +1,115 @@ + +PREP(actionCheckBloodPressure); +PREP(actionCheckBloodPressureLocal); +PREP(actionCheckPulse); +PREP(actionCheckPulseLocal); +PREP(actionCheckResponse); +PREP(actionDiagnose); +PREP(actionPlaceInBodyBag); +PREP(actionRemoveTourniquet); +PREP(actionLoadUnit); +PREP(actionUnloadUnit); +PREP(addDamageToUnit); +PREP(addHeartRateAdjustment); +PREP(addToInjuredCollection); +PREP(addToLog); +PREP(addToTriageCard); +PREP(addUnconsciousCondition); +PREP(addUnloadPatientActions); +PREP(adjustPainLevel); +PREP(canAccessMedicalEquipment); +PREP(canTreat); +PREP(canTreatCached); +PREP(determineIfFatal); +PREP(getBloodLoss); +PREP(getBloodPressure); +PREP(getBloodVolumeChange); +PREP(getCardiacOutput); +PREP(getTypeOfDamage); +PREP(getHeartRateChange); +PREP(getTriageStatus); +PREP(getUnconsciousCondition); +PREP(handleDamage); +PREP(handleDamage_advanced); +PREP(handleDamage_advancedSetDamage); +PREP(handleDamage_airway); +PREP(handleDamage_basic); +PREP(handleDamage_caching); +PREP(handleDamage_fractures); +PREP(handleDamage_internalInjuries); +PREP(handleDamage_wounds); +PREP(handleDamage_woundsOld); +PREP(handleUnitVitals); +PREP(handleKilled); +PREP(handleLocal); +PREP(handleBandageOpening); +PREP(hasItem); +PREP(hasItems); +PREP(hasMedicalEnabled); +PREP(hasTourniquetAppliedTo); +PREP(init); +PREP(isBeingCarried); +PREP(isBeingDragged); +PREP(isInMedicalFacility); +PREP(isInMedicalVehicle); +PREP(isMedic); +PREP(isMedicalVehicle); +PREP(isInStableCondition); +PREP(itemCheck); +PREP(modifyMedicalAction); +PREP(onMedicationUsage); +PREP(onWoundUpdateRequest); +PREP(onPropagateWound); +PREP(parseConfigForInjuries); +PREP(playInjuredSound); +PREP(selectionNameToNumber); +PREP(serverRemoveBody); +PREP(setCardiacArrest); +PREP(setDead); +PREP(setHitPointDamage); +PREP(setStructuralDamage); +PREP(setUnconscious); +PREP(translateSelections); +PREP(treatment); +PREP(treatment_failure); +PREP(treatment_success); +PREP(treatmentAdvanced_bandage); +PREP(treatmentAdvanced_bandageLocal); +PREP(treatmentAdvanced_CPR); +PREP(treatmentAdvanced_CPRLocal); +PREP(treatmentAdvanced_fullHeal); +PREP(treatmentAdvanced_fullHealLocal); +PREP(treatmentAdvanced_fullHealTreatmentTime); +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); +PREP(treatmentBasic_morphine); +PREP(treatmentBasic_morphineLocal); +PREP(treatmentIV); +PREP(treatmentIVLocal); +PREP(treatmentTourniquet); +PREP(treatmentTourniquetLocal); +PREP(useItem); +PREP(useItems); +PREP(displayPatientInformation); +PREP(displayTriageCard); +PREP(dropDownTriageCard); +PREP(moduleMedicalSettings); +PREP(moduleBasicMedicalSettings); +PREP(moduleAdvancedMedicalSettings); +PREP(moduleReviveSettings); +PREP(moduleAssignMedicRoles); +PREP(moduleAssignMedicalVehicle); +PREP(moduleAssignMedicalFacility); +PREP(copyDeadBody); +PREP(requestWoundSync); +PREP(unconsciousPFH); + +// Networked litter +PREP(createLitter); +PREP(handleCreateLitter); diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index d833e44740..5d29d22cec 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -10,6 +10,29 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; ["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call EFUNC(common,addEventHandler); ["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call EFUNC(common,addEventHandler); +//Treatment EventHandlers: +["actionCheckBloodPressureLocal", DFUNC(actionCheckBloodPressureLocal)] call EFUNC(common,addEventHandler); +["actionCheckPulseLocal", DFUNC(actionCheckPulseLocal)] call EFUNC(common,addEventHandler); +["addToInjuredCollection", DFUNC(addToInjuredCollection)] call EFUNC(common,addEventHandler); +["addToMedicalLog", DFUNC(addToLog)] call EFUNC(common,addEventHandler); +["addToTriageCard", DFUNC(addToTriageCard)] call EFUNC(common,addEventHandler); +["setDead", DFUNC(setDead)] call EFUNC(common,addEventHandler); +["setHitPointDamage", DFUNC(setHitPointDamage)] call EFUNC(common,addEventHandler); +["setUnconscious", DFUNC(setUnconscious)] call EFUNC(common,addEventHandler); +["treatmentAdvanced_bandageLocal", DFUNC(treatmentAdvanced_bandageLocal)] call EFUNC(common,addEventHandler); +["treatmentAdvanced_CPRLocal", DFUNC(treatmentAdvanced_CPRLocal)] call EFUNC(common,addEventHandler); +["treatmentAdvanced_fullHealLocal", DFUNC(treatmentAdvanced_fullHealLocal)] call EFUNC(common,addEventHandler); +["treatmentAdvanced_medicationLocal", DFUNC(treatmentAdvanced_medicationLocal)] call EFUNC(common,addEventHandler); +["treatmentBasic_bandageLocal", DFUNC(treatmentBasic_bandageLocal)] call EFUNC(common,addEventHandler); +["treatmentBasic_bloodbagLocal", DFUNC(treatmentBasic_bloodbagLocal)] call EFUNC(common,addEventHandler); +["treatmentBasic_morphineLocal", DFUNC(treatmentBasic_morphineLocal)] call EFUNC(common,addEventHandler); +["treatmentIVLocal", DFUNC(treatmentIVLocal)] call EFUNC(common,addEventHandler); +["treatmentTourniquetLocal", DFUNC(treatmentTourniquetLocal)] call EFUNC(common,addEventHandler); +["actionPlaceInBodyBag", FUNC(actionPlaceInBodyBag)] call EFUNC(common,addEventHandler); + +//Handle Deleting Bodies on Server: +if (isServer) then {["placedInBodyBag", FUNC(serverRemoveBody)] call EFUNC(common,addEventHandler);}; + ["medical_onUnconscious", { params ["_unit", "_status"]; if (local _unit) then { @@ -246,6 +269,9 @@ GVAR(lastHeartBeatSound) = ACE_time; }; ["SettingsInitialized", { + // Networked litter (need to wait for GVAR(litterCleanUpDelay) to be set) + [QGVAR(createLitter), FUNC(handleCreateLitter), GVAR(litterCleanUpDelay)] call EFUNC(common,addSyncedEventHandler); + if (GVAR(level) == 2) exitWith { [ {(((_this select 0) getVariable [QGVAR(bloodVolume), 100]) < 65)}, @@ -276,9 +302,6 @@ GVAR(lastHeartBeatSound) = ACE_time; [ACE_player] call FUNC(itemCheck); }] call EFUNC(common,addEventHandler); -// Networked litter -[QGVAR(createLitter), FUNC(handleCreateLitter), GVAR(litterCleanUpDelay)] call EFUNC(common,addSyncedEventHandler); - if (hasInterface) then { ["PlayerJip", { ACE_LOGINFO("JIP Medical init for player."); diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 5deaf77ceb..85232498bd 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -2,127 +2,54 @@ ADDON = false; -PREP(actionCheckBloodPressure); -PREP(actionCheckBloodPressureLocal); -PREP(actionCheckPulse); -PREP(actionCheckPulseLocal); -PREP(actionCheckResponse); -PREP(actionDiagnose); -PREP(actionPlaceInBodyBag); -PREP(actionRemoveTourniquet); -PREP(actionLoadUnit); -PREP(actionUnloadUnit); -PREP(addDamageToUnit); -PREP(addHeartRateAdjustment); -PREP(addToInjuredCollection); -PREP(addToLog); -PREP(addToTriageCard); -PREP(addUnconsciousCondition); -PREP(addUnloadPatientActions); -PREP(adjustPainLevel); -PREP(canAccessMedicalEquipment); -PREP(canTreat); -PREP(canTreatCached); -PREP(determineIfFatal); -PREP(getBloodLoss); -PREP(getBloodPressure); -PREP(getBloodVolumeChange); -PREP(getCardiacOutput); -PREP(getTypeOfDamage); -PREP(getHeartRateChange); -PREP(getTriageStatus); -PREP(getUnconsciousCondition); -PREP(handleDamage); -PREP(handleDamage_advanced); -PREP(handleDamage_advancedSetDamage); -PREP(handleDamage_airway); -PREP(handleDamage_basic); -PREP(handleDamage_caching); -PREP(handleDamage_fractures); -PREP(handleDamage_internalInjuries); -PREP(handleDamage_wounds); -PREP(handleDamage_woundsOld); -PREP(handleUnitVitals); -PREP(handleKilled); -PREP(handleLocal); -PREP(handleBandageOpening); -PREP(hasItem); -PREP(hasItems); -PREP(hasMedicalEnabled); -PREP(hasTourniquetAppliedTo); -PREP(init); -PREP(isBeingCarried); -PREP(isBeingDragged); -PREP(isInMedicalFacility); -PREP(isInMedicalVehicle); -PREP(isMedic); -PREP(isMedicalVehicle); -PREP(isInStableCondition); -PREP(itemCheck); -PREP(modifyMedicalAction); -PREP(onMedicationUsage); -PREP(onWoundUpdateRequest); -PREP(onPropagateWound); -PREP(parseConfigForInjuries); -PREP(playInjuredSound); -PREP(selectionNameToNumber); -PREP(setCardiacArrest); -PREP(setDead); -PREP(setHitPointDamage); -PREP(setStructuralDamage); -PREP(setUnconscious); -PREP(translateSelections); -PREP(treatment); -PREP(treatment_failure); -PREP(treatment_success); -PREP(treatmentAdvanced_bandage); -PREP(treatmentAdvanced_bandageLocal); -PREP(treatmentAdvanced_CPR); -PREP(treatmentAdvanced_CPRLocal); -PREP(treatmentAdvanced_fullHeal); -PREP(treatmentAdvanced_fullHealLocal); -PREP(treatmentAdvanced_fullHealTreatmentTime); -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); -PREP(treatmentBasic_morphine); -PREP(treatmentBasic_morphineLocal); -PREP(treatmentIV); -PREP(treatmentIVLocal); -PREP(treatmentTourniquet); -PREP(treatmentTourniquetLocal); -PREP(useItem); -PREP(useItems); -PREP(displayPatientInformation); -PREP(displayTriageCard); -PREP(dropDownTriageCard); -PREP(moduleMedicalSettings); -PREP(moduleAdvancedMedicalSettings); -PREP(moduleReviveSettings); -PREP(moduleAssignMedicRoles); -PREP(moduleAssignMedicalVehicle); -PREP(moduleAssignMedicalFacility); -PREP(copyDeadBody); -PREP(requestWoundSync); -PREP(unconsciousPFH); - -// Networked litter -PREP(createLitter); -PREP(handleCreateLitter); +#include "XEH_PREP.hpp" GVAR(injuredUnitCollection) = []; GVAR(IVBags) = []; -DFUNC(handleDamage_assignWounds) = if ("ace_medical" callExtension "version" == "") then { DFUNC(handleDamage_woundsOld) } else { DFUNC(handleDamage_wounds)}; +private _versionEx = "ace_medical" callExtension "version"; +DFUNC(handleDamage_assignWounds) = if (_versionEx == "") then { + ACE_LOGINFO_1("Extension %1.dll not installed.","ace_medical"); + DFUNC(handleDamage_woundsOld) +} else { + ACE_LOGINFO_2("Extension version: %1: %2","ace_medical",_versionEx); + DFUNC(handleDamage_wounds) +}; call FUNC(parseConfigForInjuries); GVAR(HITPOINTS) = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; GVAR(SELECTIONS) = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; +//Hack for #3168 (units in static weapons do not take any damage): +//doing a manual pre-load with a small distance seems to fix the LOD problems with handle damage not returning full results +GVAR(fixedStatics) = []; +private _fixStatic = { + params ["_vehicle"]; + private _vehType = typeOf _vehicle; + TRACE_2("",_vehicle,_vehType); + if (!(_vehType in GVAR(fixedStatics))) then { + GVAR(fixedStatics) pushBack _vehType; + TRACE_1("starting preload",_vehType); + [{ + 1 preloadObject (_this select 0); + }, { + TRACE_1("preload done",_this); + }, [_vehType]] call EFUNC(common,waitUntilAndExecute); + }; +}; +["StaticWeapon", "init", _fixStatic] call CBA_fnc_addClassEventHandler; +["Car", "init", _fixStatic] call CBA_fnc_addClassEventHandler; +addMissionEventHandler ["Loaded",{ + { + TRACE_1("starting preload (save load)",_x); + [{ + 1 preloadObject (_this select 0); + }, { + TRACE_1("preload done",_this); + }, [_x]] call EFUNC(common,waitUntilAndExecute); + } forEach GVAR(fixedStatics); +}]; + + ADDON = true; diff --git a/addons/medical/XEH_preStart.sqf b/addons/medical/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/medical/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/medical/XEH_respawn.sqf b/addons/medical/XEH_respawn.sqf index 438e7396cc..7d48672972 100644 --- a/addons/medical/XEH_respawn.sqf +++ b/addons/medical/XEH_respawn.sqf @@ -7,7 +7,7 @@ params ["_unit"]; // Reset captive status for respawning unit if (!(_unit getVariable ["ACE_isUnconscious", false])) then { - [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set); }; // Remove maximum unconsciousness time handler diff --git a/addons/medical/config.cpp b/addons/medical/config.cpp index 910a086364..d40fb9e6a6 100644 --- a/addons/medical/config.cpp +++ b/addons/medical/config.cpp @@ -18,8 +18,8 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" #include "CfgSounds.hpp" +#include "CfgEden.hpp" #include "ACE_Medical_Treatments.hpp" #include "ACE_Settings.hpp" #include "UI\RscTitles.hpp" #include "UI\triagecard.hpp" - diff --git a/addons/medical/data/adenosine.p3d b/addons/medical/data/adenosine.p3d new file mode 100644 index 0000000000..fa9fb72c84 Binary files /dev/null and b/addons/medical/data/adenosine.p3d differ diff --git a/addons/medical/data/littergeneric_adenosine.p3d b/addons/medical/data/littergeneric_adenosine.p3d new file mode 100644 index 0000000000..4490a11c0e Binary files /dev/null and b/addons/medical/data/littergeneric_adenosine.p3d differ diff --git a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf index 889cc90de9..4d821ea6b0 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf @@ -15,4 +15,8 @@ #include "script_component.hpp" params ["_caller", "_target", "_selectionName"]; -[[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +if (local _target) then { + ["actionCheckBloodPressureLocal", [_caller, _target, _selectionName]] call EFUNC(common,localEvent); +} else { + ["actionCheckBloodPressureLocal", _target, [_caller, _target, _selectionName]] call EFUNC(common,targetEvent); +}; diff --git a/addons/medical/functions/fnc_actionCheckPulse.sqf b/addons/medical/functions/fnc_actionCheckPulse.sqf index 8c2c6cf109..2c0a46c826 100644 --- a/addons/medical/functions/fnc_actionCheckPulse.sqf +++ b/addons/medical/functions/fnc_actionCheckPulse.sqf @@ -15,5 +15,8 @@ #include "script_component.hpp" params ["_caller","_target", "_selectionName"]; -[[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ - +if (local _target) then { + ["actionCheckPulseLocal", [_caller, _target, _selectionName]] call EFUNC(common,localEvent); +} else { + ["actionCheckPulseLocal", _target, [_caller, _target, _selectionName]] call EFUNC(common,targetEvent); +}; diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index f416535701..d7a316cab0 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -7,33 +7,46 @@ * 1: The patient * * Return Value: - * body bag + * body bag (will return objNull when run where target is not local) + * + * Example: + * [player, cursorTarget] call ace_medical_fnc_actionPlaceInBodyBag * * Public: Yes */ #include "script_component.hpp" -private ["_position", "_headPos", "_spinePos", "_dirVect", "_direction", "_bodyBag"]; params ["_caller", "_target"]; +TRACE_2("params",_caller,_target); + +if (!local _target) exitWith { + TRACE_1("running where local",local _target); + ["actionPlaceInBodyBag", [_target], [_caller, _target]] call EFUNC(common,targetEvent); + objNull +}; if (alive _target) then { + TRACE_1("manually killing with setDead",_target); [_target, true] call FUNC(setDead); }; -_position = (getPosASL _target) vectorAdd [0, 0, 0.2]; +private _position = (getPosASL _target) vectorAdd [0, 0, 0.2]; -_headPos = _target modelToWorldVisual (_target selectionPosition "head"); -_spinePos = _target modelToWorldVisual (_target selectionPosition "Spine3"); -_dirVect = _headPos vectorFromTo _spinePos; -_direction = _dirVect call CBA_fnc_vectDir; +private _headPos = _target modelToWorldVisual (_target selectionPosition "head"); +private _spinePos = _target modelToWorldVisual (_target selectionPosition "Spine3"); +private _dirVect = _headPos vectorFromTo _spinePos; +private _direction = _dirVect call CBA_fnc_vectDir; -deleteVehicle _target; +//move the body away now, so it won't physX the bodyBag object (this setPos seems to need to be called where object is local) +_target setPosASL [-5000, -5000, 0]; -_bodyBag = createVehicle ["ACE_bodyBagObject", _position, [], 0, "CAN_COLLIDE"]; +private _bodyBag = createVehicle ["ACE_bodyBagObject", _position, [], 0, ""]; // prevent body bag from flipping _bodyBag setPosASL _position; _bodyBag setDir _direction; +["placedInBodyBag", [_target, _bodyBag]] call EFUNC(common,globalEvent); //hide and delete body on server + _bodyBag diff --git a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf index 81412f60c4..660c3f9ff7 100644 --- a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf +++ b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf @@ -17,6 +17,7 @@ private ["_part", "_tourniquets", "_output"]; params ["_caller", "_target", "_selectionName"]; +TRACE_3("params",_caller,_target,_selectionName); // grab the required data _part = [_selectionName] call FUNC(selectionNameToNumber); @@ -34,3 +35,21 @@ _target setVariable [QGVAR(tourniquets), _tourniquets, true]; // Adding the tourniquet item to the caller _caller addItem "ACE_tourniquet"; + +//Handle all injected medications now that blood is flowing: +private _delayedMedications = _target getVariable [QGVAR(occludedMedications), []]; +private _updatedArray = false; +TRACE_2("meds",_part,_delayedMedications); +{ + _x params ["", "", "_medPartNum"]; + if (_part == _medPartNum) then { + TRACE_1("delayed medication call after tourniquet removeal",_x); + ["treatmentAdvanced_medicationLocal", [_target], _x] call EFUNC(common,targetEvent); + _delayedMedications set [_forEachIndex, -1]; + _updatedArray = true; + }; +} forEach _delayedMedications; +if (_updatedArray) then { + _delayedMedications = _delayedMedications - [-1]; + _target setVariable [QGVAR(occludedMedications), _delayedMedications, true]; +}; diff --git a/addons/medical/functions/fnc_actionUnloadUnit.sqf b/addons/medical/functions/fnc_actionUnloadUnit.sqf index 3d6d1d964c..705eeb88f5 100644 --- a/addons/medical/functions/fnc_actionUnloadUnit.sqf +++ b/addons/medical/functions/fnc_actionUnloadUnit.sqf @@ -21,4 +21,4 @@ params ["_caller", "_target", ["_drag", false]]; if (vehicle _target == _target) exitWith {}; if (([_target] call EFUNC(common,isAwake))) exitWith {}; -["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent) +["unloadPersonEvent", _target, [_target, vehicle _target, _caller]] call EFUNC(common,targetEvent); diff --git a/addons/medical/functions/fnc_addToInjuredCollection.sqf b/addons/medical/functions/fnc_addToInjuredCollection.sqf index 48e400f7b2..aa545f491e 100644 --- a/addons/medical/functions/fnc_addToInjuredCollection.sqf +++ b/addons/medical/functions/fnc_addToInjuredCollection.sqf @@ -18,7 +18,7 @@ params ["_unit", ["_force", false]]; if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { if !(local _unit) exitWith { - [[_unit, _force], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + ["addToInjuredCollection", _unit, [_unit, _force]] call EFUNC(common,targetEvent); }; if ((_unit getVariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force) exitWith{}; diff --git a/addons/medical/functions/fnc_addToLog.sqf b/addons/medical/functions/fnc_addToLog.sqf index 8d1b337514..88c463d1eb 100644 --- a/addons/medical/functions/fnc_addToLog.sqf +++ b/addons/medical/functions/fnc_addToLog.sqf @@ -20,7 +20,7 @@ private ["_moment", "_logVarName", "_log","_newLog", "_logs"]; params ["_unit", "_type", "_message", "_arguments"]; if (!local _unit) exitWith { - [_this, QFUNC(addToLog), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + ["addToMedicalLog", _unit, _this] call EFUNC(common,targetEvent); }; date params ["", "", "", "_hour", "_minute"]; diff --git a/addons/medical/functions/fnc_addToTriageCard.sqf b/addons/medical/functions/fnc_addToTriageCard.sqf index bd988fa84c..ca54d8cd27 100644 --- a/addons/medical/functions/fnc_addToTriageCard.sqf +++ b/addons/medical/functions/fnc_addToTriageCard.sqf @@ -18,7 +18,7 @@ private ["_log", "_inList", "_amount"]; params ["_unit", "_newItem"]; if (!local _unit) exitWith { - [_this, QUOTE(DFUNC(addToTriageCard)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + ["addToTriageCard", _unit, _this] call EFUNC(common,targetEvent); }; _log = _unit getVariable [QGVAR(triageCard), []]; diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index 61931b9765..bb90e0e3e2 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -81,7 +81,7 @@ _createdLitter = []; // Loop through through the litter options and place the litter { if (_x isEqualType [] && {(count _x > 0)}) then { - [_target, _x select (floor(random(count _x)))] call _createLitter; + [_target, selectRandom _x] call _createLitter; }; if (_x isEqualType "") then { [_target, _x] call _createLitter; diff --git a/addons/medical/functions/fnc_determineIfFatal.sqf b/addons/medical/functions/fnc_determineIfFatal.sqf index 8be0e00903..8a70d336c2 100644 --- a/addons/medical/functions/fnc_determineIfFatal.sqf +++ b/addons/medical/functions/fnc_determineIfFatal.sqf @@ -26,8 +26,8 @@ private ["_damageThreshold", "_damageBodyPart", "_chanceFatal"]; params ["_unit", "_part", ["_withDamage", 0]]; if (!alive _unit) exitWith {true}; -if (_part < 0 || _part > 5) exitWith {false}; if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitWith { true }; +if (_part < 0 || _part > 5) exitWith {false}; // Find the correct Damage threshold for unit. _damageThreshold = [1,1,1]; diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index 279bbf060d..1e1816d5f5 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -101,7 +101,7 @@ if (_show) 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 _x1) select 6, _amountOf], [1,1,1,1]]; + _allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select _x1) select 6, ceil _amountOf], [1,1,1,1]]; } else { // TODO localization _allInjuryTexts pushback [format["Partial %1", (GVAR(AllWoundInjuryTypes) select _x1) select 6], [1,1,1,1]]; @@ -122,7 +122,7 @@ if (_show) then { if (_amountOf > 0) then { if (_amountOf >= 1) then { // TODO localization - _allInjuryTexts pushback [format["[B] %2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [0.88,0.7,0.65,1]]; + _allInjuryTexts pushback [format["[B] %2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, ceil _amountOf], [0.88,0.7,0.65,1]]; } else { // TODO localization _allInjuryTexts pushback [format["[B] Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [0.88,0.7,0.65,1]]; diff --git a/addons/medical/functions/fnc_handleCollisionDamage.sqf b/addons/medical/functions/fnc_handleCollisionDamage.sqf new file mode 100644 index 0000000000..191a91cb6a --- /dev/null +++ b/addons/medical/functions/fnc_handleCollisionDamage.sqf @@ -0,0 +1,14 @@ +// by commy2 +#include "script_component.hpp" + +params ["_unit", "_newDamage"]; + +private ["_selection", "_totalDamage"]; + +_selection = "body"; + +_totalDamage = (_unit getHit _selection) + _newDamage; + +_unit setHit [_selection, _totalDamage]; + +systemChat format ["collision: %1", _this]; diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 628c1cb92e..a5ce32b9e0 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -77,13 +77,15 @@ _minLethalDamage = if (_typeIndex >= 0) then { 0.01 }; -if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then { +private _vehicle = vehicle _unit; +private _effectiveSelectionName = _selection; +if ((_vehicle != _unit) && {!(_vehicle isKindOf "StaticWeapon")} && {_shooter in [objNull, driver _vehicle, _vehicle]} && {_projectile == ""} && {_selection == ""}) then { if (GVAR(enableVehicleCrashes)) then { - _selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS)))); + _effectiveSelectionName = _this select 1; //pull random selection from HDC }; }; -if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then { +if ((_minLethalDamage <= _newDamage) && {[_unit, [_effectiveSelectionName] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then { if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith { _damageReturn = 0.9; }; @@ -99,13 +101,8 @@ if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectio [_unit] call FUNC(addToInjuredCollection); if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitWith { - if (vehicle _unit != _unit and {damage (vehicle _unit) >= 1}) then { - [_unit] call EFUNC(common,unloadPerson); - }; - - private "_delayedUnconsicous"; - _delayedUnconsicous = false; - if (vehicle _unit != _unit and {damage (vehicle _unit) >= 1}) then { + private _delayedUnconsicous = false; + if (_vehicle != _unit and {damage _vehicle >= 1}) then { [_unit] call EFUNC(common,unloadPerson); _delayedUnconsicous = true; }; @@ -118,7 +115,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,waitAndExecute); + }, [_unit], 0.7] call EFUNC(common,waitAndExecute); } else { [{ [_this select 0, true] call FUNC(setUnconscious); diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 1eae9544ad..cc969ce961 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -29,9 +29,10 @@ if (_hitPointIndex >= 0) then {_newDamage = _damage - (_unit getHitIndex _hitPoi TRACE_7("ACE_DEBUG: HandleDamage_Caching Called",_unit, _selectionName, _damage, _source, _projectile,_hitPointIndex,_newDamage); // Check for vehicle crash -if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then { +private _vehicle = vehicle _unit; +if ((_vehicle != _unit) && {!(_vehicle isKindOf "StaticWeapon")} && {_source in [objNull, driver _vehicle, _vehicle]} && {_projectile == ""} && {_selectionName == ""}) then { if (GVAR(enableVehicleCrashes)) then { - _selectionName = _hitSelections select (floor(random(count _hitSelections))); + _selectionName = selectRandom _hitSelections; _projectile = "vehiclecrash"; _this set [1, _selectionName]; _this set [4, _projectile]; @@ -40,7 +41,7 @@ if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isN // Handle falling damage _impactVelocity = (velocity _unit) select 2; -if (_impactVelocity < -5 && {vehicle _unit == _unit}) then { +if (_impactVelocity < -5 && {_vehicle == _unit}) then { TRACE_1("Starting isFalling", time); _unit setVariable [QGVAR(isFalling), true]; _unit setVariable [QGVAR(impactVelocity), _impactVelocity]; @@ -59,7 +60,7 @@ if (_unit getVariable [QGVAR(isFalling), false]) then { }; } else { if (_selectionName == "") then { - _selectionName = ["leg_l", "leg_r"] select (floor(random 2)); + _selectionName = selectRandom ["leg_l", "leg_r"]; _this set [1, _selectionName]; }; _newDamage = _newDamage * 0.7; diff --git a/addons/medical/functions/fnc_handleDamage_wounds.sqf b/addons/medical/functions/fnc_handleDamage_wounds.sqf index 38665a0e40..14c74df11a 100644 --- a/addons/medical/functions/fnc_handleDamage_wounds.sqf +++ b/addons/medical/functions/fnc_handleDamage_wounds.sqf @@ -31,8 +31,8 @@ _painToAdd = 0; _woundsCreated = []; call compile _extensionOutput; -_foundIndex = -1; { + _foundIndex = -1; _toAddClassID = _x select 1; _bodyPartNToAdd = _x select 2; { diff --git a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf index 4384dce2d7..c6ccd1c2b5 100644 --- a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf +++ b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf @@ -80,10 +80,10 @@ _painToAdd = 0; _woundsCreated = []; { if (_x select 0 <= _damage) exitWith { - for "_i" from 0 to (1+ floor(random(_x select 1)-1)) /* step +1 */ do { + for "_i" from 0 to ((_x select 1)-1) do { // Find the injury we are going to add. Format [ classID, allowdSelections, bloodloss, painOfInjury, minimalDamage] - _toAddInjury = if (random(1) >= 0.85) then {_allInjuriesForDamageType select _highestPossibleSpot} else {_allPossibleInjuries select (floor(random (count _allPossibleInjuries)));}; + _toAddInjury = if (random(1) >= 0.85) then {_allInjuriesForDamageType select _highestPossibleSpot} else {selectRandom _allPossibleInjuries}; _toAddClassID = _toAddInjury select 0; _foundIndex = -1; diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index ad58a0126e..868b07fbf4 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -24,6 +24,9 @@ _unit setVariable ["ACE_isUnconscious", false, true]; // tourniquets _unit setVariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; +//Delayed Medications (from tourniquets) +_unit setVariable [QGVAR(occludedMedications), nil, true]; + // wounds and injuries _unit setVariable [QGVAR(openWounds), [], true]; _unit setVariable [QGVAR(bandagedWounds), [], true]; diff --git a/addons/medical/functions/fnc_isInMedicalFacility.sqf b/addons/medical/functions/fnc_isInMedicalFacility.sqf index 330a1e5ea3..f934978d2b 100644 --- a/addons/medical/functions/fnc_isInMedicalFacility.sqf +++ b/addons/medical/functions/fnc_isInMedicalFacility.sqf @@ -8,18 +8,23 @@ * ReturnValue: * Is in medical facility * + * Example: + * [player] call ace_medical_fnc_isInMedicalFacility + * * Public: Yes */ - #include "script_component.hpp" -private ["_eyePos", "_objects", "_isInBuilding", "_medicalFacility"]; params ["_unit"]; -_eyePos = eyePos _unit; -_isInBuilding = false; +//Cache the results as this function could be called rapidly +(_unit getVariable [QGVAR(cacheInFacility), [-9, false]]) params ["_expireTime", "_lastResult"]; +if (ACE_time < _expireTime) exitWith {_lastResult}; -_medicalFacility = +private _eyePos = eyePos _unit; +private _isInBuilding = false; + +private _medicalFacility = [ "TK_GUE_WarfareBFieldhHospital_Base_EP1", "TK_GUE_WarfareBFieldhHospital_EP1", @@ -37,18 +42,22 @@ _medicalFacility = "USMC_WarfareBFieldhHospital" ]; -_objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]); +private _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]); { if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitWith { _isInBuilding = true; }; } forEach _objects; if (!_isInBuilding) then { - _objects = position _unit nearObjects 7.5; + _objects = _unit nearObjects 7.5; { if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitWith { _isInBuilding = true; }; } forEach _objects; }; + +//Save the results (with a 1 second expiry) +_unit setVariable [QGVAR(cacheInFacility), [ACE_time + 1, _isInBuilding]]; + _isInBuilding; diff --git a/addons/medical/functions/fnc_isInMedicalVehicle.sqf b/addons/medical/functions/fnc_isInMedicalVehicle.sqf index 1f1ff193fd..4182003bad 100644 --- a/addons/medical/functions/fnc_isInMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_isInMedicalVehicle.sqf @@ -8,14 +8,15 @@ * Return Value: * Is unit in medical vehicle? * + * Example: + * [player] call ace_medical_fnc_isInMedicalVehicle + * * Public: Yes */ - #include "script_component.hpp" -private ["_vehicle"]; params ["_unit"]; -_vehicle = vehicle _unit; +private _vehicle = vehicle _unit; if (_unit == _vehicle) exitWith {false}; if (_unit in [driver _vehicle, gunner _vehicle, commander _vehicle]) exitWith {false}; diff --git a/addons/medical/functions/fnc_isMedic.sqf b/addons/medical/functions/fnc_isMedic.sqf index ca974fb751..ff5a1b24a9 100644 --- a/addons/medical/functions/fnc_isMedic.sqf +++ b/addons/medical/functions/fnc_isMedic.sqf @@ -9,15 +9,23 @@ * ReturnValue: * Is in of medic class * + * Example: + * [player] call ace_medical_fnc_isMedic + * * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_class", "_medicN"]; params ["_unit", ["_medicN", 1]]; -_class = _unit getVariable [QGVAR(medicClass), - getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")]; +private _class = _unit getVariable [QGVAR(medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")]; + +if (_class >= _medicN min GVAR(medicSetting)) exitWith {true}; +if (!GVAR(increaseTrainingInLocations)) exitWith {false}; + +if (([_unit] call FUNC(isInMedicalVehicle)) || {[_unit] call FUNC(isInMedicalFacility)}) then { + _class = _class + 1; //boost by one: untrained becomes medic, medic becomes doctor +}; _class >= _medicN min GVAR(medicSetting) diff --git a/addons/medical/functions/fnc_moduleBasicMedicalSettings.sqf b/addons/medical/functions/fnc_moduleBasicMedicalSettings.sqf new file mode 100644 index 0000000000..08076878f2 --- /dev/null +++ b/addons/medical/functions/fnc_moduleBasicMedicalSettings.sqf @@ -0,0 +1,23 @@ +/* + * Author: Glowbal + * Module for adjusting the medical treatment settings + * + * 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(medicSetting_basicEpi), "medicSetting_basicEpi"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(useLocation_basicEpi), "useLocation_basicEpi"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical/functions/fnc_moduleMedicalSettings.sqf b/addons/medical/functions/fnc_moduleMedicalSettings.sqf index c75a568600..dbf3d8084d 100644 --- a/addons/medical/functions/fnc_moduleMedicalSettings.sqf +++ b/addons/medical/functions/fnc_moduleMedicalSettings.sqf @@ -21,6 +21,7 @@ if !(_activated) exitWith {}; [_logic, QGVAR(level), "level"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(medicSetting), "medicSetting"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(increaseTrainingInLocations), "increaseTrainingInLocations"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(allowLitterCreation), "allowLitterCreation"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(litterCleanUpDelay), "litterCleanUpDelay"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(enableScreams), "enableScreams"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical/functions/fnc_onMedicationUsage.sqf b/addons/medical/functions/fnc_onMedicationUsage.sqf index 8eb55b3d1b..fc7e8daa2d 100644 --- a/addons/medical/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical/functions/fnc_onMedicationUsage.sqf @@ -20,6 +20,7 @@ private ["_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_decreaseAmount", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"]; params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"]; +TRACE_8("params",_target,_className,_variable,_maxDosage,_timeInSystem,_incompatabileMeds,_viscosityChange,_painReduce); _foundEntry = false; _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; diff --git a/addons/medical/functions/fnc_playInjuredSound.sqf b/addons/medical/functions/fnc_playInjuredSound.sqf index bcb590143d..6dae7ab276 100644 --- a/addons/medical/functions/fnc_playInjuredSound.sqf +++ b/addons/medical/functions/fnc_playInjuredSound.sqf @@ -59,12 +59,12 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith { // Select the to be played sound based upon damage amount. if (_pain > 0.5) then { if (random(1) > 0.5) then { - _sound = _availableSounds_A select (round(random((count _availableSounds_A) - 1))); + _sound = selectRandom _availableSounds_A; } else { - _sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1))); + _sound = selectRandom _availableSounds_B; }; } else { - _sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1))); + _sound = selectRandom _availableSounds_B; }; // Play the sound playSound3D [(getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0) + ".wss", objNull, false, getPos _unit, 15, 1, 25]; // +2db, 15 meters. diff --git a/addons/medical/functions/fnc_serverRemoveBody.sqf b/addons/medical/functions/fnc_serverRemoveBody.sqf new file mode 100644 index 0000000000..de089b199b --- /dev/null +++ b/addons/medical/functions/fnc_serverRemoveBody.sqf @@ -0,0 +1,48 @@ +/* + * Author: PabstMirror + * Removes corpse. Idealy it is just deleted the next frame, + * but player bodies cannot be deleted until they respawn, so it is hidden and deleted later. + * + * Arguments: + * 0: Mr Body + * + * Return Value: + * Nothing + * + * Example: + * [cursorTarget] call ace_medical_fnc_serverRemoveBody + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_target"]; +TRACE_2("",_target,isPlayer _target); + +//Hide the body globaly +["hideObjectGlobal", [_target, true]] call EFUNC(common,serverEvent); + +if (isNil QGVAR(bodiesToDelete)) then {GVAR(bodiesToDelete) = [];}; +GVAR(bodiesToDelete) pushBack _target; + +//Start up PFEH to wait for bodies to be free to delete +if ((count GVAR(bodiesToDelete)) == 1) then { + TRACE_1("starting PFEH",GVAR(bodiesToDelete)); + [{ + { + TRACE_2("body",_x,isPlayer _x); + if ((!isNull _x) && {!isPlayer _x}) then {deleteVehicle _x}; + } forEach GVAR(bodiesToDelete); + + //deleteVehicle doesn't have instant results so it won't usualy be filtered until next run + GVAR(bodiesToDelete) = GVAR(bodiesToDelete) - [objNull]; + + if (GVAR(bodiesToDelete) isEqualTo []) then { + TRACE_1("array emptied - rem PFEH",GVAR(bodiesToDelete)); + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + }, 20, []] call CBA_fnc_addPerFrameHandler; +}; + +nil diff --git a/addons/medical/functions/fnc_setDead.sqf b/addons/medical/functions/fnc_setDead.sqf index 030945daaf..913431ccac 100644 --- a/addons/medical/functions/fnc_setDead.sqf +++ b/addons/medical/functions/fnc_setDead.sqf @@ -20,7 +20,7 @@ params ["_unit", ["_force", false], ["_delaySetDamage", false]]; if ((!alive _unit) || {_unit getVariable ["ACE_isDead", false]}) exitWith {true}; if (!local _unit) exitwith { - [[_unit, _force], QUOTE(DFUNC(setDead)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + ["setDead", _unit, [_unit, _force]] call EFUNC(common,targetEvent); false; }; @@ -47,6 +47,12 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == _args params ["_unit"]; _startTime = _unit getVariable [QGVAR(reviveStartTime), 0]; + //If we are in reivie state in a blown up vehicle, try to unload so that people can access the body + if ((alive _unit) && {(vehicle _unit) != _unit} && {!alive (vehicle _unit)}) then { + TRACE_2("Unloading", _unit, vehicle _unit); + [_unit] call EFUNC(common,unloadPerson); + }; + if (GVAR(maxReviveTime) > 0 && {ACE_time - _startTime > GVAR(maxReviveTime)}) exitwith { [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setVariable [QGVAR(inReviveState), nil, true]; @@ -80,7 +86,7 @@ if (isPLayer _unit) then { ["medical_onSetDead", [_unit]] call EFUNC(common,localEvent); -//Delay a frame before killing the unit via scripted damage +//Delay a frame before killing the unit via scripted damage //to avoid triggering the "Killed" Event twice (and having the wrong killer) if (!_delaySetDamage) then { diff --git a/addons/medical/functions/fnc_setHitPointDamage.sqf b/addons/medical/functions/fnc_setHitPointDamage.sqf index f8698a7fe0..9abce575cd 100644 --- a/addons/medical/functions/fnc_setHitPointDamage.sqf +++ b/addons/medical/functions/fnc_setHitPointDamage.sqf @@ -26,7 +26,7 @@ params ["_unit", "_selection", "_damage", ["_disabled", false]]; // Unit isn't local, give function to machine where it is. if !(local _unit) exitWith { - [_this, QUOTE(DFUNC(setHitPointDamage)), _unit] call EFUNC(common,execRemoteFnc); + ["setHitPointDamage", _unit, _this] call EFUNC(common,targetEvent); }; // Check if overall damage adjustment is disabled @@ -47,8 +47,7 @@ if !(_selection in _selections) exitWith { _unit setHitPointDamage [_selection, _damage]; }; -GVAR(unit) = _unit; -_damages = [_selections, {GVAR(unit) getHitPointDamage _this}] call EFUNC(common,map); +_damages = _selections apply {_unit getHitPointDamage _x}; _damageOld = damage _unit; _damageSumOld = 0; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 2c3c71cb1b..25bc8aacb5 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -39,7 +39,7 @@ if !(_set) exitWith { if !(!(isNull _unit) && {(_unit isKindOf "CAManBase") && ([_unit] call EFUNC(common,isAwake))}) exitWith{}; if (!local _unit) exitWith { - [[_unit, _set, _minWaitingTime, _force], QUOTE(DFUNC(setUnconscious)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + ["setUnconscious", _unit, [_unit, _set, _minWaitingTime, _force]] call EFUNC(common,targetEvent); }; _unit setVariable ["ACE_isUnconscious", true, true]; @@ -96,17 +96,16 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then { }; // Delay Unconscious so the AI dont instant stop shooting on the unit #3121 if (GVAR(delayUnconCaptive) == 0) then { - [_unit, QGVAR(unconscious), true] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(unconscious), true] call EFUNC(common,statusEffect_set); } else { [{ params ["_unit"]; if (_unit getVariable ["ACE_isUnconscious", false]) then { - [_unit, QGVAR(unconscious), true] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(unconscious), true] call EFUNC(common,statusEffect_set); }; },[_unit], GVAR(delayUnconCaptive)] call EFUNC(common,waitAndExecute); }; - _anim = [_unit] call EFUNC(common,getDeathAnim); [_unit, _anim, 1, true] call EFUNC(common,doAnimation); [{ diff --git a/addons/medical/functions/fnc_translateSelections.sqf b/addons/medical/functions/fnc_translateSelections.sqf index b377b3004d..98a4cf8c51 100644 --- a/addons/medical/functions/fnc_translateSelections.sqf +++ b/addons/medical/functions/fnc_translateSelections.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: Unit * 1: selection name - * 2: HitPoint Index/True to get hitpoint + * 2: HitPoint Index/True to get hitpoint * * Return Value: * translated selection/hitpoint name diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf index f86e620625..7d34a278f1 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf @@ -19,6 +19,12 @@ 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 */ + [_target, "activity_view", LSTRING(Activity_cpr), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); + + if (local _target) then { + ["treatmentAdvanced_CPRLocal", [_caller, _target]] call EFUNC(common,localEvent); + } else { + ["treatmentAdvanced_CPRLocal", _target, [_caller, _target]] call EFUNC(common,targetEvent); + }; }; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf index bb69a1e45a..98881e1a28 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf @@ -26,7 +26,12 @@ if !([_target] call FUNC(hasMedicalEnabled)) exitWith { _this call FUNC(treatmentBasic_bandage); }; -[[_target, _className, _selectionName, _specificSpot], QUOTE(DFUNC(treatmentAdvanced_bandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +if (local _target) then { + ["treatmentAdvanced_bandageLocal", [_target, _className, _selectionName, _specificSpot]] call EFUNC(common,localEvent); +} else { + ["treatmentAdvanced_bandageLocal", _target, [_target, _className, _selectionName, _specificSpot]] call EFUNC(common,targetEvent); +}; + /* { if (_x != "") then { [_target, _x] call FUNC(addToTriageCard); diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf index a26876568d..a5332df107 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf @@ -12,7 +12,10 @@ 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 */ +if (local _target) then { + ["treatmentAdvanced_fullHealLocal", [_caller, _target]] call EFUNC(common,localEvent); +} else { + ["treatmentAdvanced_fullHealLocal", _target, [_caller, _target]] call EFUNC(common,targetEvent); +}; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf index 5949f53780..185853b677 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -7,7 +7,7 @@ * 1: The patient * 2: SelectionName * 3: Treatment classname - * + * 4: Items Used * * Return Value: * Succesful treatment started @@ -18,8 +18,11 @@ #include "script_component.hpp" params ["_caller", "_target", "_selectionName", "_className", "_items"]; +TRACE_5("params",_caller,_target,_selectionName,_className,_items); -[[_target, _className], QUOTE(DFUNC(treatmentAdvanced_medicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +private _part = [_selectionName] call FUNC(selectionNameToNumber); + +["treatmentAdvanced_medicationLocal", [_target], [_target, _className, _part]] call EFUNC(common,targetEvent); { if (_x != "") then { diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf index 952f245da9..2c3cf4cc41 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: The patient * 1: Treatment classname - * + * 2: Injection Site Part Number * * Return Value: * Succesful treatment started @@ -16,7 +16,18 @@ #include "script_component.hpp" private ["_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"]; -params ["_target", "_className"]; + +params ["_target", "_className", "_partNumber"]; +TRACE_3("params",_target,_className,_partNumber); + +private _tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +if ((_tourniquets select _partNumber) > 0) exitWith { + TRACE_1("unit has tourniquets blocking blood flow on injection site",_tourniquets); + private _delayedMedications = _target getVariable [QGVAR(occludedMedications), []]; + _delayedMedications pushBack _this; + _target setVariable [QGVAR(occludedMedications), _delayedMedications, true]; + true +}; // 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_treatmentBasic_bandage.sqf b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf index 04cace08af..3e04ad3bd8 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf @@ -20,4 +20,8 @@ private ["_hitSelections", "_hitPoints", "_point", "_damage"]; params ["_caller", "_target", "_selection", "_className"]; -[[_target, _selection], QUOTE(DFUNC(treatmentBasic_bandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +if (local _target) then { + ["treatmentBasic_bandageLocal", [_target, _selection]] call EFUNC(common,localEvent); +} else { + ["treatmentBasic_bandageLocal", _target, [_target, _selection]] call EFUNC(common,targetEvent); +}; diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf index 5700d351cb..f28b634038 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf @@ -18,4 +18,8 @@ params ["_caller", "_target", "_treatmentClassname"]; -[[_target, _treatmentClassname], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +if (local _target) then { + ["treatmentBasic_bloodbagLocal", [_target, _treatmentClassname]] call EFUNC(common,localEvent); +} else { + ["treatmentBasic_bloodbagLocal", _target, [_target, _treatmentClassname]] call EFUNC(common,targetEvent); +}; diff --git a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf index 87559d0dd2..d2f7de45a9 100644 --- a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf @@ -19,4 +19,8 @@ params ["_caller", "_target"]; -[[_target], QUOTE(DFUNC(treatmentBasic_morphineLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +if (local _target) then { + ["treatmentBasic_morphineLocal", [_target]] call EFUNC(common,localEvent); +} else { + ["treatmentBasic_morphineLocal", _target, [_target]] call EFUNC(common,targetEvent); +}; diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf index ebf33c75c7..29173fe23b 100644 --- a/addons/medical/functions/fnc_treatmentIV.sqf +++ b/addons/medical/functions/fnc_treatmentIV.sqf @@ -22,7 +22,12 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"]; 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 */ +if (local _target) then { + ["treatmentIVLocal", [_target, _className]] call EFUNC(common,localEvent); +} else { + ["treatmentIVLocal", _target, [_target, _className]] call EFUNC(common,targetEvent); +}; + [_target, _removeItem] call FUNC(addToTriageCard); [_target, "activity", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); [_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message diff --git a/addons/medical/functions/fnc_treatmentTourniquet.sqf b/addons/medical/functions/fnc_treatmentTourniquet.sqf index 1c5c9282db..b410a899a4 100644 --- a/addons/medical/functions/fnc_treatmentTourniquet.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquet.sqf @@ -40,7 +40,11 @@ if ((_tourniquets select _part) > 0) exitWith { }; _removeItem = _items select 0; -[[_target, _removeItem, _selectionName], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +if (local _target) then { + ["treatmentTourniquetLocal", [_target, _removeItem, _selectionName]] call EFUNC(common,localEvent); +} else { + ["treatmentTourniquetLocal", _target, [_target, _removeItem, _selectionName]] call EFUNC(common,targetEvent); +}; [_target, _removeItem] call FUNC(addToTriageCard); [_target, "activity", LSTRING(Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf index 4029721566..826443a154 100644 --- a/addons/medical/functions/fnc_treatment_failure.sqf +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -69,6 +69,7 @@ _callback = if (isNil _callback) then { } else { missionNamespace getVariable _callback }; +if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};}; _args call _callback; diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index 55ddfa394e..d8a4d3b336 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -64,6 +64,7 @@ if (isNil _callback) then { } else { _callback = missionNamespace getVariable _callback; }; +if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};}; //Get current blood loose on limb (for "bloody" litter) private _bloodLossOnSelection = 0; @@ -81,7 +82,7 @@ if ((GVAR(level) >= 2) && {([_target] call FUNC(hasMedicalEnabled))}) then { } else { //Basic Medical (just use blodyPartStatus): private _damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; - _bloodLossOnSelection = _damageBodyParts select _partNumber + _bloodLossOnSelection = _damageBodyParts select _partNumber; TRACE_1("basic",_bloodLossOnSelection); }; diff --git a/addons/medical/functions/fnc_unconsciousPFH.sqf b/addons/medical/functions/fnc_unconsciousPFH.sqf index 2922cae465..e78c80f3ec 100644 --- a/addons/medical/functions/fnc_unconsciousPFH.sqf +++ b/addons/medical/functions/fnc_unconsciousPFH.sqf @@ -33,7 +33,7 @@ if (!alive _unit) exitWith { if (GVAR(moveUnitsFromGroupOnUnconscious)) then { [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); }; - [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set); [_unit, false] call EFUNC(common,disableAI); //_unit setUnitPos _originalPos; _unit setUnconscious false; @@ -102,7 +102,7 @@ if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith { }; if (!_hasMovedOut) then { // Reset the unit back to the previous captive state. - [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set); // Swhich the unit back to its original group //Unconscious units shouldn't be put in another group #527: diff --git a/addons/medical/functions/fnc_useItem.sqf b/addons/medical/functions/fnc_useItem.sqf index 7abf80c464..71b5304c67 100644 --- a/addons/medical/functions/fnc_useItem.sqf +++ b/addons/medical/functions/fnc_useItem.sqf @@ -24,12 +24,20 @@ if (isNil QGVAR(setting_allowSharedEquipment)) then { }; if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith { - [[_patient, _item], QUOTE(EFUNC(common,useItem)), _patient] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + if (local _patient) then { + ["useItem", [_patient, _item]] call EFUNC(common,localEvent); + } else { + ["useItem", _patient, [_patient, _item]] call EFUNC(common,targetEvent); + }; [true, _patient]; }; if ([_medic, _item] call EFUNC(common,hasItem)) exitWith { - [[_medic, _item], QUOTE(EFUNC(common,useItem)), _medic] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + if (local _medic) then { + ["useItem", [_medic, _item]] call EFUNC(common,localEvent); + } else { + ["useItem", _medic, [_medic, _item]] call EFUNC(common,targetEvent); + }; [true, _medic]; }; @@ -39,7 +47,11 @@ if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic}) { if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitWith { _return = [true, _x]; - [[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + if (local _x) then { + ["useItem", [_x, _item]] call EFUNC(common,localEvent); + } else { + ["useItem", _x, [_x, _item]] call EFUNC(common,targetEvent); + }; }; } forEach _crew; }; diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index 939a811a41..0af2736f50 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT medical #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MEDICAL #define DEBUG_MODE_FULL #endif diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index a7aa423955..0bef2f15ff 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -14,15 +14,15 @@ FERIMENTOS - No injuries on this bodypart ... - Körperteil nicht verletzt ... - Non ci sono lesioni in questa parte del corpo ... - Данная часть тела не повреждена ... - Aucune blessures sur cette partie du corps ... - Brak obrażeń na tej części ciała ... - Sin heridas en esta parte del cuerpo ... - Ezen a testrészen nincs sérülés ... - Žádné zranění na této části těla ... + No injuries on this bodypart... + Körperteil nicht verletzt... + Non ci sono lesioni in questa parte del corpo... + Данная часть тела не повреждена... + Aucune blessures sur cette partie du corps... + Brak obrażeń na tej części ciała... + Sin heridas en esta parte del cuerpo... + Ezen a testrészen nincs sérülés... + Žádné zranění na této části těla... Nenhum ferimento nesta parte do corpo... @@ -42,13 +42,16 @@ Opcja ta ustawia liczbę zużytych medykamentów, jakie pojawiają się lokalnie wokół gracza. Ich zbyt duża ilość może spowodować spadki FPS, dlatego jest to ustawienie tylko po stronie klienta. Detalle simulación de basura establece el número de artículos de basura que se generan a nivel local en el cliente. Las cantidades excesivas en áreas locales podrían causar caída de rendimiento, así que esto es un ajuste de cliente únicamente. Устанавливает количество мусора, который появляется после использования мед. препаратов. Большое количество мусора может уменьшить производительность, поэтому данная настройка локальна для клиента. - Il livello di dettagli della simulazione dei rifiuti indica il numero di rifiuti che verranno creati localmente nel client. La creazione di troppi rifiuti in aree locali potrebbe causare lag e calo di FPS. Questo è un settaggio client. + Il numero di rifiuti che verranno creati localmente. La creazione di troppi rifiuti in aree locali potrebbe causare lag e calo di FPS. Questo è un settaggio lato client. Le niveau de simulation des détritus règle la quantité de déchets qui vont être créés localement chez le client. Des quantitées excessive chez certains clients peuvent causer des chutes de FPS, c'est donc une option client uniquement. Die Einstellung für das Abfall-Detaillevel stellt die Menge des lokal angezeigten medizinischen Abfalls ein. Zuviel Abfall kann FPS-Einbrüche erzeugen, weswegen diese Einstellung nur clientseitig ist. A hulladékszimuláció részletessége megszabja a kliens által megjelenített hulladékobjektumok mennyiségét. Súlyos mennyiségek izolált területeken alacsony FPS-t okozhatnak, így ez egy kliensoldali beállítás. O nível de detalhe de sujeira determina o número de itens que irão aparecer no cliente. Quantidades excessivas em áreas locais podem aumentar o lag do FPS, então esta é uma opção somente para o cliente. Počet zobrazených předmětů po použití zdravotnického materiálu ovlivňuje počet objektů, které budou zobrazeny klientovi v místě použití zdravotnického materiálu. Vyšší množství objektů může způsobovat poklesy FPS a proto je toto nastavení čistě na klientovi. + + Inject Adenosine + Inject Atropine Atropin injizieren @@ -71,7 +74,7 @@ Ввести адреналин Epinefrin beadása Injetar Epinefrina - Inietta epinefrina + Inietta adrenalina Inject Morphine @@ -106,14 +109,14 @@ Transfuser du Plasma Перелить плазму Infúzió (vérplazma) - Trasfusione di Plasma + Trasfusione di plasma Transfundir Plasma Transfuse Saline Salzlösungstransfusion Transfundir salino - Transfúze fyziologický roztoku + Transfúze fyziologického roztoku Przetocz sól fizjologiczną Transfuser de la solution saline Перелить физраствор @@ -218,104 +221,107 @@ Benda la gamba destra - Injecting Morphine ... - Morphin injizieren ... - Inyectando Morfina ... - Wstrzykiwanie morfiny ... - Aplikuji morfin ... - Введение морфина ... + Injecting Morphine... + Morphin injizieren... + Inyectando Morfina... + Wstrzykiwanie morfiny... + Aplikuji morfin... + Введение морфина... Injection de Morphine... - Morfium beadása ... - Injetando Morfina ... - Inietto la morfina ... + Morfium beadása... + Injetando Morfina... + Inietto la morfina... - Injecting Epinephrine ... - Epinephrin injizieren ... - Inyectando Epinefrina ... - Wstrzykiwanie adrenaliny ... - Aplikuji adrenalin ... - Введение адреналина ... - Injection d'Adrénaline ... - Epinefrin beadása ... - Injetando Epinefrina ... - Inietto l'epinefrina ... + Injecting Epinephrine... + Epinephrin injizieren... + Inyectando Epinefrina... + Wstrzykiwanie adrenaliny... + Aplikuji adrenalin... + Введение адреналина... + Injection d'Adrénaline... + Epinefrin beadása... + Injetando Epinefrina... + Inietto l'adrenalina... + + + Injecting Adenosine... - Injecting Atropine ... - Atropin injizieren ... - Inyectando Atropina ... - Aplikuji atropin ... - Wstrzykiwanie atropiny ... - Injection d'Atropine ... - Введение атропина ... - Atropin beadása ... - Inietto l'atropina ... + Injecting Atropine... + Atropin injizieren... + Inyectando Atropina... + Aplikuji atropin... + Wstrzykiwanie atropiny... + Injection d'Atropine... + Введение атропина... + Atropin beadása... + Inietto l'atropina... Injetando Atropina - Transfusing Blood ... - Bluttransfusion ... - Transfusión de sangre ... - Przetaczanie krwi ... - Probíhá transfúze krve ... - Переливание крови ... - Transfusion Sanguine ... - Infúzió vérrel ... - Transfundindo Sangue ... - Effettuo la trasfusione di sangue ... + Transfusing Blood... + Bluttransfusion... + Transfusión de sangre... + Przetaczanie krwi... + Probíhá transfúze krve... + Переливание крови... + Transfusion Sanguine... + Infúzió vérrel... + Transfundindo Sangue... + Effettuo la trasfusione di sangue... - Transfusing Saline ... - Salzlösungtransfusion ... - Transfusión de salino ... - Probíha transfúze fyziologický roztoku ... - Przetaczanie soli fizjologicznej ... - Transfusion de saline ... - Переливание физраствора ... - Infúzió sós vizzel ... + Transfusing Saline... + Salzlösungtransfusion... + Transfusión de salino... + Probíha transfúze fyziologického roztoku... + Przetaczanie soli fizjologicznej... + Transfusion de saline... + Переливание физраствора... + Infúzió sós vizzel... Effettuo la rasfusione di soluzione salina Transfundindo Soro... - Transfusing Plasma ... - Plasmatransfusion ... - Transfusión de plasma ... - Probíha transfúze plazmy ... - Przetaczanie osocza ... - Transfusion de Plasma ... - Переливание плазмы ... - Infúzió vérplazmával ... - Effettu la trasfusione di plasma ... + Transfusing Plasma... + Plasmatransfusion... + Transfusión de plasma... + Probíha transfúze plazmy... + Przetaczanie osocza... + Transfusion de Plasma... + Переливание плазмы... + Infúzió vérplazmával... + Effettu la trasfusione di plasma... Transfundindo Plasma... - Bandaging ... - Verbinden ... - Vendando ... - Bandażowanie ... - Obvazuji ... - Pansement ... - Sto applicando la benda ... - Bekötözés ... - Atando ... - Перевязывание ... + Bandaging... + Verbinden... + Vendando... + Bandażowanie... + Obvazuji... + Pansement... + Sto bendando... + Bekötözés... + Atando... + Перевязывание... - Applying Tourniquet ... - Setze Tourniquet an ... - Aplicando torniquete ... - Aplikuji škrtidlo - Zakładanie stazy ... - Mise en place du Garrot ... - Наложение жгута ... - Érszorító felhelyezése ... - Sto applicando il laccio emostatico ... + Applying Tourniquet... + Setze Tourniquet an... + Aplicando torniquete... + Aplikuji škrtidlo... + Zakładanie stazy... + Mise en place du Garrot... + Наложение жгута... + Érszorító felhelyezése... + Sto applicando il laccio emostatico... Applicando Torniquete Medical - Zdravotní + Lékařské Médical Sanitäter Medico @@ -378,7 +384,7 @@ Puls überprüfen Comprobar pulso Проверить пульс - Zkontrolovat pulz + Zkontrolovat puls Sprawdź tętno Vérifier le pouls Pulzus ellenőrzése @@ -458,15 +464,15 @@ Diagnosticar - Diagnosing ... - Diagnostizieren ... + Diagnosing... + Diagnostizieren... Diagnosi in corso... - Диагностика ... + Диагностика... Diagnostic en cours - Diagnozowanie ... - Diagnosticando ... + Diagnozowanie... + Diagnosticando... Diagnózis folyamatban... - Diagnostika ... + Diagnostika... Diagnosticando... @@ -478,19 +484,19 @@ RKO RCP Újraélesztés - KPR + CPR SBV - Performing CPR ... - HLW durchführen ... + Performing CPR... + HLW durchführen... Eseguendo RCP... - Сердечно-лёгочная реанимация ... + Сердечно-лёгочная реанимация... RPC en cours - Przeprowadzanie RKO ... - Realizando RCP ... + Przeprowadzanie RKO... + Realizando RCP... Újraélesztés folyamatban... - Provádím KPR ... + Provádím CPR... Realizando o SBV... @@ -502,7 +508,7 @@ Administrer du sang en IV (1000ml) Podat krev. transfúzi (1000ml) Vér adása intravénásan (1000ml) - Effettua trasfusione sangue IV (1000ml) + Effettua trasfusione sangue EV (1˙000ml) Administrar Sangue IV (1000ml) @@ -514,7 +520,7 @@ Administrer du sang en IV (500ml) Podat krev. transfúzi (500ml) Vér adása intravénásan (500ml) - Effettua trasfusione sangue IV (500ml) + Effettua trasfusione sangue EV (500ml) Administrar Sangue IV (500ml) @@ -526,7 +532,7 @@ Administrer du sang en IV (250ml) Podat krev. transfúzi (250ml) Vér adása intravénásan (250ml) - Effettua trasfusione sangue IV (250ml) + Effettua trasfusione sangue EV (250ml) Administrar Sangue IV (250ml) @@ -538,7 +544,7 @@ Administrer du plasma en IV (1000ml) Podat plazmu (1000ml) Vérplazma adása intravénásan (1000ml) - Effettua trasfusione plasma IV (1000ml) + Effettua trasfusione plasma EV (1˙000ml) Administrar Plasma IV (1000ml) @@ -550,7 +556,7 @@ Administrer du plasma en IV (500ml) Podat plazmu (500ml) Vérplazma adása intravénásan (500ml) - Effettua trasfusione plasma IV (500ml) + Effettua trasfusione plasma EV (500ml) Administrar Plasma IV (500ml) @@ -562,7 +568,7 @@ Administrer du plasma en IV (250ml) Podat plazmu (250ml) Vérplazma adása intravénásan (250ml) - Effettua trasfusione plasma IV (250ml) + Effettua trasfusione plasma EV (250ml) Administrar Plasma IV (250ml) @@ -574,7 +580,7 @@ Administrer de la solution saline en IV (1000ml) Podaz fyz. roztok (1000ml) Sós víz adása intravénásan (1000ml) - Effettua trasfusione salina IV (1000ml) + Effettua trasfusione salina EV (1˙000ml) Administrar Soro IV (1000ml) @@ -586,7 +592,7 @@ Administrer de la solution saline en IV (500ml) Podaz fyz. roztok (500ml) Sós víz adása intravénásan (500ml) - Effettua trasfusione salina IV (500ml) + Effettua trasfusione salina EV (500ml) Administrar Soro IV (500ml) @@ -598,7 +604,7 @@ Administrer de la solution saline en IV (250ml) Podaz fyz. roztok (250ml) Sós víz adása intravénásan (250ml) - Effettua trasfusione salina IV (250ml) + Effettua trasfusione salina EV (250ml) Administrar Soro IV (250ml) @@ -766,7 +772,7 @@ Transfusion en IV [%1ml] Přijímání transfúze [%1ml] Infúzióra kötve [%1ml] - Ricevendo IV [%1ml] + Ricevendo EV [%1ml] Recebendo IV [%1ml] @@ -776,7 +782,7 @@ Vendaje (Básico) Bandage (Standard) Bandaż (jałowy) - Obvaz (standartní) + Obvaz (Standartní) Kötszer (Általános) Bendaggio (base) Bandagem(Básico) @@ -949,6 +955,15 @@ Um analgésico usado para combater dores moderadas e fortes. Analgetikum slouží k tlumení středně těžkých a těžkých bolestí + + Adenosine autoinjector + + + Used to counter effects of Epinephrine + + + A drug used to counter the effects of Epinephrine + Atropine autoinjector Атропин в пневмошприце @@ -994,7 +1009,7 @@ Epiniphrin-Autoinjektor Autoinjektor adrenalin Epinefrin autoinjektor - Autoiniettore di epinefrina + Autoiniettore di adrenalina Auto-injetor de epinefrina @@ -1029,7 +1044,7 @@ Osocze IV (1000ml) Plasma IV (1000ml) Vérplazma-infúzió (1000ml) - Plasma IV (1000ml) + Plasma EV (1000ml) Plasma IV (1000ml) Krevní plazma (1000ml) @@ -1065,7 +1080,7 @@ Osocze IV (500ml) Plasma IV (500ml) Vérplazma-infúzió (500ml) - Plasma IV (500ml) + Plasma EV (500ml) Plasma IV (500ml) Krevní plazma (500ml) @@ -1077,7 +1092,7 @@ Osocze IV (250ml) Plasma IV (250ml) Vérplazma-infúzió (250ml) - Plasma IV (250ml) + Plasma EV (250ml) Plasma IV (250ml) Krevní plazma (250ml) @@ -1089,7 +1104,7 @@ Krew IV (1000ml) Blut IV (1000ml) Vér-infúzió (1000ml) - Sangue IV (1000ml) + Sangue EV (1000ml) Sangue IV (1000ml) Krevní transfúze (1000ml) @@ -1125,7 +1140,7 @@ Krew IV (500ml) Blut IV (500ml) Vér-infúzió (500ml) - Sangue IV (500ml) + Sangue EV (500ml) Sangue IV (500ml) Krevní transfúze (500ml) @@ -1137,7 +1152,7 @@ Krew IV (250ml) Blut IV (250ml) Vér-infúzió (250ml) - Samgue IV (250ml) + Sangue EV (250ml) Sangue IV (250ml) Krevní transfúze (250ml) @@ -1149,7 +1164,7 @@ Sól fizjologiczna IV (1000ml) Kochsalzlösung (1000ml) 0,9%-os sósvíz-infúzió (1000ml) - Soluzione salina IV (1000ml) + Soluzione salina EV (1˙000ml) Soro IV (1000ml) Fyziologický roztok (1000ml) @@ -1172,7 +1187,7 @@ Un remplacant temporaire pour rétablir la tension artérielle lors de perte sanguine, administré par intra-veineuse 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). Egy orvosi térfogat-helyreállító készítmény, melyet intravénás módon lehet a szervezetbe juttatni. - Una soluzione medica per ripristinare il volume del sangue introdotta tramite trasfusione IV. + Una soluzione medica per ripristinare il volume del sangue introdotta tramite trasfusione EV. Ein medizinisches Volumenersatzmittel, dass durch einen intravenösen Zugang in den Blutkreislauf verabreicht wird. Uma reposição temporaria para restaurar a pressão arterial perdida por perda de sangue. Fyziologický roztok se využívá nejčastěji jako infuze při dehydrataci organismu. @@ -1185,7 +1200,7 @@ Sól fizjologiczna IV (500ml) Kochsalzlösung (500ml) 0,9%-os sósvíz-infúzió (500ml) - Soluzione salina IV (500ml) + Soluzione salina EV (500ml) Soro IV (1000ml) Fyziologický roztok (500ml) @@ -1197,7 +1212,7 @@ Sól fizjologiczna IV (250ml) Kochsalzlösung (250ml) 0,9%-os sósvíz-infúzió (250ml) - Soluzione salina IV (250ml) + Soluzione salina EV (250ml) Soro IV (1000ml) Fyziologický roztok (250ml) @@ -1383,15 +1398,15 @@ Checking Blood Pressure.. - Mesure de la tension ... - Проверка артериального давления ... + Mesure de la tension... + Проверка артериального давления... Comprobando presión arterial... Sprawdzanie ciśnienia krwi... Blutdruck kontrollieren... Vérnyomás megmérése... Controllando la pressione sanguigna.. Aferindo Pressão Arterial... - Kontroluji krevní tlak ... + Kontroluji krevní tlak... %1 checked Blood Pressure: %2 @@ -1492,7 +1507,7 @@ Low Niedrig - Basso + Bassa Низкое Faible Niskie @@ -1516,7 +1531,7 @@ High Hoch - Alto + Alta Высокое Haute Wysokie @@ -1550,16 +1565,16 @@ Tep - Checking Heart Rate ... - Vérification du rythme cardiaque ... - Проверка пульса ... - Comprobando ritmo cardíaco ... - Sprawdzanie tętna ... - Kontrolliere Herzfrequenz ... + Checking Heart Rate... + Vérification du rythme cardiaque... + Проверка пульса... + Comprobando ritmo cardíaco... + Sprawdzanie tętna... + Kontrolliere Herzfrequenz... Szívverés-szám mérése... - Controllando il battito cardiaco ... - Aferindo Pulso ... - Kontroluji srdeční tep ... + Controllando il battito cardiaco... + Aferindo Pulso... + Kontroluji srdeční tep... You checked %1 @@ -1595,6 +1610,7 @@ Nada Aucun Nincs + Niente Weak @@ -1713,7 +1729,7 @@ Du prüfst ob der Patient ansprechbar ist Ellenőrzöd a páciens reagálóképességét Controlli la risposta del paziente - Aferindo se o paciente tem reação... + Aferindo se o paciente tem reação Zkontroloval jsi reakci pacienta @@ -1754,7 +1770,7 @@ Patient %1<br/>is %2.<br/>%3.<br/>%4 - Paziente %1<br/>è %2.<br/>%3.<br/>%4 + Il paziente %1<br/>è %2.<br/>%3.<br/>%4 Пациент %1<br/>%2.<br/>%3.<br/>%4 Patient %1<br/>ist %2.<br/>%3.<br/>%4 Patient %1<br/>est %2.<br/>%3.<br/> @@ -1766,7 +1782,7 @@ alive - Vivo + vivo жив lebendig vivant @@ -1778,7 +1794,7 @@ dead - Morto + morto мёртв muerto tot @@ -1790,7 +1806,7 @@ He's lost some blood - Ha perso sangue + Ha perso poco sangue Ha perdido un poco de sangre Есть кровопотеря Er hat etwas Blut verloren @@ -1826,7 +1842,7 @@ He is in pain - è affetto da dolore + Sente dolori Испытывает боль Er hat Schmerzen Il souffre @@ -1838,7 +1854,7 @@ He is not in pain - Non è affetto da dolore + Non sente dolori Не испытывает боли Er hat keine Schmerzen Il ne souffre pas @@ -1905,7 +1921,7 @@ Szycie Összevarrás Suturando - Suturando... + Suturando Šití @@ -2041,16 +2057,16 @@ Umístni tělo do pytle na mrtvoly - Placing body in bodybag - Colocando cuerpo en bolsa para cadáveres - Упаковка тела ... - Körper wird in Leichensack gepackt - 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 + Placing body in bodybag... + Colocando cuerpo en bolsa para cadáveres... + Упаковка тела... + Körper wird in Leichensack gepackt... + 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... Colocando corpo dentro do saco para cadáver... - Umístňuji tělo do pytle na mrtvoly + Umístňuji tělo do pytle na mrtvoly... %1 has bandaged patient @@ -2064,6 +2080,9 @@ %1 aplicou bandagem no paciente %1 již obvázal pacienta + + %1 started CPR + %1 used %2 %1 usó %2 @@ -2084,7 +2103,7 @@ %1 podał IV %1 a administré une IV %1 infúziót adott - %1 ha somministrato una IV + %1 ha somministrato una EV %1 aplicou um intravenoso %1 již aplikoval IV @@ -2108,6 +2127,7 @@ %1 realicó RCP %1 realizou RCP %1 provádí CPR + %1 ha eseguito CPR %1 used Personal Aid Kit @@ -2116,6 +2136,7 @@ %1 utilizou KPS %1 používá PAK %1 использовал аптечку + %1 ha usato Kit Pronto Soccorso Personale Heavily wounded @@ -2231,6 +2252,8 @@ Curar miembros totalmente vendados Исцелять полностью перебинтованные части тела Curar hitpoints totalmente enfaixados + Heal fully bandaged hitpoints + Cura hitpoints completamente bendati Pain is only temporarily suppressed @@ -2242,6 +2265,7 @@ La douleur est seulement supprimée temporairement A fájdalom csak ideiglenesen csökken Боль приглушается только временно + Dolore è soppresso solo temporaneamente Pain Effect Type @@ -2301,7 +2325,7 @@ Selecione o tipo de menu que você prefere; padrão seleções 3d ou radial. Válaszd ki a neked megfelelő menüt: Alapértelmezett 3D válogatás, vagy kerek. Zvolte typ menu: základní 3D výběr nebo kruhový - Seleziona il tipo di menù che preferisci: selezione 3d predefinita o radiale. + Seleziona il tipo di menù che preferisci: selezione (3D), radiale o disabilitata. Selections (3d) @@ -2724,28 +2748,28 @@ Zlomená stehenní kost - Treating ... - Behandeln ... - Ellátás ... - Opatrywanie ran ... - Traitement ... - Лечение ... - Tratando ... + Treating... + Behandeln... + Ellátás... + Opatrywanie ran... + Traitement... + Лечение... + Tratando... Tratando... - Ošetřuji ... - Curando ... + Ošetřuji... + Curando... - Removing Tourniquet ... - Tourniquet entfernen ... - Zdejmowanie stazy ... - Quitando torniquete ... - Retire le tourniquet ... + Removing Tourniquet... + Tourniquet entfernen... + Zdejmowanie stazy... + Quitando torniquete... + Retire le tourniquet... Removendo torniquete... - Érszorító eltávolítása ... - Sundavám škrtidlo ... - Снятие жгута ... - Togliendo il laccio emostatico ... + Érszorító eltávolítása... + Sundavám škrtidlo... + Снятие жгута... + Togliendo il laccio emostatico... ACE Medical @@ -2757,6 +2781,7 @@ ACE Médico ACE Médical ACE Orvosi Rendszer + ACE Medical Medical Settings [ACE] @@ -2768,6 +2793,7 @@ Ajustes médicos [ACE] Option médicale [ACE] Orvosi beállítások [ACE] + Impostazioni Mediche [ACE] Medical Level @@ -2779,6 +2805,7 @@ Nível médico Niveau de simulation médicale Orvosi szint + Livello Medico What is the medical simulation level? @@ -2790,6 +2817,7 @@ Qual o nível de simulação médica? Quel niveau de simulation médicale choisissez vous? Milyen komplex legyen az orvosi szimuláció? + Qual'è il livello di simulazione medica? Basic @@ -2801,6 +2829,7 @@ Básica Basique Alap + Basico Advanced @@ -2812,6 +2841,7 @@ Avançada Avancée Fejlett + Avanzato Medics setting @@ -2823,6 +2853,7 @@ Configuração médica Paramètre des infirmiers Orvosok beállítása + Parametri Medici What is the level of detail prefered for medics? @@ -2834,6 +2865,17 @@ 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? + Qual'è il livello di dettagli preferito per i medici? + + + Locations boost training + Místa pro vylepšení zkušeností + Località aumentano addestramento + + + Boost medic rating in medical vehicles or near medical facilities [untrained becomes medic, medic becomes doctor] + Zlepšit zkušenosti zdravotníka v medickém vozidle nebo poblíž zdravotního zařízení [nezkušení se stane zdravotníkem, zdravotník se stane doktorem] + Aumenta il rating medico in veicoli medici o vicino strutture mediche [non addestrato diventa medico, medico diventa dottore] Disable medics @@ -2845,6 +2887,7 @@ Desativar médicos Désactiver les infirmiers Orvosok letiltása + Disabilita medici Enable Litter @@ -2856,6 +2899,7 @@ Ativar lixo médico Activer les détritus Szemét engedélyezése + Abilita Barella Enable litter being created upon treatment @@ -2867,6 +2911,7 @@ 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 + Abilita la creazione della barella dopo trattamento Life time of litter objects @@ -2878,6 +2923,7 @@ Tempo de vida dos objetos do lixo Durée d'affichage des détritus Szemétobjektumok élettartama + Tempo di vita delle barelle How long should litter objects stay? In seconds. -1 is forever. @@ -2889,6 +2935,7 @@ 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. + Per quanto devono restare le barelle? In secondi. -1 è permanente Enable Screams @@ -2900,6 +2947,7 @@ Ativar gritos Activer les hurlements Kiáltások engedélyezése + Abilita Grida Enable screaming by injuried units @@ -2911,6 +2959,7 @@ Ativa gritos para unidades feridas Active les hurlements d'unités blessées Engedélyezi a sérült egységek kiáltásait + Abilita Grida da parte delle unità ferite Player Damage @@ -2922,6 +2971,7 @@ Dano do jogador Dégats des joueurs Játékos sérülés + Danno Giocatore What is the damage a player can take before being killed? @@ -2933,6 +2983,7 @@ 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? + Quanto è il danno che un giocatore può sostenere prima di essere ucciso? AI Damage @@ -2944,6 +2995,7 @@ Dano da IA Dégats des IA AI sérülés + Danno AI What is the damage an AI can take before being killed? @@ -2955,6 +3007,7 @@ 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? + Quanto è il danno che un'IA può sostenere prima di essere uccisa? AI Unconsciousness @@ -2966,6 +3019,7 @@ Inconsciência da IA Inconscience des IA AI eszméletlenség + Incoscienza IA Allow AI to go unconscious @@ -2977,6 +3031,7 @@ Permite IA ficar inconsciente Autoriser les IA à tomber inconsciente Engedélyezi az AI eszméletének elvesztését + Permetti alle IA di diventare incoscienti Remote Controlled AI @@ -2988,6 +3043,7 @@ Contrôle à distance des IA Távvezérelt AI Зевса считать ботом + IA Controllate in Remoto Treat remote controlled units as AI not players? @@ -2999,6 +3055,7 @@ 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? Обрабатывать дистанционно управляемых юнитов как ботов, а не как игроков? + Considera le unità controllate in remoto come IA e non come giocatori? Prevent instant death @@ -3010,6 +3067,7 @@ Previnir morte instantânea Empêcher la morte instantanée Azonnali halál kiiktatása + Previeni morte istantanea Have a unit move to unconscious instead of death @@ -3021,6 +3079,7 @@ 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 + Imposta un'unità come incosciente invece di morta Bleeding coefficient @@ -3032,6 +3091,7 @@ Coeficiente de sangramento Coefficient de saignement Vérzési koefficiens + Coefficiente sanguinamento Coefficient to modify the bleeding speed @@ -3043,6 +3103,7 @@ 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 + Coefficiente che modifica la velocità di sanguinamento Pain coefficient @@ -3054,6 +3115,7 @@ Coeficiente de dor Coefficient de douleur Fájdalmi koefficiens + Coefficiente dolore Coefficient to modify the pain intensity @@ -3065,6 +3127,7 @@ 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 + Coefficiente che modifica l'intensità del dolore Sync status @@ -3076,6 +3139,7 @@ Sincronizar estado Status de la synchronisation Szinkronizációs állapot + Sincronizza stato Keep unit status synced. Recommended on. @@ -3087,6 +3151,7 @@ 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. + Mantieni lo stato delle unità sincronizzato. Consigliato attivo. Provides a medical system for both players and AI. @@ -3098,6 +3163,10 @@ 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. + Fornisce un sistema medico sia per giocatori che IA. + + + Basic Medical Settings [ACE] Advanced Medical Settings [ACE] @@ -3109,6 +3178,7 @@ Ajustes médicos avançados [ACE] Paramètres des soins avancés Fejlett orvosi beállítások [ACE] + Impostazioni Mediche Avanzate [ACE] Enabled for @@ -3119,7 +3189,8 @@ Povoleno pro Habilitado para Activer pour - Engedélyezve... + Engedélyezve + Abilitato per Select what units the advanced medical system will be enabled for @@ -3131,6 +3202,7 @@ 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 + Seleziona per quali unità verrà abilitato i sistema medico avanzato Players only @@ -3142,6 +3214,7 @@ Somente jogadores Joueur uniquement Csak játékosok + Solo giocatori Players and AI @@ -3153,6 +3226,7 @@ Jogadores e IA Joueur et IA Játékosok és AI + Giocatori ed IA Enable Advanced wounds @@ -3164,6 +3238,7 @@ Ativar ferimentos avançados Activer les blessures avancées Komplex sebek engedélyezése + Abilita ferite Avanzate Allow reopening of bandaged wounds? @@ -3175,6 +3250,7 @@ Permitr reabertura de ferimentos enfaixados? Permettre la réouverture des bandages Visszanyílhatnak a bekötözött sebek? + Permetti la riapertura di ferite bendate? Vehicle Crashes @@ -3186,6 +3262,7 @@ Batidas de veículos Accident en véhicule Járműbalesetek + Schianto Veicoli Do units take damage from a vehicle crash? @@ -3197,6 +3274,13 @@ 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? + Le unità sostengono danni da incidenti con veicoli? + + + Allow Epinephrine + + + Who can use Epinephrine for full heal? (Basic medical only) Allow PAK @@ -3208,6 +3292,7 @@ Permitir Kit de Primeiros Socorros Permettre le kit de premier secours Elsősegélycsomag engedélyezése + Consenti Kit di Pronto Soccorso Who can use the PAK for full heal? @@ -3219,6 +3304,7 @@ 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? + Chi può usare il KPS per cura completa? Anyone @@ -3230,6 +3316,7 @@ Qualquer um Tout le monde Akárki + Chiunque Medics only @@ -3241,6 +3328,7 @@ Somente médicos Infirmier uniquement Csak orvosok + Solo medici Doctors only @@ -3252,6 +3340,7 @@ Somente doutores Médecin uniquement Csak doktorok + Solo dottori Remove PAK on use @@ -3263,6 +3352,7 @@ Remover o KPS depois do uso Enlever le KPS à l'utilisation Elsősegélycsomag eltávolítása használatkor + Rimuovi Kit Pronto Soccorso dopo l'uso Should PAK be removed on usage? @@ -3274,6 +3364,13 @@ 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? + Il Kit Pronto Soccorso dev'essere rimosso dopo l'utilizzo? + + + Locations Epinephrine + + + Where can the Epinephrine be used? (Basic Medical) Locations PAK @@ -3285,6 +3382,7 @@ Localizações do KPS Lieu d'utilisation du KPS Elsősegélycsomag helyek + Locazioni Kit Pronto Soccorso Where can the PAK be used? @@ -3296,6 +3394,7 @@ 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? + Dove può essere usato il Kit Pronto Soccorso? Condition PAK @@ -3307,6 +3406,7 @@ Elsősegélycsomag állapot Condição do KPS Условие использования аптечки + Condizioni Kit Pronto Soccorso When can the PAK be used? @@ -3318,6 +3418,7 @@ Mikor lehet az elsősegélycsomagot használni? Onde o kit de primeiros socorros pode ser utilizado? Когда может использоваться аптечка? + Quando può essere usato il Kit Pronto Soccorso? Anywhere @@ -3325,10 +3426,11 @@ Wszędzie Donde sea Überall - Kdekoliv + Kdekoli Qualquer lugar PArtout Akárhol + Ovunque Medical vehicles @@ -3340,6 +3442,7 @@ Veículos médcos Dans les véhicules médicals Orvosi járművek + Veicoli medici Medical facility @@ -3351,6 +3454,7 @@ Instalação médica Dans les installations médicales Orvosi létesítmény + Strutture mediche Vehicles & facility @@ -3362,6 +3466,7 @@ Veículos e instalações Dans les véhicules et les installations médicals Járművek & létesítmény + Veicoli e Strutture Allow Surgical Kit (Adv) @@ -3373,6 +3478,7 @@ Permite kit cirúrgico (avançado) Permettre les kit de chirurgie (Avancé) Sebészkészlet (Fejlett) engedélyezése + Permetti Kit Chirurgico (Avanzato) Who can use the Surgical Kit? @@ -3384,6 +3490,7 @@ Quem pode usar o kit cirúrgico? Qui peut utiliser les kit de chirurgie Ki használhatja a sebészkészletet? + Chi può usare il Kit Chirurgico? Remove Surgical Kit (Adv) @@ -3395,6 +3502,7 @@ Remover kit cirúrgico (avançado) Supprimer les kit de chirurgie (Avancé) Sebészkészlet (Fejlett) eltávolítása + Rimuovi Kit Chirurgico (Avanzato) Should Surgical kit be removed on usage? @@ -3406,6 +3514,7 @@ 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? + Il Kit Chirurgico dev'essere rimosso dopo l'uso? Locations Surgical Kit (Adv) @@ -3417,6 +3526,7 @@ Localizações do kit cirúrgico (avançado) Lieu d'utilisation du kit de chirurgie Sebészkészlet (Fejlett) helyei + Località Kit Chirurgico (Avanzato) Where can the Surgical Kit be used? @@ -3428,6 +3538,7 @@ Onde o kit cirúrgico pode ser utilizado? Où peut être utilisé les kit de chirurgie Hol lehet a sebészkészletet használni? + Dove può essere usato il Kit Chirurgico? Condition Surgical Kit (Adv) @@ -3439,6 +3550,7 @@ Sebészkészlet állapot Condição do Kit Cirúrgico (Avançado) Условие использования хирургического набора (усл.) + Condizioni Kit Chirurgico (Avanzato) When can the Surgical Kit be used? @@ -3450,6 +3562,7 @@ Mikor lehet a sebészkészletet használni? Onde o kit cirúrgico pode ser utilizado? Когда может использоваться хирургический набор? + Quando può essere usato il Kit Chirurgico? Heal hitpoints @@ -3458,6 +3571,8 @@ Curar puntos de vida Исцелять части тела Curar hitpoints + Léčit hitponty + Cura Hitpoints Heal fully bandaged hitpoints @@ -3466,6 +3581,8 @@ Curar miembros totalmente vendados Исцелять полностью перебинтованные части тела Curar totalmente hitpoints enfaixados + Heal fully bandaged hitpoints + Cura Hitpoints completamente bendati Pain suppression @@ -3477,6 +3594,7 @@ Suppression de la douleur Fájdalomcsillapítás Приглушение боли + Soppressione dolore Pain is only temporarily suppressed, not removed @@ -3488,9 +3606,13 @@ La douleur est temporairement supprimée, pas enlevée A fájdalom csak ideiglenesen csökken, nem távolítódik el Боль приглушается только временно + Dolore è solo temporaneamente soppresso, non rimosso + + + Configure the treatment settings from ACE Basic Medical - Configure the treatment settings from ACE Medical + Configure the treatment settings from ACE Advanced Medical Настройка лечения в медицинской системе ACE Skonfiguruj zaawansowane ustawienia leczenia systemu medycznego ACE Configure las opciones de tratamiento del ACE Médico @@ -3499,6 +3621,7 @@ 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 + Configura le impostazioni trattamenti per ACE Medical Revive Settings [ACE] @@ -3510,6 +3633,7 @@ Sistema de reavivamento [ACE] Paramètre du revive [ACE] Újraélesztés beállításai [ACE] + Impostazioni Revive [ACE] Enable Revive @@ -3521,6 +3645,7 @@ Habilitar reavivamento Activer le revive Újraélesztés engedélyezése + Abilita Revive Enable a basic revive system @@ -3532,6 +3657,7 @@ Habilitar um sistema básico de reavivamento Active un sytème de revive basique Egy alap újraélesztési rendszer engedélyezése + Abilita un sistema revive basico Max Revive time @@ -3543,6 +3669,7 @@ Tempo máximo de reavivamento Temps maximum pour le revive Maximum újraélesztési idő + Tempo massimo Revive Max amount of seconds a unit can spend in revive state @@ -3554,6 +3681,7 @@ 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 + Numero massimo di secondi che un'unità può spendere in stato revive Max Revive lives @@ -3565,6 +3693,7 @@ Vidas máximas do reavivado Nombre maximum de revive Maximum újraélesztési lehetőségek + Numero massimo Revives Max amount of lives a unit. 0 or -1 is disabled. @@ -3576,6 +3705,7 @@ 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. + Numero massimo di vite di un'unità. 0 o -1 per disabilitare. Provides a medical system for both players and AI. @@ -3587,6 +3717,7 @@ 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. + Fornisce un sistema medico sia per giocatori che IA Set Medic Class [ACE] @@ -3598,6 +3729,7 @@ Definir classe médica [ACE] Définir comme unité médicale [ACE] Orvos beállítása [ACE] + Imposta Classe Medico [ACE] List @@ -3609,6 +3741,7 @@ Lista Liste Lista + Lista List of unit names that will be classified as medic, separated by commas. @@ -3620,6 +3753,7 @@ 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. + Lista di nomi unità che verranno classificati come medici, separati da virgole. Is Medic @@ -3631,6 +3765,7 @@ É médico Est infirmier Orvos-e + E' Medico This module allows you to assign the medic class to selected units. @@ -3642,6 +3777,7 @@ 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. + Questo modulo ti permette di assegnare la classe Medico alle unità selezionate. None @@ -3653,6 +3789,7 @@ Nada Aucun Nincs + Nessuno Regular medic @@ -3664,6 +3801,7 @@ Médico regular Infirmier standard Hagyományos orvos + Medico Regolare Doctor (Only Advanced Medics) @@ -3675,6 +3813,7 @@ Doutor (Somente médicos avançados) Médecin (traitements avancés uniquement) Doktor (csak fejlett orvosok) + Dottore (Solo Medici Avanzati) Assigns the ACE medic class to a unit @@ -3686,6 +3825,7 @@ 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 + Assegna la classe medico ACE ad un'unità Set Medical Vehicle [ACE] @@ -3697,6 +3837,7 @@ Definir veículo médico [ACE] Définir comme véhicule médical [ACE] Orvosi jármű beállítása [ACE] + Imposta Veicolo Medico [ACE] List @@ -3708,6 +3849,7 @@ Lista Liste Lista + Lista List of vehicles that will be classified as medical vehicle, separated by commas. @@ -3719,6 +3861,7 @@ 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. + Lista di veicoli che verranno classificati come veicoli medici, separati da virgole. Is Medical Vehicle @@ -3726,10 +3869,11 @@ Jest pojazdem med. Es vehículo médico Ist medizinisches Fahrzeug - Je zdravotnické vozidlo + Zdravotnické vozidlo É um veículo médico Véhicule médical Orvosi jármű-e + E' Veicolo Medico Whatever or not the objects in the list will be a medical vehicle. @@ -3741,6 +3885,7 @@ 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. + Gli oggetti nella lista verranno considerati veicoli medici o meno. Assigns the ACE medic class to a unit @@ -3752,6 +3897,7 @@ 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 + Assegna la classe medico ACE ad un'unità Set Medical Facility [ACE] @@ -3763,6 +3909,7 @@ Definir instalação médica [ACE] Définir comme équipement médical [ACE] Orvosi létesítmény beállítása [ACE] + Imposta Struttura Medica [ACE] Is Medical Facility @@ -3770,10 +3917,11 @@ Jest budynkiem med. Es centro médico Ist eine medizinische Einrichtung - Je zdravotnické zařízení + Zdravotnické zařízení É uma instalação médica Est un équipement médical Orvosi létesítmény-e + E' Struttura Medica Registers an object as a medical facility @@ -3785,6 +3933,7 @@ 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 + Registra un oggetto come struttura medica Defines an object as a medical facility. This allows for more advanced treatments. Can be used on buildings and vehicles. @@ -3796,6 +3945,7 @@ 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. + Definisce un oggetto come struttura medica. Questo permette cure più avanzate. Può essere usato su edifici e veicoli. [ACE] Medical Supply Crate (Basic) @@ -3807,6 +3957,7 @@ [ACE] Caixa com suprimentos médicos [ACE] Caisse médicale (basique) [ACE] Orvosi láda (Alap) + [ACE] Cassa Rifornimenti Medici (Basico) [ACE] Medical Supply Crate (Advanced) @@ -3818,17 +3969,19 @@ [ACE] Caixa com suprimentos médicos (Avançados) [ACE] Caisse médicale (avancée) [ACE] Orvosi láda (Fejlett) + [ACE] Cassa Rifornimenti Medici (Avanzato) Anytime Jederzeit - Kdykoli + Kdykoliv Siempre Tout le temps Zawsze Akármikor Sempre В любое время + Sempre Stable @@ -3840,6 +3993,7 @@ Stabil Estável После стабилизации + Stabile Medical @@ -3861,6 +4015,7 @@ A distância de %1 está muito longe para tratamento La distancia hasta %1 se ha agrandado demasiado para el tratamiento %1 je příliš daleko, léčba není možná + Distanza da %1 è diventata troppo alta per permettere trattamento This person (%1) is awake and cannot be loaded @@ -3870,6 +4025,7 @@ Боец (%1) в сознании и не может быть погружен Esta pessoa (%1) está acordada e não pode ser carregada Tato osoba (%1) je vzhůru a nemůže být naložena + Questa persona (%1) è sveglia e non può essere caricata. There is no tourniquet on this body part! @@ -3879,6 +4035,17 @@ Нет жгута на этой части тела! Não existe nenhum torniquete nesta parte do corpo! Žádné škrtidlo na této části těla! + Non c'è nessun laccio emostatico su questa parte del corpo! + + + Medical training + Wyszkolenie medyczne + Addestramento Medico + + + Whether or not the object will be a medical vehicle. + Czy pojazdy ma być pojazdem medycznym? + L'oggetto in questione sarà un veicolo medico o meno. Todo diff --git a/addons/medical/ui/items/adenosine_x_ca.paa b/addons/medical/ui/items/adenosine_x_ca.paa new file mode 100644 index 0000000000..49b79e99e5 Binary files /dev/null and b/addons/medical/ui/items/adenosine_x_ca.paa differ diff --git a/addons/medical_menu/CfgEventHandlers.hpp b/addons/medical_menu/CfgEventHandlers.hpp index 7392999c9a..da45b1d12e 100644 --- a/addons/medical_menu/CfgEventHandlers.hpp +++ b/addons/medical_menu/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/medical_menu/XEH_PREP.hpp b/addons/medical_menu/XEH_PREP.hpp new file mode 100644 index 0000000000..8a44bd2bdc --- /dev/null +++ b/addons/medical_menu/XEH_PREP.hpp @@ -0,0 +1,18 @@ + +PREP(onMenuOpen); +PREP(onMenuClose); +PREP(openMenu); + +PREP(canOpenMenu); +PREP(updateIcons); +PREP(updateUIInfo); +PREP(handleUI_DisplayOptions); +PREP(handleUI_dropDownTriageCard); +PREP(getTreatmentOptions); +PREP(updateActivityLog); +PREP(updateQuickViewLog); +PREP(updateBodyImage); +PREP(updateInformationLists); +PREP(setTriageStatus); +PREP(collectActions); +PREP(module); diff --git a/addons/medical_menu/XEH_preInit.sqf b/addons/medical_menu/XEH_preInit.sqf index 65ac88e245..009a9ed1a6 100644 --- a/addons/medical_menu/XEH_preInit.sqf +++ b/addons/medical_menu/XEH_preInit.sqf @@ -2,23 +2,7 @@ ADDON = false; -PREP(onMenuOpen); -PREP(onMenuClose); -PREP(openMenu); - -PREP(canOpenMenu); -PREP(updateIcons); -PREP(updateUIInfo); -PREP(handleUI_DisplayOptions); -PREP(handleUI_dropDownTriageCard); -PREP(getTreatmentOptions); -PREP(updateActivityLog); -PREP(updateQuickViewLog); -PREP(updateBodyImage); -PREP(updateInformationLists); -PREP(setTriageStatus); -PREP(collectActions); -PREP(module); +#include "XEH_PREP.hpp" GVAR(INTERACTION_TARGET) = objNull; GVAR(actionsOther) = []; diff --git a/addons/medical_menu/XEH_preStart.sqf b/addons/medical_menu/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/medical_menu/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/medical_menu/functions/fnc_updateUIInfo.sqf b/addons/medical_menu/functions/fnc_updateUIInfo.sqf index 412a2045e6..e36315bd08 100644 --- a/addons/medical_menu/functions/fnc_updateUIInfo.sqf +++ b/addons/medical_menu/functions/fnc_updateUIInfo.sqf @@ -76,7 +76,7 @@ if ((EGVAR(medical,level) >= 2) && {([_target] call EFUNC(medical,hasMedicalEnab // 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", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]]; + _allInjuryTexts pushBack [format["%2x %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, ceil _amountOf], [1,1,1,1]]; } else { // TODO localization _allInjuryTexts pushBack [format["Partial %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6], [1,1,1,1]]; @@ -97,7 +97,7 @@ if ((EGVAR(medical,level) >= 2) && {([_target] call EFUNC(medical,hasMedicalEnab if (_amountOf > 0) then { if (_amountOf >= 1) then { // TODO localization - _allInjuryTexts pushBack [format ["[B] %2x %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [0.88,0.7,0.65,1]]; + _allInjuryTexts pushBack [format ["[B] %2x %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, ceil _amountOf], [0.88,0.7,0.65,1]]; } else { // TODO localization _allInjuryTexts pushBack [format ["[B] Partial %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6], [0.88,0.7,0.65,1]]; diff --git a/addons/medical_menu/script_component.hpp b/addons/medical_menu/script_component.hpp index 3119d48e19..afa50c04f3 100644 --- a/addons/medical_menu/script_component.hpp +++ b/addons/medical_menu/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT medical_menu #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MEDICAL_MENU #define DEBUG_MODE_FULL #endif diff --git a/addons/medical_menu/stringtable.xml b/addons/medical_menu/stringtable.xml index 619cfb8507..5cffb1c8ce 100644 --- a/addons/medical_menu/stringtable.xml +++ b/addons/medical_menu/stringtable.xml @@ -9,6 +9,7 @@ Медицинское меню Menú médico Zdravotnikcá nabídka + Menù Medico Allow Medical Menu @@ -18,6 +19,7 @@ Разрешить мед. меню Permitir menú médico Povolit zdravotnickou nabídku + Consenti Menù Medico Allow clients to use the medical menu @@ -27,6 +29,7 @@ Разрешает клиентам использовать медицинское меню Permitir a los clientes utilizar el menú médico Povolit klientům používat zdravotnickou nabídku + Consenti ai clients di usare il Menù Medico Use Medical menu @@ -36,6 +39,7 @@ Использовать медицинское меню Utiliza el menú médico Použít zdravotnickou nabídku + Usa Menù Medico If allowed by server, enable the option to use the Medical Menu through keybinding and interaction menu @@ -44,6 +48,8 @@ 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 + Pokud je povoleno serverem, umožní použít zdravotnickou nabídku skrze kláv. zkratku a interakční menu + Se consentito dal server, abilita l'opzione di usare il Menù Medico attraverso hotkeys e menù interazione Re-open Medical menu @@ -53,6 +59,7 @@ Переоткрывать мед. меню Reabrir menú médico Znovu otevřít zdravotnickou nabídku + Ri-apri Menù Medico Re-open the medical menu after succesful treatment @@ -62,6 +69,7 @@ Переоткрывать медицинское меню после удачного лечения Reabre el menú médico despues de un tratamiento con éxito Znovu otevřít zdravotnickou nabídku po úspěšné léčbě + Ri-Apri il Menù Medico dopo un trattamento riuscito Open Medical Menu @@ -71,6 +79,7 @@ Открыть медицинское меню Abrir menú médico Otevřít zdravotnickou nabídku + Apri Menù Medico Medical Menu Settings @@ -80,6 +89,7 @@ Настройки медицинского меню Ajustes del mení médico Nastavení zdravotnické nabídky + Impostazioni Menù Medico Configure the usage of the Medical Menu @@ -89,6 +99,7 @@ Настройки использования медицинского меню Configurar el uso del menú médico Konfigurace využití zdravotnické nabídky + Configura l'uso del Menù Medico EXAMINE & TREATMENT @@ -99,6 +110,7 @@ BADANIE & LECZENIE EXAMINAR & TRATAMENTO VYŠETŘENÍ & LÉČBA + ESAMINA & TRATTA STATUS @@ -109,6 +121,7 @@ STATUS ESTADO STAV + STATO OVERVIEW @@ -119,6 +132,7 @@ OPIS VISÃO GERAL PŘEHLED + PANORAMICA ACTIVITY LOG @@ -129,6 +143,7 @@ LOGI AKTYWNOŚCI REGISTRO DE ATIVIDADE PROTOKOL + LOG ATTIVITA' QUICK VIEW @@ -139,6 +154,7 @@ SZYBKI PODGLĄD VISÃO RÁPIDA RYCHLÝ NÁHLED + VISTA RAPIDA View triage Card @@ -149,6 +165,7 @@ Pokaż kartę segregacyjną Ver cartão de triagem Zkontrolovat štítek + Guarda Triage Card Examine Patient @@ -159,6 +176,7 @@ Zbadaj pacjenta Examinar paciente Zkontrolovat pacienta + Esamina Paziente Bandage / Fractures @@ -169,6 +187,7 @@ Bandaże / Złamania Bandagens / Fraturas Bandáž / Zlomeniny + Bendaggi/Fratture Medication @@ -179,6 +198,7 @@ Leki Medicação Léky + Medicazione Airway Management @@ -188,6 +208,7 @@ Drogi oddechowe Vias aéreas Dýchací systém + Gestione Vie Respiratorie Advanced Treatments @@ -198,6 +219,7 @@ Zaawansowane zabiegi Tratamentos avançados Pokročilé ošetření + Trattamenti Avanzati Drag/Carry @@ -208,6 +230,7 @@ Ciągnij/Nieś Arrastar/Carregar Táhnout/Nést + Trascina/Trasporta Toggle (Self) @@ -218,6 +241,7 @@ Alternar Alternar (Si mesmo) Přepnout (na sebe) + Attiva (Te Stesso) Select triage status @@ -228,6 +252,7 @@ Wybierz priorytet Selecionar estado de triagem Vybrat prioritu + Seleziona stato Triage Select Head @@ -238,6 +263,7 @@ Wybierz głowę Selecionar Cabeça Vybrat Hlavu + Seleziona Testa Select Torso @@ -248,6 +274,7 @@ Wybierz tors Selecionar Torso Vybrat Trup + Seleziona Torso Select Left Arm @@ -258,6 +285,7 @@ Wybierz lewą rękę Selecionar Braço Esquerdo Vybrat Levou Ruku + Seleziona Braccio Sinistro Select Right Arm @@ -268,6 +296,7 @@ Wybierz prawą rękę Selecionar Braço Direito Vybrat Pravou Ruku + Seleziona Braccio Destro Select Left Leg @@ -278,6 +307,7 @@ Wybierz lewą nogę Selecionar Perna Esquerda Vybrat Levou Nohu + Seleziona Gamba Sinistra Select Right Leg @@ -288,6 +318,7 @@ Wybierz prawą nogę Selecionar Perna Direita Vybrat Pravou Nohu + Seleziona Gamba Destra Head @@ -298,6 +329,7 @@ Głowa Caebça Hlava + Testa Torso @@ -308,6 +340,7 @@ Torso Trup Torso + Torso Left Arm @@ -318,6 +351,7 @@ Lewa ręka Braço Esquerdo Levá Ruka + Braccio Sinistro Right Arm @@ -328,6 +362,7 @@ Prawa ręka Braço Direito Pravá Ruka + Braccio Destro Left Leg @@ -338,6 +373,7 @@ Lewa noga Perna Esquerda Levá Noha + Gamba Sinistra Right Leg @@ -348,6 +384,7 @@ Prawa noga Perna Direita Pravá Noha + Gamba Destra Body Part: %1 @@ -358,6 +395,7 @@ Część ciała: %1 Parte do corpo: %1 Část těla: %1 + Parte del Corpo: %1 Small @@ -368,6 +406,7 @@ małym Pequeno Malý + Piccolo Medium @@ -378,6 +417,7 @@ średnim Médio Střední + Medio Large @@ -388,6 +428,7 @@ dużym Grande Velký + Grande There are %2 %1 Open Wounds @@ -398,6 +439,7 @@ Widzisz otwarte rany w ilości %2 o %1 rozmiarze Existem %2 ferimentos abertos %1 Jsou zde %2 %1 otevřené rány + Ci sono %2 %1 Ferite Aperte There is 1 %1 Open Wound @@ -408,6 +450,7 @@ Widzisz 1 otwartą ranę o %1 rozmiarze Existe 1 %1 ferimento aberto Je zde 1 %1 otevřená rána + C'è 1 %1 Ferita Aperta There is a partial %1 Open wound @@ -418,6 +461,7 @@ Widzisz częściowo otwartą ranę o %1 rozmiarze Existe um ferimento parcial aberto %1 Je zde částečně %1 otevřená rána + C'è 1 parziale %1 Ferita Aperta There are %2 %1 Bandaged Wounds @@ -428,6 +472,7 @@ Widzisz %2 zabandażowanych ran o %1 rozmiarze Existem %2 ferimentos %1 tratados Jsou zde %2 %1 ovázané rány + Ci sono %2 %1 Ferite Bendate There is 1 %1 Bandaged Wound @@ -438,6 +483,7 @@ Widzisz 1 zabandażowaną ranę o %1 rozmiarze Existe 1 ferimento %1 tratado Je zde 1 %1 ovázaná rána + C'è 1 %1 Ferita Bendata There is a partial %1 Bandaged wound @@ -448,6 +494,7 @@ Widzisz 1 częściowo zabandażowaną ranę o %1 rozmiarze Existe um ferimento parcial tratado %1 Je zde částěčně %1 ovázaná rána + C'è 1 parziale %1 Ferita Bendata Normal breathing @@ -458,6 +505,7 @@ Normalny oddech Respiração normal Normální dýchání + Respirazione Normale No breathing @@ -468,6 +516,7 @@ Brak oddechu Sem respiração Nedýchá + Nessuna Respirazione Difficult breathing @@ -478,6 +527,7 @@ Trudności z oddychaniem Dificuldade para respirar Potíže s dýcháním + Difficoltà Respiratorie Almost no breathing @@ -488,6 +538,7 @@ Prawie brak oddechu Quase sem respiração Téměř nedýchá + Quasi nessuna Respirazione Bleeding @@ -498,6 +549,7 @@ Krwawienie zewnętrzne Sangrando Krvácí + Sanguinamento in Pain @@ -508,6 +560,7 @@ W bólu Com dor v bolestech + in Dolore Lost a lot of Blood @@ -518,6 +571,7 @@ Stracił dużo krwi Perdeu muito sangue Ztratil hodně Krve + Perso molto Sangue Tourniquet [CAT] @@ -528,6 +582,7 @@ Opaska uciskowa [CAT] Torniquete [CAT] Škrtidlo [CAT] + Laccio Emostatico [CAT] Nasopharyngeal Tube [NPA] @@ -538,6 +593,7 @@ Rurka nosowo-gardłowa [NPA] Tubo nasofaríngeo [NPA] Nasofaryngeální trubice [NPA] + Tubo Nasofaringeo [NPA] - \ No newline at end of file + diff --git a/addons/microdagr/CfgEventHandlers.hpp b/addons/microdagr/CfgEventHandlers.hpp index 6d1d3b6dfb..47564cbd2d 100644 --- a/addons/microdagr/CfgEventHandlers.hpp +++ b/addons/microdagr/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/microdagr/XEH_PREP.hpp b/addons/microdagr/XEH_PREP.hpp new file mode 100644 index 0000000000..9803a19702 --- /dev/null +++ b/addons/microdagr/XEH_PREP.hpp @@ -0,0 +1,21 @@ + +PREP(appMarkKeypadEntry); +PREP(appMenuButtonConnectRangefinder); +PREP(appSettingsLBClick); +PREP(appWaypointsButtonDeleteWP); +PREP(appWaypointsButtonSetWP); +PREP(canShow); +PREP(deviceAddWaypoint); +PREP(deviceDeleteWaypoint); +PREP(deviceGetWaypoints); +PREP(dialogClosedEH); +PREP(mapButtonDownEH); +PREP(mapDoubleTapEH); +PREP(mapOnDrawEH); +PREP(modeMapButtons); +PREP(moduleMapFill); +PREP(openDisplay); +PREP(recieveRangefinderData); +PREP(saveCurrentAndSetNewMode); +PREP(showApplicationPage); +PREP(updateDisplay); diff --git a/addons/microdagr/XEH_preInit.sqf b/addons/microdagr/XEH_preInit.sqf index 39a1b313c6..ba262ec8c5 100644 --- a/addons/microdagr/XEH_preInit.sqf +++ b/addons/microdagr/XEH_preInit.sqf @@ -2,26 +2,7 @@ ADDON = false; -PREP(appMarkKeypadEntry); -PREP(appMenuButtonConnectRangefinder); -PREP(appSettingsLBClick); -PREP(appWaypointsButtonDeleteWP); -PREP(appWaypointsButtonSetWP); -PREP(canShow); -PREP(deviceAddWaypoint); -PREP(deviceDeleteWaypoint); -PREP(deviceGetWaypoints); -PREP(dialogClosedEH); -PREP(mapButtonDownEH); -PREP(mapDoubleTapEH); -PREP(mapOnDrawEH); -PREP(modeMapButtons); -PREP(moduleMapFill); -PREP(openDisplay); -PREP(recieveRangefinderData); -PREP(saveCurrentAndSetNewMode); -PREP(showApplicationPage); -PREP(updateDisplay); +#include "XEH_PREP.hpp" //Functions that are called for each draw of the map: GVAR(miniMapDrawHandlers) = []; diff --git a/addons/microdagr/XEH_preStart.sqf b/addons/microdagr/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/microdagr/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/microdagr/script_component.hpp b/addons/microdagr/script_component.hpp index 0710649aaa..c2f2b9b0a6 100644 --- a/addons/microdagr/script_component.hpp +++ b/addons/microdagr/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT microdagr #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MICRODAGR #define DEBUG_MODE_FULL #endif diff --git a/addons/microdagr/stringtable.xml b/addons/microdagr/stringtable.xml index 7e2261107f..0f70c424f1 100644 --- a/addons/microdagr/stringtable.xml +++ b/addons/microdagr/stringtable.xml @@ -311,6 +311,7 @@ MicroDAGR - Remplissage de la carte MicroDAGR térképkitöltés Заполнение карты MicroDAGR + Riempimento Mappa MicroDAGR MicroDAGR Map Fill @@ -322,6 +323,7 @@ MicroDAGR - Remplissage de la carte MicroDAGR térképkitöltés Заполнение карты MicroDAGR + Riempimento Mappa MicroDAGR How much map data is filled on MicroDAGR's @@ -333,6 +335,7 @@ Combien d'information apparaisse sur la carte du MicroDAGR Mennyi térképadatot tartalmaz a MicroDAGR Сколько данных должно отображаться на карте MicroDAGR + Quanti dati sono trasferiti nella mappa del MicroDAGR Full Satellite + Buildings @@ -344,6 +347,7 @@ Satellite + Batiments Teljes műholdas + épületek Спутник + Здания + Satellite Completo + Edifici Topographical + Roads @@ -355,6 +359,7 @@ Topographie + Routes Topográfia + utak Топография + Дороги + Topografico + Strade None (Cannot use map view) @@ -366,6 +371,7 @@ Rien (La vue carte n'est pas possible) Semmi (nem használható a térképnézet) Не показывать (запрещает использовать режим карты) + Nessuno (Non puoi usare la vista mappa) 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 @@ -377,6 +383,7 @@ 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 + Controlla quanti dati sono presenti negli oggetti MicroDAGR. Meno dati costringono la vista mappa a mostrare meno informazioni nella minimappa. <br/>Fonte: microDAGR.pbo - + \ No newline at end of file diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index fc0546f797..92a4d043d8 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -5,15 +5,15 @@ enum { class CfgAmmo { class MissileBase; - + class M_PG_AT: MissileBase { model = "\A3\Weapons_F\Ammo\Rocket_01_fly_F"; proxyShape = "\A3\Weapons_F\Ammo\Rocket_01_F"; irLock = 0; - laserLock = 0; + laserLock = 1; airLock = 0; - weaponLockSystem = "2 + 16"; + weaponLockSystem = "4 + 16"; maxSpeed = 720; maxControlRange = 5000; @@ -38,8 +38,17 @@ class CfgAmmo { // ACE uses these values trackOversteer = 1; trackLead = 0; + }; + + class ACE_Hydra70_DAGR: M_PG_AT { + displayName = CSTRING(Hydra70_DAGR); + displayNameShort = CSTRING(Hydra70_DAGR_Short); + + description = CSTRING(Hydra70_DAGR_Desc); + descriptionShort = CSTRING(Hydra70_DAGR_Desc); + + EGVAR(rearm,caliber) = 70; - // Begin ACE guidance Configs class ADDON { enabled = 1; @@ -67,20 +76,7 @@ class CfgAmmo { attackProfiles[] = { "LIN", "DIR", "MID", "HI" }; }; }; - - class ACE_Hydra70_DAGR: M_PG_AT { - displayName = CSTRING(Hydra70_DAGR); - displayNameShort = CSTRING(Hydra70_DAGR_Short); - description = CSTRING(Hydra70_DAGR_Desc); - descriptionShort = CSTRING(Hydra70_DAGR_Desc); - - EGVAR(rearm,caliber) = 70; - - //Explicity add guidance config - class ADDON: ADDON {}; - }; - class ACE_Hellfire_AGM114K: ACE_Hydra70_DAGR { displayName = CSTRING(Hellfire_AGM114K); displayNameShort = CSTRING(Hellfire_AGM114K_Short); @@ -96,7 +92,7 @@ class CfgAmmo { indirectHit = 71; indirectHitRange = 4.5; effectsMissile = "missile2"; - + //Explicity add guidance config class ADDON: ADDON {}; }; diff --git a/addons/missileguidance/CfgEventhandlers.hpp b/addons/missileguidance/CfgEventhandlers.hpp index 8afeb9245e..5ec1d7d652 100644 --- a/addons/missileguidance/CfgEventhandlers.hpp +++ b/addons/missileguidance/CfgEventhandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_pre_init)); @@ -20,4 +27,4 @@ class Extended_IncomingMissile_EventHandlers { class All { ADDON = QUOTE(_this call FUNC(onIncomingMissile)); }; -}; \ No newline at end of file +}; diff --git a/addons/missileguidance/CfgWeapons.hpp b/addons/missileguidance/CfgWeapons.hpp index a922c6b82e..178a55daf7 100644 --- a/addons/missileguidance/CfgWeapons.hpp +++ b/addons/missileguidance/CfgWeapons.hpp @@ -2,12 +2,11 @@ class Mode_SemiAuto; class CfgWeapons { class CannonCore; class LauncherCore; - + class RocketPods: LauncherCore { // canLock = 1; }; class missiles_DAGR : RocketPods { - canLock = 1; - magazines[] += {"24Rnd_ACE_Hydra70_DAGR", "12Rnd_ACE_Hydra70_DAGR", "6Rnd_ACE_Hydra70_DAGR", "24Rnd_ACE_Hellfire_AGM114K", "12Rnd_ACE_Hellfire_AGM114K", "6Rnd_ACE_Hellfire_AGM114K" }; + canLock = 2; }; -}; \ No newline at end of file +}; diff --git a/addons/missileguidance/XEH_PREP.hpp b/addons/missileguidance/XEH_PREP.hpp new file mode 100644 index 0000000000..55948e7171 --- /dev/null +++ b/addons/missileguidance/XEH_PREP.hpp @@ -0,0 +1,32 @@ + +PREP(rotateVectLineGetMap); +PREP(rotateVectLine); +PREP(changeMissileDirection); + +PREP(checkSeekerAngle); +PREP(checkLos); + +PREP(onFired); +PREP(onIncomingMissile); + +PREP(guidancePFH); +PREP(doAttackProfile); +PREP(doSeekerSearch); + +PREP(doHandoff); +PREP(handleHandoff); + +// Attack Profiles +PREP(attackProfile_LIN); +PREP(attackProfile_DIR); +PREP(attackProfile_MID); +PREP(attackProfile_HI); +PREP(attackProfile_AIR); + +// Javelin profiles +PREP(attackProfile_JAV_DIR); +PREP(attackProfile_JAV_TOP); + +// Seeker search functions +PREP(seekerType_SALH); +PREP(seekerType_Optic); diff --git a/addons/missileguidance/XEH_preStart.sqf b/addons/missileguidance/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/missileguidance/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/missileguidance/XEH_pre_init.sqf b/addons/missileguidance/XEH_pre_init.sqf index 08219e02f0..c3d42816c1 100644 --- a/addons/missileguidance/XEH_pre_init.sqf +++ b/addons/missileguidance/XEH_pre_init.sqf @@ -1,33 +1,7 @@ #include "script_component.hpp" -PREP(rotateVectLineGetMap); -PREP(rotateVectLine); -PREP(changeMissileDirection); +ADDON = false; -PREP(checkSeekerAngle); -PREP(checkLos); +#include "XEH_PREP.hpp" -PREP(onFired); -PREP(onIncomingMissile); - -PREP(guidancePFH); -PREP(doAttackProfile); -PREP(doSeekerSearch); - -PREP(doHandoff); -PREP(handleHandoff); - -// Attack Profiles -PREP(attackProfile_LIN); -PREP(attackProfile_DIR); -PREP(attackProfile_MID); -PREP(attackProfile_HI); -PREP(attackProfile_AIR); - -// Javelin profiles -PREP(attackProfile_JAV_DIR); -PREP(attackProfile_JAV_TOP); - -// Seeker search functions -PREP(seekerType_SALH); -PREP(seekerType_Optic); \ No newline at end of file +ADDON = true; diff --git a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf index 1cc71c1d94..0d80a2309e 100644 --- a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf @@ -27,7 +27,7 @@ _angleOkay = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngl _losOkay = false; if(_angleOkay) then { - _losOkay = [_projectile, _target] call FUNC(checkSeekerLos); + _losOkay = [_projectile, _target] call FUNC(checkSeekerLos); //Note: Func does not exist? probably FUNC(checkLos)?? }; TRACE_2("", _angleOkay, _losOkay); diff --git a/addons/missileguidance/script_component.hpp b/addons/missileguidance/script_component.hpp index e2ab97a51e..25e98bea60 100644 --- a/addons/missileguidance/script_component.hpp +++ b/addons/missileguidance/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT missileguidance #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MISSILEGUIDANCE #define DEBUG_MODE_FULL #endif diff --git a/addons/missileguidance/stringtable.xml b/addons/missileguidance/stringtable.xml index c59c36fd50..4b7df47b16 100644 --- a/addons/missileguidance/stringtable.xml +++ b/addons/missileguidance/stringtable.xml @@ -107,6 +107,7 @@ Eteint Ki Выкл. + Spento Player Only @@ -118,6 +119,7 @@ Seulement les joueurs Csak játékosok Только игрок + Solo Giocatore Player and AI @@ -129,6 +131,7 @@ Joueurs et IA Játékosok és AI Игрок и боты + Giocatore ed IA - + \ No newline at end of file diff --git a/addons/missionmodules/CfgEventHandlers.hpp b/addons/missionmodules/CfgEventHandlers.hpp index f0a9f14d91..be284a9d70 100644 --- a/addons/missionmodules/CfgEventHandlers.hpp +++ b/addons/missionmodules/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/missionmodules/XEH_PREP.hpp b/addons/missionmodules/XEH_PREP.hpp new file mode 100644 index 0000000000..bc24252b52 --- /dev/null +++ b/addons/missionmodules/XEH_PREP.hpp @@ -0,0 +1,2 @@ + +PREP(moduleAmbianceSound); diff --git a/addons/missionmodules/XEH_preInit.sqf b/addons/missionmodules/XEH_preInit.sqf index cadbbabdd1..a7feade1c3 100644 --- a/addons/missionmodules/XEH_preInit.sqf +++ b/addons/missionmodules/XEH_preInit.sqf @@ -2,6 +2,6 @@ ADDON = false; -PREP(moduleAmbianceSound); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/missionmodules/XEH_preStart.sqf b/addons/missionmodules/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/missionmodules/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf index 8e1de2cb3d..3ee45f324e 100644 --- a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf +++ b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf @@ -108,7 +108,7 @@ if (_activated && local _logic) then { // If no unit is to close to this position, we will play the sound. if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then { - playSound3D [_ambianceSounds call BIS_fnc_selectRandom, objNull, false, _newPos, _volume, 1, 1000]; + playSound3D [selectRandom _ambianceSounds, objNull, false, _newPos, _volume, 1, 1000]; _args set [8, ACE_time]; }; }; diff --git a/addons/missionmodules/script_component.hpp b/addons/missionmodules/script_component.hpp index a567966c7b..8146b5cb8a 100644 --- a/addons/missionmodules/script_component.hpp +++ b/addons/missionmodules/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT missionModules #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MISSIONMODULES #define DEBUG_MODE_FULL #endif diff --git a/addons/missionmodules/stringtable.xml b/addons/missionmodules/stringtable.xml index fe06252a61..4fc1cd08b7 100644 --- a/addons/missionmodules/stringtable.xml +++ b/addons/missionmodules/stringtable.xml @@ -11,6 +11,7 @@ ACE module de mission ACE küldetési modulok Модули миссий ACE + Moduli Missione ACE Ambiance Sounds [ACE] @@ -22,6 +23,7 @@ Sons d'ambiance [ACE] Ambiens hangok [ACE] Звук окружения [ACE] + Souni Ambientali [ACE] Sounds @@ -33,6 +35,7 @@ Sons Hangok Звуки + Suoni Class names of the ambiance sounds to be played. Seperated by ',' @@ -43,6 +46,7 @@ Nomes de classe dos sons de ambiente para serem reproduzidos. Separados por "," Имена классов звуков окружения, которые должны проигрываться. Разделенные ',' ClassNames des sons d'ambiances. Séparation par "," + Nomi classi dei suoni ambientali da eseguire. Separati da ',' Minimal Distance @@ -54,6 +58,7 @@ Distance minimale Minimális távolság Минимальная дистанция + Distanza Minimale Used for calculating a random position and sets the minimal distance between the players and the played sound file(s) @@ -65,6 +70,7 @@ 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 Используется для расчета случайной позиции и указывает минимальное расстояние между игроками и источниками звука + Usati per calcolare una posizione casuale ed impostare la distanza minima tra i giocatori ed il file suono eseguito Maximum Distance @@ -76,6 +82,7 @@ Distance maximale Maximális távolság Максимальная дистанция + Distanza Massima Used for calculating a random position and sets the maximum distance between the players and the played sound file(s) @@ -87,6 +94,7 @@ 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 Используется для расчета случайной позиции и указывает максимальное расстояние между игроками и источниками звука + Usato per calcolare una posizione casuale ed impostare la distanza massima tra giocatori e il file suono eseguito Minimal Delay @@ -98,6 +106,7 @@ Délais minimal Minimum késleltetés Минимальная задержка + Pausa Minima Minimal delay between sounds played @@ -109,6 +118,7 @@ Délais minimal entre les sons lus. Minimum késleltetés a lejátszott hangok között Минимальная задержка между воспроизведением звуков + Pausa Minima tra suoni eseguiti Maximum Delay @@ -120,6 +130,7 @@ Délais maximal Maximum késleltetés Максимальная задержка + Pausa Massima Maximum delay between sounds played @@ -131,6 +142,7 @@ Délais maximal entre les sons lus. Maximum késleltetés a lejátszott hangok között Максимальная задержка между воспроизведением звуков + Pausa Massima tra suoni eseguiti Follow Players @@ -142,6 +154,7 @@ Suivre les joueurs Játékosok követése Следовать за игроками + Segui Giocatori Follow players. If set to false, loop will play sounds only nearby logic position. @@ -153,6 +166,7 @@ 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. Следовать за игроками. Если установить в Ложь, звуки будут циклически проигрываться только около позиции Логики. + Segui Giocatori. Se impostato su falso, il ciclo eseguirà i suoni solo vicino ad una posizione logica. Volume @@ -164,6 +178,7 @@ Volume Hangerő Громкость + Volume The volume of the sounds played @@ -175,6 +190,7 @@ Volume des sons lus A lejátszott hangok hangereje Громкость воспроизводимых звуков + Il volume dei suoni eseguiti Ambiance sounds loop (synced across MP) @@ -186,6 +202,7 @@ Sons d'ambiance lus en boucle (Synchronisation MP) Ambiens hangok folyamatossága (MP alatt szinkronizálva) Циклически воспроизводимые звуки окружения (синх. между игроками) + Ciclo Suoni Ambientali (sincronizzato in MP) - + \ No newline at end of file diff --git a/addons/mk6mortar/ACE_Settings.hpp b/addons/mk6mortar/ACE_Settings.hpp index be7625bc3a..6d1eebf942 100644 --- a/addons/mk6mortar/ACE_Settings.hpp +++ b/addons/mk6mortar/ACE_Settings.hpp @@ -15,4 +15,9 @@ class ACE_Settings { typeName = "BOOL"; isClientSetable = 0; }; + class GVAR(useAmmoHandling) { + value = 0; + typeName = "BOOL"; + isClientSetable = 0; + }; }; diff --git a/addons/mk6mortar/CfgEventHandlers.hpp b/addons/mk6mortar/CfgEventHandlers.hpp index 34c6ecc22c..b88088c6e4 100644 --- a/addons/mk6mortar/CfgEventHandlers.hpp +++ b/addons/mk6mortar/CfgEventHandlers.hpp @@ -1,13 +1,28 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; + class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_DisplayLoad_EventHandlers { + class RscUnitInfo { + ADDON = QUOTE(_this call FUNC(turretDisplayLoaded)); + }; +}; + class Extended_FiredBIS_EventHandlers { class Mortar_01_base_F { class ADDON { diff --git a/addons/mk6mortar/CfgVehicles.hpp b/addons/mk6mortar/CfgVehicles.hpp index 481687f89f..175cbf82f3 100644 --- a/addons/mk6mortar/CfgVehicles.hpp +++ b/addons/mk6mortar/CfgVehicles.hpp @@ -25,6 +25,7 @@ class CfgVehicles { class Turrets: Turrets { class MainTurret: MainTurret {}; }; + class ACE_Actions; }; class Mortar_01_base_F: StaticMortar { class Turrets: Turrets { @@ -34,6 +35,54 @@ class CfgVehicles { discreteDistanceInitIndex = 0; }; }; + class ACE_Actions: ACE_Actions { + class GVAR(unloadMagazine) { + displayName = CSTRING(unloadMortar); + distance = 2; + condition = QUOTE(_this call FUNC(canUnloadMagazine)); + statement = QUOTE([ARR_3(_target,_player,5)] call FUNC(unloadMagazineTimer)); + icon = ""; + selection = "usti hlavne"; + }; + class GVAR(LoadActions) { + displayName = CSTRING(loadMortar); + distance = 2; + condition = QUOTE([ARR_2(_target,_player)] call FUNC(canLoadMagazine)); + statement = ""; + icon = ""; + selection = "usti hlavne"; + class GVAR(loadMagazine_HE_Guided) { + displayName = CSTRING(loadMagazine_HE_Guided); + condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_HE_Guided')] call FUNC(canLoadMagazine)); + statement = QUOTE([ARR_4(_target,_player,8,'ACE_1Rnd_82mm_Mo_HE_Guided')] call FUNC(loadMagazineTimer)); + icon = ""; + }; + class GVAR(loadMagazine_HE_LaserGuided) { + displayName = CSTRING(loadMagazine_HE_LaserGuided); + condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_HE_LaserGuided')] call FUNC(canLoadMagazine)); + statement = QUOTE([ARR_4(_target,_player,8,'ACE_1Rnd_82mm_Mo_HE_LaserGuided')] call FUNC(loadMagazineTimer)); + icon = ""; + }; + class GVAR(loadMagazine_Illum) { + displayName = CSTRING(loadMagazine_Illum); + condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_Illum')] call FUNC(canLoadMagazine)); + statement = QUOTE([ARR_4(_target,_player,5,'ACE_1Rnd_82mm_Mo_Illum')] call FUNC(loadMagazineTimer)); + icon = ""; + }; + class GVAR(loadMagazine_Smoke) { + displayName = CSTRING(loadMagazine_Smoke); + condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_Smoke')] call FUNC(canLoadMagazine)); + statement = QUOTE([ARR_4(_target,_player,2.5,'ACE_1Rnd_82mm_Mo_Smoke')] call FUNC(loadMagazineTimer)); + icon = ""; + }; + class GVAR(loadMagazine_HE) { + displayName = CSTRING(loadMagazine_HE); + condition = QUOTE([ARR_3(_target,_player,'ACE_1Rnd_82mm_Mo_HE')] call FUNC(canLoadMagazine)); + statement = QUOTE([ARR_4(_target,_player,2.5,'ACE_1Rnd_82mm_Mo_HE')] call FUNC(loadMagazineTimer)); + icon = ""; + }; + }; + }; class ACE_SelfActions { class GVAR(toggleMils) { displayName = "Toggle MILS"; @@ -74,9 +123,49 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 1; }; + class useAmmoHandling { + displayName = CSTRING(useAmmoHandling_DisplayName); + description = CSTRING(useAmmoHandling_Description); + typeName = "BOOL"; + defaultValue = 0; + }; }; class ModuleDescription { description = CSTRING(Module_Description); }; }; + + class Box_NATO_AmmoOrd_F; + class ACE_Box_82mm_Mo_HE: Box_NATO_AmmoOrd_F { + displayName = CSTRING(HEBox_DisplayName); + author = ECSTRING(common,ACETeam); + transportMaxWeapons = 4; + transportMaxMagazines = 8; + class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_HE,8); + }; + class TransportItems {}; + class TransportWeapons {}; + }; + class ACE_Box_82mm_Mo_Smoke: ACE_Box_82mm_Mo_HE { + displayName = CSTRING(SmokeBox_DisplayName); + class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_Smoke,8); + }; + }; + class ACE_Box_82mm_Mo_Illum: ACE_Box_82mm_Mo_HE { + displayName = CSTRING(IllumBox_DisplayName); + class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_Illum,8); + }; + }; + class ACE_Box_82mm_Mo_Combo: ACE_Box_82mm_Mo_HE { + displayName = CSTRING(ComboBox_DisplayName); + transportMaxMagazines = 48; + class TransportMagazines { + MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_HE,32); + MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_Smoke,8); + MACRO_ADDMAGAZINE(ACE_1Rnd_82mm_Mo_Illum,8); + }; + }; }; diff --git a/addons/mk6mortar/CfgWeapons.hpp b/addons/mk6mortar/CfgWeapons.hpp index 97952af2d1..f535840e99 100644 --- a/addons/mk6mortar/CfgWeapons.hpp +++ b/addons/mk6mortar/CfgWeapons.hpp @@ -12,4 +12,20 @@ class CfgWeapons { mass = 0.5; }; }; + + class CannonCore; + class mortar_82mm: CannonCore { + class Single1; + }; + class ACE_mortar_82mm: mortar_82mm { + author = ECSTRING(common,ACETeam); + magazines[] = {"ACE_1Rnd_82mm_Mo_HE","ACE_1Rnd_82mm_Mo_Smoke","ACE_1Rnd_82mm_Mo_Illum", + "ACE_1Rnd_82mm_Mo_HE_Guided","ACE_1Rnd_82mm_Mo_HE_LaserGuided"}; + modes[] = {"Single1","Single2","Single3"}; + reloadTime = 0.5; + magazineReloadTime = 0.5; + class Single1: Single1 { + reloadTime = 0.5; + }; + }; }; diff --git a/addons/mk6mortar/UI/w_l16_ammo_he_ca.paa b/addons/mk6mortar/UI/w_l16_ammo_he_ca.paa new file mode 100644 index 0000000000..34f6ff53ac Binary files /dev/null and b/addons/mk6mortar/UI/w_l16_ammo_he_ca.paa differ diff --git a/addons/mk6mortar/UI/w_l16_ammo_illum_ca.paa b/addons/mk6mortar/UI/w_l16_ammo_illum_ca.paa new file mode 100644 index 0000000000..318119f8a1 Binary files /dev/null and b/addons/mk6mortar/UI/w_l16_ammo_illum_ca.paa differ diff --git a/addons/mk6mortar/UI/w_l16_ammo_smk_white_ca.paa b/addons/mk6mortar/UI/w_l16_ammo_smk_white_ca.paa new file mode 100644 index 0000000000..16900ec51d Binary files /dev/null and b/addons/mk6mortar/UI/w_l16_ammo_smk_white_ca.paa differ diff --git a/addons/mk6mortar/XEH_PREP.hpp b/addons/mk6mortar/XEH_PREP.hpp new file mode 100644 index 0000000000..600fc0707f --- /dev/null +++ b/addons/mk6mortar/XEH_PREP.hpp @@ -0,0 +1,23 @@ + +PREP(dev_buildTable); +PREP(dev_formatNumber); +PREP(dev_simulateCalcRangeTableLine); +PREP(dev_simulateFindSolution); +PREP(dev_simulateShot); + +PREP(canLoadMagazine); +PREP(canUnloadMagazine); +PREP(handleFired); +PREP(handlePlayerVehicleChanged); +PREP(loadMagazine); +PREP(loadMagazineTimer); +PREP(moduleInit); +PREP(mortarInit); +PREP(rangeTableCanUse); +PREP(rangeTableOpen); +PREP(rangeTablePageChange); +PREP(rangeTablePreCalculatedValues); +PREP(toggleMils); +PREP(turretDisplayLoaded); +PREP(unloadMagazine); +PREP(unloadMagazineTimer); diff --git a/addons/mk6mortar/XEH_clientInit.sqf b/addons/mk6mortar/XEH_clientInit.sqf deleted file mode 100644 index cde5277260..0000000000 --- a/addons/mk6mortar/XEH_clientInit.sqf +++ /dev/null @@ -1,6 +0,0 @@ -#include "script_component.hpp" - -if (!hasInterface) exitWith {}; - -["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler); -["infoDisplayChanged", {_this call FUNC(turretDisplayLoaded);}] call EFUNC(common,addEventHandler); diff --git a/addons/mk6mortar/XEH_postInit.sqf b/addons/mk6mortar/XEH_postInit.sqf new file mode 100644 index 0000000000..ffe3b3b814 --- /dev/null +++ b/addons/mk6mortar/XEH_postInit.sqf @@ -0,0 +1,20 @@ +#include "script_component.hpp" + +[QGVAR(addMagazine), { + params ["_static", "_magazine"]; + _static addMagazineTurret [_magazine,[0]]; +}] call EFUNC(common,addEventHandler); + +[QGVAR(removeMagazine), { + params ["_static", "_magazine"]; + _static removeMagazineTurret [_magazine,[0]]; +}] call EFUNC(common,addEventHandler); + +[QGVAR(setAmmo), { + params ["_static", "_magazine","_ammoCount"]; + _static setMagazineTurretAmmo [_magazine, _ammoCount, [0]]; +}] call EFUNC(common,addEventHandler); + +if (!hasInterface) exitWith {}; + +["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler); diff --git a/addons/mk6mortar/XEH_preInit.sqf b/addons/mk6mortar/XEH_preInit.sqf index 9af89ccb35..a7feade1c3 100644 --- a/addons/mk6mortar/XEH_preInit.sqf +++ b/addons/mk6mortar/XEH_preInit.sqf @@ -2,20 +2,6 @@ ADDON = false; -PREP(dev_buildTable); -PREP(dev_formatNumber); -PREP(dev_simulateCalcRangeTableLine); -PREP(dev_simulateFindSolution); -PREP(dev_simulateShot); - -PREP(handleFired); -PREP(handlePlayerVehicleChanged); -PREP(moduleInit); -PREP(rangeTableCanUse); -PREP(rangeTableOpen); -PREP(rangeTablePageChange); -PREP(rangeTablePreCalculatedValues); -PREP(toggleMils); -PREP(turretDisplayLoaded); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/mk6mortar/XEH_preStart.sqf b/addons/mk6mortar/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/mk6mortar/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/mk6mortar/cfgMagazines.hpp b/addons/mk6mortar/cfgMagazines.hpp new file mode 100644 index 0000000000..679539e1a2 --- /dev/null +++ b/addons/mk6mortar/cfgMagazines.hpp @@ -0,0 +1,67 @@ +class cfgMagazines { + class 8Rnd_82mm_Mo_shells; + class ACE_1Rnd_82mm_Mo_HE: 8Rnd_82mm_Mo_shells { + count = 1; + scope = 2; + scopeCurator = 2; + author = ECSTRING(common,ACETeam); + displayName = CSTRING(magazine_HE_displayName); + displayNameShort = ""; + descriptionShort = CSTRING(magazine_descriptionShort); + model = PATHTOF(data\l16_ammo_he.p3d); + picture = PATHTOF(UI\w_l16_ammo_he_ca.paa); + mass = 50; + }; + class 8Rnd_82mm_Mo_Smoke_white; + class ACE_1Rnd_82mm_Mo_Smoke: 8Rnd_82mm_Mo_Smoke_white { + count = 1; + scope = 2; + scopeCurator = 2; + author = ECSTRING(common,ACETeam); + displayName = CSTRING(magazine_Smoke_displayName); + displayNameShort = ""; + descriptionShort = CSTRING(magazine_descriptionShort); + model = PATHTOF(data\l16_ammo_smk_white.p3d); + picture = PATHTOF(UI\w_l16_ammo_smk_white_ca.paa); + mass = 50; + }; + class 8Rnd_82mm_Mo_Flare_white; + class ACE_1Rnd_82mm_Mo_Illum: 8Rnd_82mm_Mo_Flare_white { + count = 1; + scope = 2; + scopeCurator = 2; + author = ECSTRING(common,ACETeam); + displayName = CSTRING(magazine_Illum_displayName); + displayNameShort = ""; + descriptionShort = CSTRING(magazine_descriptionShort); + model = PATHTOF(data\l16_ammo_illum.p3d); + picture = PATHTOF(UI\w_l16_ammo_illum_ca.paa); + mass = 50; + }; + class 8Rnd_82mm_Mo_guided; + class ACE_1Rnd_82mm_Mo_HE_Guided: 8Rnd_82mm_Mo_guided { + count = 1; + scope = 2; + scopeCurator = 2; + author = ECSTRING(common,ACETeam); + displayName = CSTRING(magazine_HE_Guided_displayName); + displayNameShort = ""; + descriptionShort = CSTRING(magazine_descriptionShort); + model = PATHTOF(data\l16_ammo_he.p3d); + picture = PATHTOF(UI\w_l16_ammo_he_ca.paa); + mass = 50; + }; + class 8Rnd_82mm_Mo_LG; + class ACE_1Rnd_82mm_Mo_HE_LaserGuided: 8Rnd_82mm_Mo_LG { + count = 1; + scope = 2; + scopeCurator = 2; + author = ECSTRING(common,ACETeam); + displayName = CSTRING(magazine_HE_LaserGuided_displayName); + displayNameShort = ""; + descriptionShort = CSTRING(magazine_descriptionShort); + model = PATHTOF(data\l16_ammo_he.p3d); + picture = PATHTOF(UI\w_l16_ammo_he_ca.paa); + mass = 50; + }; +}; diff --git a/addons/mk6mortar/config.cpp b/addons/mk6mortar/config.cpp index 8a54d15a5b..102875a195 100644 --- a/addons/mk6mortar/config.cpp +++ b/addons/mk6mortar/config.cpp @@ -2,11 +2,12 @@ class CfgPatches { class ADDON { - units[] = {}; - weapons[] = {"ACE_RangeTable_82mm"}; + units[] = {"ACE_Box_82mm_Mo_HE","ACE_Box_82mm_Mo_Smoke", + "ACE_Box_82mm_Mo_Illum","ACE_Box_82mm_Mo_Combo"}; + weapons[] = {"ACE_RangeTable_82mm","ace_mortar_82mm"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"PabstMirror"}; + author[] = {"PabstMirror","Grey","VKing"}; authorUrl = "https://github.com/acemod"; VERSION_CONFIG; }; @@ -16,6 +17,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "CfgMagazines.hpp" //UI Stuff: diff --git a/addons/mk6mortar/data/l16_ammo_he.p3d b/addons/mk6mortar/data/l16_ammo_he.p3d new file mode 100644 index 0000000000..96553ee44a Binary files /dev/null and b/addons/mk6mortar/data/l16_ammo_he.p3d differ diff --git a/addons/mk6mortar/data/l16_ammo_he.paa b/addons/mk6mortar/data/l16_ammo_he.paa new file mode 100644 index 0000000000..59e367fd7c Binary files /dev/null and b/addons/mk6mortar/data/l16_ammo_he.paa differ diff --git a/addons/mk6mortar/data/l16_ammo_illum.p3d b/addons/mk6mortar/data/l16_ammo_illum.p3d new file mode 100644 index 0000000000..43776c2634 Binary files /dev/null and b/addons/mk6mortar/data/l16_ammo_illum.p3d differ diff --git a/addons/mk6mortar/data/l16_ammo_illum.paa b/addons/mk6mortar/data/l16_ammo_illum.paa new file mode 100644 index 0000000000..70210a0813 Binary files /dev/null and b/addons/mk6mortar/data/l16_ammo_illum.paa differ diff --git a/addons/mk6mortar/data/l16_ammo_smk_white.p3d b/addons/mk6mortar/data/l16_ammo_smk_white.p3d new file mode 100644 index 0000000000..b3518a113e Binary files /dev/null and b/addons/mk6mortar/data/l16_ammo_smk_white.p3d differ diff --git a/addons/mk6mortar/data/l16_ammo_smk_white.paa b/addons/mk6mortar/data/l16_ammo_smk_white.paa new file mode 100644 index 0000000000..5baf563966 Binary files /dev/null and b/addons/mk6mortar/data/l16_ammo_smk_white.paa differ diff --git a/addons/mk6mortar/functions/fnc_canLoadMagazine.sqf b/addons/mk6mortar/functions/fnc_canLoadMagazine.sqf new file mode 100644 index 0000000000..c0858a328a --- /dev/null +++ b/addons/mk6mortar/functions/fnc_canLoadMagazine.sqf @@ -0,0 +1,53 @@ +/* + * Author: Grey + * Checks whether magazine can be loaded into static weapon + * + * Arguments: + * 0: static + * 1: unit + * 2: magazine class to check; if not given having any compatible magazine returns true (default: "") + * + * Return Value: + * canLoadMagazine + * + * Example: + * [_target,_player,"ACE_1Rnd_82mm_Mo_HE"] call ace_mk6mortar_fnc_canLoadMagazine + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_static","_unit",["_magazineClassOptional","",[""]]]; +private ["_canLoadMagazine","_currentMagazine","_weapon","_listOfMagNames", + "_hasCompatibleMagazine","_count"]; + +if !(alive _static && GVAR(useAmmoHandling)) exitWith {false}; + +_canLoadMagazine = false; +_hasCompatibleMagazine = false; + +_currentMagazine = (magazinesAllTurrets _static) select 1; +_weapon = (_static weaponsTurret [0]) select 0; + +_listOfMagNames = getArray(configFile >> "cfgWeapons" >> _weapon >> "magazines"); +_count = 0; + +//If function is called with an optional string then check if player has that magzine otherwise check all magazines of the player to see if they are compatible with the static weapon +if (_magazineClassOptional != "") then { + if ([_unit,_magazineClassOptional] call EFUNC(common,hasMagazine)) then { + _hasCompatibleMagazine = true; + }; + } else { + { + if ([_unit,_x] call EFUNC(common,hasMagazine)) exitWith {_hasCompatibleMagazine = true}; + } forEach _listOfMagNames; +}; +//If static weapon has a magazine then find the ammo count +if (count (_static magazinesTurret [0]) > 0) then { + _count = _currentMagazine select 2; +}; +//If the static weapon doesn't have a magzine or a magazine with no bullets, the player has a compatible magazine and the static weapon has a barrel then you can load a magazine +if ((count (_static magazinesTurret [0]) == 0 || _count == 0 ) && _hasCompatibleMagazine) then { + _canLoadMagazine = true; +}; +_canLoadMagazine diff --git a/addons/mk6mortar/functions/fnc_canUnloadMagazine.sqf b/addons/mk6mortar/functions/fnc_canUnloadMagazine.sqf new file mode 100644 index 0000000000..b1d6593574 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_canUnloadMagazine.sqf @@ -0,0 +1,29 @@ +/* + * Author: Grey + * Checks whether magazine can be unloaded from static weapon + * + * Arguments: + * 0: static + * 1: unit + * + * Return Value: + * canUnloadMagazine + * + * Example: + * [_target,_player] call ace_mk6mortar_fnc_canUnloadMagazine + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_static","_unit"]; +private ["_canUnloadMagazine","_ammoCount"]; + +if !(alive _static && GVAR(useAmmoHandling) && _static getVariable [QGVAR(initialized),false]) exitWith {false}; +_canUnloadMagazine = false; + +_ammoCount = ((magazinesAllTurrets _static) select 1) select 2; +if (_ammoCount > 0) then { + _canUnloadMagazine = true; +}; +_canUnloadMagazine diff --git a/addons/mk6mortar/functions/fnc_handleFired.sqf b/addons/mk6mortar/functions/fnc_handleFired.sqf index d22b0efa47..e14fd77f6a 100644 --- a/addons/mk6mortar/functions/fnc_handleFired.sqf +++ b/addons/mk6mortar/functions/fnc_handleFired.sqf @@ -21,10 +21,17 @@ */ #include "script_component.hpp" -if (!GVAR(airResistanceEnabled)) exitWith {}; - PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +if (GVAR(useAmmoHandling) && {_vehicle getVariable [QGVAR(initialized),false] && !(_vehicle getVariable [QGVAR(exclude),false])}) then { + // if !(_vehicle getVariable [QGVAR(exclude),false]) then { + _vehicle removeMagazineGlobal (_vehicle magazinesTurret [0] select 0); + TRACE_1("",_vehicle magazinesTurret [0]); + // }; +}; + +if (!GVAR(airResistanceEnabled)) exitWith {}; + private ["_shooterMan", "_temperature", "_newMuzzleVelocityCoefficent", "_bulletVelocity", "_bulletSpeed"]; // Large enough distance to not simulate any wind deflection diff --git a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf index 4b0e9e634c..02049289aa 100644 --- a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf +++ b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf @@ -3,7 +3,7 @@ * Handles player getting into new vehicle. Loads PFEG for mortar display if it is a mortar. * * Arguments: - * 0:Player + * 0: Player * 1: New Vehicle * * Return Value: @@ -23,6 +23,19 @@ private["_tubeWeaponName" ,"_fireModes", "_lastFireMode"]; if (isNull _newVehicle) exitWith {}; if (!(_newVehicle isKindOf "Mortar_01_base_F")) exitWith {}; +// Run magazine handling initialization if enabled +if (!EGVAR(common,settingsInitFinished)) then { + EGVAR(common,runAtSettingsInitialized) pushBack [{ + if (GVAR(useAmmoHandling) && {!(_this getVariable [QGVAR(initialized),false]) && !(_this getVariable [QGVAR(exclude),false])}) then { + _this call FUNC(mortarInit); + }; + }, _newVehicle]; +} else { + if (GVAR(useAmmoHandling) && {!(_newVehicle getVariable [QGVAR(initialized),false]) && !(_newVehicle getVariable [QGVAR(exclude),false])}) then { + _newVehicle call FUNC(mortarInit); + }; +}; + _tubeWeaponName = (weapons _newVehicle) select 0; _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes"); @@ -49,7 +62,7 @@ if (_lastFireMode != -1) then { //Save firemode on vehicle: _mortarVeh setVariable [QGVAR(lastFireMode), _currentChargeMode]; - + if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then { //Don't like this solution, but it works closeDialog 0; diff --git a/addons/mk6mortar/functions/fnc_loadMagazine.sqf b/addons/mk6mortar/functions/fnc_loadMagazine.sqf new file mode 100644 index 0000000000..41b0162151 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_loadMagazine.sqf @@ -0,0 +1,65 @@ +/* + * Author: Grey + * Loads Magazine into static weapon + * + * Arguments: + * 0: static + * 1: unit + * 2: magazine class to load; if not given the first compatible magazine is loaded (default: "") + * + * Return Value: + * None + * + * Example: + * [_target,_player,"ACE_1Rnd_82mm_Mo_HE"] call ace_mk6mortar_fnc_loadMagazine + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_static","_unit",["_magazineClassOptional","",[""]]]; +private ["_weapon","_currentMagazine","_count","_magazines","_magazineDetails","_listOfMagNames", + "_magazineClass","_magazineClassDetails","_parsed","_roundsLeft"]; + +//If function has been called with an optional classname hten add that magazine to the static weapon. Otherwise add the compatible magazine +if(_magazineClassOptional != "") then { + _unit removeMagazine _magazineClassOptional; + [QGVAR(addMagazine), [_static, _magazineClassOptional]] call EFUNC(common,globalEvent); +} else { + //Get weapon & magazine information of static weapon + _weapon = (_static weaponsTurret [0]) select 0; + _currentMagazine = (magazinesAllTurrets _static) select 1; + _currentMagazineClass = _currentMagazine select 0; + _count = _currentMagazine select 2; + + //Check all of the players magazines to see if they are compatible with the static weapon. First magazine that is compatible is chosen + //VKing: This section ought to be double checked. + _magazines = magazines _unit; + _magazineDetails = magazinesDetail _unit; + _listOfMagNames = getArray(configFile >> "cfgWeapons" >> _weapon >> "magazines"); + _magazineClass = ""; + _magazineClassDetails = ""; + _parsed =""; + _roundsLeft = 0; + { + if (_x in _listOfMagNames) exitWith { + _magazineClass = _x; + _magazineClassDetails = _magazineDetails select _forEachIndex; + }; + } forEach _magazines; + //If the static weapon already has an empty magazine then remove it + if (_count == 0) then { + [QGVAR(removeMagazine), [_static, _currentMagazineClass]] call EFUNC(common,globalEvent); + }; + //Find out the ammo count of the compatible magazine found + if (_magazineClassDetails != "") then{ + _parsed = _magazineClassDetails splitString "([]/: )"; + _parsed params ["_type", "", "", "_roundsLeftText", "_maxRoundsText"]; + _roundsLeft = parseNumber _roundsLeftText; + _magType = _type; + }; + + _unit removeMagazine _magazineClass; + [QGVAR(addMagazine), [_static, _magazineClass]] call EFUNC(common,globalEvent); + [QGVAR(setAmmo), _static, [_static, _magazineClass,_roundsLeft]] call EFUNC(common,targetEvent); +}; diff --git a/addons/mk6mortar/functions/fnc_loadMagazineTimer.sqf b/addons/mk6mortar/functions/fnc_loadMagazineTimer.sqf new file mode 100644 index 0000000000..16016f06e6 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_loadMagazineTimer.sqf @@ -0,0 +1,28 @@ +/* + * Author: Grey + * Loads Magazine into static weapon using a timer + * + * Arguments: + * 0: static + * 1: unit + * 2: time to load + * 3: magazineClassOptional + * + * Return Value: + * None + * + * Example: + * [_target,_player,"ACE_1Rnd_82mm_Mo_HE"] call ace_mk6mortar_fnc_loadMagazineTimer + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_static","_unit","_timeToLoad",["_magazineClassOptional","",[""]]]; + +//Move player into animation if player is standing +if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { + [_unit, "AmovPercMstpSrasWrflDnon_diary", 1] call EFUNC(common,doAnimation); +}; + +[_timeToLoad, [_static,_unit,_magazineClassOptional], {(_this select 0) call FUNC(loadMagazine)}, {}, localize LSTRING(loadingMortar)] call EFUNC(common,progressBar); diff --git a/addons/mk6mortar/functions/fnc_moduleInit.sqf b/addons/mk6mortar/functions/fnc_moduleInit.sqf index 75bab4cee9..3dedbb2c9e 100644 --- a/addons/mk6mortar/functions/fnc_moduleInit.sqf +++ b/addons/mk6mortar/functions/fnc_moduleInit.sqf @@ -25,3 +25,4 @@ if (!isServer) exitWith {}; [_logic, QGVAR(airResistanceEnabled), "airResistanceEnabled"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(allowComputerRangefinder), "allowComputerRangefinder"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(allowCompass), "allowCompass"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(useAmmoHandling), "useAmmoHandling"] call EFUNC(common,readSettingFromModule); diff --git a/addons/mk6mortar/functions/fnc_mortarInit.sqf b/addons/mk6mortar/functions/fnc_mortarInit.sqf new file mode 100644 index 0000000000..7c74cb8249 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_mortarInit.sqf @@ -0,0 +1,45 @@ +/* + * Author: VKing + * Initializes mortar for use with ammunition handling magazines. + * + * Arguments: + * 0: Mortar + * + * Return Value: + * None + * + * Example: + * [mortar1] call ace_mk6mortar_fnc_mortarInit + * + * Public: No + */ +#include "script_component.hpp" + +params ["_mortar"]; + +if (_mortar getVariable [QGVAR(initialized),false] || _mortar getVariable [QGVAR(exclude),false]) exitWith {TRACE_1("Exit",_mortar)}; + +// Remove all magazines +if (count magazines _mortar > 0) then { + { + [QGVAR(removeMagazine), [_mortar, _x]] call EFUNC(common,globalEvent); + } forEach magazines _mortar; +}; + +// Replace current weapon with ammo handling weapon +private _currentWeapon = _mortar weaponsTurret [0] select 0; +private _newWeapon = ""; + +if (_currentWeapon == "mortar_82mm") then { + _newWeapon = "ace_mortar_82mm"; +} else { + _newWeapon = getText (configFile >> "CfgWeapons" >> _currentWeapon >> QGVAR(replaceWith)); +}; + +if (_newWeapon != "") then { + _mortar removeWeaponGlobal _currentWeapon; + _mortar addWeaponGlobal _newWeapon; +}; + +_mortar setVariable [QGVAR(initialized),true,true]; +TRACE_1("Init complete",_mortar); diff --git a/addons/mk6mortar/functions/fnc_unloadMagazine.sqf b/addons/mk6mortar/functions/fnc_unloadMagazine.sqf new file mode 100644 index 0000000000..537cc931d8 --- /dev/null +++ b/addons/mk6mortar/functions/fnc_unloadMagazine.sqf @@ -0,0 +1,39 @@ +/* + * Author: Grey + * + * Unload current magazine from static weapon + * + * Arguments: + * 0: static + * 1: unit + * + * Return Value: + * None + * + * Example: + * [_target, _player] call ace_mk6mortar_fnc_unloadMagazine + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_static","_unit"]; +private ["_currentMagazine","_currentMagazineClass","_ammoCount"]; + +//Get weapon & magazine information about static weapon +_currentMagazine = (magazinesAllTurrets _static) select 1; +_currentMagazineClass = _currentMagazine select 0; +_ammoCount = _currentMagazine select 2; + +// Try to add the round to player inventory, otherwise place it on the ground near the player +if (_ammoCount > 0) then { + if (_unit canAdd _currentMagazineClass) then { + _unit addMagazineGlobal _currentMagazineClass; + } else { + _pos = _unit modelToWorldVisual [0.5,0.5,0]; // Front right of player + _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"]; + _unit addMagazineAmmoCargo [_currentMagazineClass, 1, _ammoCount]; + _unit setPosATL _pos; + }; + [QGVAR(removeMagazine), [_static, _currentMagazineClass]] call EFUNC(common,globalEvent); +}; diff --git a/addons/mk6mortar/functions/fnc_unloadMagazineTimer.sqf b/addons/mk6mortar/functions/fnc_unloadMagazineTimer.sqf new file mode 100644 index 0000000000..151f35492a --- /dev/null +++ b/addons/mk6mortar/functions/fnc_unloadMagazineTimer.sqf @@ -0,0 +1,28 @@ +/* + * Author: Grey + * + * Unload current magazine from static weapon using a timer + * + * Arguments: + * 0: static + * 1: unit + * 2: time to unload + * + * Return Value: + * None + * + * Example: + * [_target, _player, 5] call ace_mk6mortar_fnc_unloadMagazineTimer + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_static","_unit","_timeToUnload"]; + +//Move player into animation if player is standing +if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { + [_unit, "AmovPercMstpSrasWrflDnon_diary", 1] call EFUNC(common,doAnimation); +}; + +[_timeToUnload, [_static,_unit], {(_this select 0) call FUNC(unloadMagazine)}, {}, localize LSTRING(unloadingMortar)] call EFUNC(common,progressBar); diff --git a/addons/mk6mortar/script_component.hpp b/addons/mk6mortar/script_component.hpp index b140a920cc..97e1c8b50a 100644 --- a/addons/mk6mortar/script_component.hpp +++ b/addons/mk6mortar/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT mk6mortar #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MK6MORTAR #define DEBUG_MODE_FULL #endif diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index f1bbef9228..e7a69e9ee3 100644 --- a/addons/mk6mortar/stringtable.xml +++ b/addons/mk6mortar/stringtable.xml @@ -46,7 +46,7 @@ Carga Töltés Carregar - Nabít + Charge Carica @@ -59,6 +59,7 @@ Option du MK6 MK6 beállítások Настройки MK6 + Impostazioni MK6 Air Resistance @@ -70,6 +71,7 @@ Résistance de l'air Légellenállás Сопротивление воздуха + Resistenza dell'Aria For Player Shots, Model Air Resistance and Wind Effects @@ -81,6 +83,7 @@ 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 Для выстрелов игрока. Моделирует сопротивление воздуха и эффект ветра + Per Proiettili dei Giocatori, simula la Resistenza dell'Aria e gli Effetti del Vento Allow MK6 Computer @@ -92,6 +95,7 @@ Autoriser l'ordinateur de tir pour MK6 MK6 számítógép engedélyezése Разрешить компьютер MK6 + Consenti Computer MK6 Show the Computer and Rangefinder (these NEED to be removed if you enable air resistance) @@ -103,6 +107,7 @@ 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) Показывает компьютер и дальномер (это НУЖНО отключить, если вы включаете сопротивление воздуха) + Mostra il Computer e Distaziometro (questi DEVONO essere rimossi se vuoi abilitare la resistenza dell'aria) Allow MK6 Compass @@ -114,6 +119,7 @@ Autoriser la boussole pour MK6 MK6 iránytű engedélyezése Разрешить компас MK6 + Consenti Bussola MK6 Show the MK6 Digital Compass @@ -125,6 +131,7 @@ Affiche la boussole digitale pour le MK6 Az MK6 digitális iránytű megjelenítése Показывает цифровой компас MK6 + Mostra la Bussola Digitale MK6 This module allows you to setup MK6 mortar settings. @@ -134,6 +141,70 @@ Este módulo permite que você ajuste o morteiro MK6. Модуль настройки миномета MK6. Ce module permet de régler les options du mortier MK6 + Questo modulo ti consente di impostare i parametri del mortaio MK6. + + + Use Ammunition handling + + + Removes mortar magazines, requiring individual rounds to be loaded by the gunner or loader. Does not affect AI mortars. + + + Remove Round + + + Load Mortar + + + Unloading Round + + + Preparing Round + + + Load HE + + + Load Smoke + + + Load Illumination + + + Load Guided HE + + + Load Laser Guided HE + + + 82mm HE Round + + + 82mm Smoke Round + + + 82mm Illumination Round + + + 82mm Guided HE Round + + + 82mm Laser Guided HE Round + + + Used in Mk6 mortar + + + [ACE] 82mm HE Rounds Box + + + [ACE] 82mm Smoke Rounds Box + + + [ACE] 82mm Illumination Rounds Box + + + [ACE] 82mm Default Loadout Box diff --git a/addons/modules/CfgEventHandlers.hpp b/addons/modules/CfgEventHandlers.hpp index 82d1c55d10..cd12d1938e 100644 --- a/addons/modules/CfgEventHandlers.hpp +++ b/addons/modules/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/modules/XEH_PREP.hpp b/addons/modules/XEH_PREP.hpp new file mode 100644 index 0000000000..66edc4e817 --- /dev/null +++ b/addons/modules/XEH_PREP.hpp @@ -0,0 +1,2 @@ + +PREP(moduleInit); diff --git a/addons/modules/XEH_preInit.sqf b/addons/modules/XEH_preInit.sqf index 7573d34352..419cd902b5 100644 --- a/addons/modules/XEH_preInit.sqf +++ b/addons/modules/XEH_preInit.sqf @@ -2,7 +2,7 @@ ADDON = false; -PREP(moduleInit); +#include "XEH_PREP.hpp" GVAR(moduleInitCollection) = []; diff --git a/addons/modules/XEH_preStart.sqf b/addons/modules/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/modules/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/modules/script_component.hpp b/addons/modules/script_component.hpp index 807540960b..4e4e64e8e3 100644 --- a/addons/modules/script_component.hpp +++ b/addons/modules/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT modules #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MODULES #define DEBUG_MODE_FULL #endif diff --git a/addons/movement/CfgEventHandlers.hpp b/addons/movement/CfgEventHandlers.hpp index e75956f440..083c5bb089 100644 --- a/addons/movement/CfgEventHandlers.hpp +++ b/addons/movement/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -9,3 +16,9 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_DisplayLoad_EventHandlers { + class RscDisplayInventory { + ADDON = QUOTE(_this call COMPILE_FILE(XEH_inventoryDisplayLoad)); + }; +}; diff --git a/addons/movement/CfgMoves.hpp b/addons/movement/CfgMoves.hpp index a828c5278c..c8273fcdb2 100644 --- a/addons/movement/CfgMoves.hpp +++ b/addons/movement/CfgMoves.hpp @@ -31,7 +31,7 @@ class CfgMovesBasic { TurnRRelaxed = "AmovPpneMstpSrasWlnrDnon_turnr"; }; - // WEAPON RAISED - RUNNING + // jump animation - WEAPON RAISED - RUNNING class RifleStandActionsNoAdjust; class RifleStandActionsRunF: RifleStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; @@ -43,7 +43,7 @@ class CfgMovesBasic { getOver = "AovrPercMrunSrasWrflDf"; }; - // WEAPON RAISED - SPRINTING + // jump animation - WEAPON RAISED - SPRINTING class RifleStandEvasiveActionsF: RifleStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; }; @@ -54,7 +54,7 @@ class CfgMovesBasic { getOver = "AovrPercMrunSrasWrflDf"; }; - // WEAPON LOWERED - RUNNING + // jump animation - WEAPON LOWERED - RUNNING class RifleLowStandActionsNoAdjust; class RifleLowStandActionsRunF: RifleLowStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; @@ -71,49 +71,18 @@ class CfgMovesBasic { class CfgMovesMaleSdr: CfgMovesBasic { class StandBase; class States { - // better slow walk with lowered rifle animation + // jumping. don't force awkward freelook in mid air. + class AovrPercMstpSrasWrflDf; + class AovrPercMrunSrasWrflDf: AovrPercMstpSrasWrflDf { + forceAim = 0; + }; + + // replace link of vault with jump animation class AmovPercMstpSrasWrflDnon; class AmovPercMrunSrasWrflDf: AmovPercMstpSrasWrflDnon { InterpolateTo[] = {"AovrPercMrunSrasWrflDf",0.22,"AmovPercMrunSlowWrflDf",0.025,"AmovPercMwlkSrasWrflDf",0.025,"AmovPknlMrunSrasWrflDf",0.03,"AmovPercMrunSlowWrflDf_AmovPpneMstpSrasWrflDnon",0.02,"AmovPercMevaSrasWrflDf",0.025,"Unconscious",0.01,"AmovPercMtacSrasWrflDf",0.02,"AmovPercMrunSrasWrflDfl",0.02,"AmovPercMrunSrasWrflDfl_ldst",0.02,"AmovPercMrunSrasWrflDfr",0.02,"AmovPercMrunSrasWrflDfr_ldst",0.02,"AmovPercMstpSrasWrflDnon",0.02,"AmovPercMrunSrasWrflDl",0.02,"AmovPercMrunSrasWrflDbl",0.02,"AmovPercMrunSrasWrflDb",0.02,"AmovPercMrunSrasWrflDbr",0.02,"AmovPercMrunSrasWrflDr",0.02,"AmovPknlMstpSlowWrflDnon_relax",0.1,"AmovPercMrunSrasWrflDf_ldst",0.02,"AmovPercMrunSrasWrflDf",0.02}; }; - class AmovPercMstpSlowWrflDnon; - class AmovPercMwlkSlowWrflDf: AmovPercMstpSlowWrflDnon { - speed = 0.3; //0.206897; - file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\Wlk\Low\Rfl\AmovPercMwlkSlowWrflDf_ver2"; - leftHandIKCurve[] = {1}; - }; - class AmovPercMwlkSlowWrflDfl: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDfr: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDb: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDbl: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDbr: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDl: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDr: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDf_v1: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AidlPercMwlkSrasWrflDf: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMtacSlowWrflDf: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - // enable optics in prone down stance class AadjPpneMstpSrasWrflDup; class AadjPpneMstpSrasWrflDdown: AadjPpneMstpSrasWrflDup { diff --git a/addons/movement/XEH_PREP.hpp b/addons/movement/XEH_PREP.hpp new file mode 100644 index 0000000000..8e465970eb --- /dev/null +++ b/addons/movement/XEH_PREP.hpp @@ -0,0 +1,5 @@ + +PREP(getWeight); +PREP(canClimb); +PREP(climb); +PREP(handleClimb); diff --git a/addons/movement/XEH_inventoryDisplayLoad.sqf b/addons/movement/XEH_inventoryDisplayLoad.sqf new file mode 100644 index 0000000000..ae717e7b39 --- /dev/null +++ b/addons/movement/XEH_inventoryDisplayLoad.sqf @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +disableSerialization; + +[{ + disableSerialization; + params ["_dialog"]; + + if (isNull _dialog) exitWith { + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + (_dialog displayCtrl 111) ctrlSetText format ["%1 - %2 %3", [ACE_player, false, true] call EFUNC(common,getName), localize LSTRING(Weight), [ACE_player] call FUNC(getWeight)]; +}, 0, _this select 0] call CBA_fnc_addPerFrameHandler; diff --git a/addons/movement/XEH_postInit.sqf b/addons/movement/XEH_postInit.sqf index 68229684c6..806823f4c4 100644 --- a/addons/movement/XEH_postInit.sqf +++ b/addons/movement/XEH_postInit.sqf @@ -3,23 +3,6 @@ if (!hasInterface) exitWith {}; -["inventoryDisplayLoaded", { - - [{ - private "_dialog"; - - _dialog = _this select 0; - - if (isNull _dialog) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; - }; - - _dialog displayCtrl 111 ctrlSetText format ["%1 - %2 %3", [ACE_player, false, true] call EFUNC(common,getName), localize LSTRING(Weight), [ACE_player] call FUNC(getWeight)]; - - }, 0, _this select 0] call CBA_fnc_addPerFrameHandler; - -}] call EFUNC(common,addEventHandler); - ["ACE3 Movement", QGVAR(climb), localize LSTRING(Climb), { // Conditions: canInteract diff --git a/addons/movement/XEH_preInit.sqf b/addons/movement/XEH_preInit.sqf index 3047be3518..a7feade1c3 100644 --- a/addons/movement/XEH_preInit.sqf +++ b/addons/movement/XEH_preInit.sqf @@ -2,9 +2,6 @@ ADDON = false; -PREP(getWeight); -PREP(canClimb); -PREP(climb); -PREP(handleClimb); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/movement/XEH_preStart.sqf b/addons/movement/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/movement/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/movement/functions/fnc_canClimb.sqf b/addons/movement/functions/fnc_canClimb.sqf index 671ab0b808..ec4202dbd5 100644 --- a/addons/movement/functions/fnc_canClimb.sqf +++ b/addons/movement/functions/fnc_canClimb.sqf @@ -15,33 +15,30 @@ */ #include "script_component.hpp" -private ["_pos", "_dir"]; +params ["_unit"]; -PARAMS_1(_unit); +private _pos = getPosASL _unit; +private _dir = getDir _unit; -_pos = getPosASL _unit; -_dir = getDir _unit; _dir = [sin _dir, cos _dir, 0]; -private ["_checkPos0beg", "_checkPos0end", "_checkPos1beg", "_checkPos1end"]; +private _checkPos0beg = _pos vectorAdd [0, 0, 0.9]; +private _checkPos0end = _checkPos0beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos0beg = _pos vectorAdd [0, 0, 0.9]; -_checkPos0end = _checkPos0beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos1beg = _pos vectorAdd [0, 0, 1.75]; +private _checkPos1end = _checkPos1beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos1beg = _pos vectorAdd [0, 0, 1.75]; -_checkPos1end = _checkPos1beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos2beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 2.0]; +private _checkPos2end = _checkPos2beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos2beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 2.0]; -_checkPos2end = _checkPos2beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos3beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 2.0]; +private _checkPos3end = _checkPos3beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos3beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 2.0]; -_checkPos3end = _checkPos3beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos4beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 1.5]; +private _checkPos4end = _checkPos4beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos4beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 1.5]; -_checkPos4end = _checkPos4beg vectorAdd (_dir vectorMultiply 1.3); - -_checkPos5beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 1.5]; -_checkPos5end = _checkPos5beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos5beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 1.5]; +private _checkPos5end = _checkPos5beg vectorAdd (_dir vectorMultiply 1.3); /* drawLine3D [ASLToATL _checkPos0beg, ASLToATL _checkPos0end, [0,1,0,1]]; diff --git a/addons/movement/functions/fnc_climb.sqf b/addons/movement/functions/fnc_climb.sqf index a0946b95d0..57df4e5991 100644 --- a/addons/movement/functions/fnc_climb.sqf +++ b/addons/movement/functions/fnc_climb.sqf @@ -15,9 +15,7 @@ */ #include "script_component.hpp" -private "_unit"; - -_unit = _this select 0; +params ["_unit"]; if !([_unit] call FUNC(canClimb)) exitWith { [localize LSTRING(CanNotClimb)] call EFUNC(common,displayTextStructured); diff --git a/addons/movement/functions/fnc_getWeight.sqf b/addons/movement/functions/fnc_getWeight.sqf index 6941173fde..11dd8c4ee6 100644 --- a/addons/movement/functions/fnc_getWeight.sqf +++ b/addons/movement/functions/fnc_getWeight.sqf @@ -15,11 +15,9 @@ */ #include "script_component.hpp" -private ["_unit", "_weight"]; +params ["_unit"]; -_unit = _this select 0; - -_weight = loadAbs _unit * 0.1; +private _weight = loadAbs _unit * 0.1; if (GVAR(useImperial)) then { _weight = format ["%1lb", (round (_weight * 100)) / 100]; diff --git a/addons/movement/functions/fnc_handleClimb.sqf b/addons/movement/functions/fnc_handleClimb.sqf index 39ca9b1e92..e6d8fed12c 100644 --- a/addons/movement/functions/fnc_handleClimb.sqf +++ b/addons/movement/functions/fnc_handleClimb.sqf @@ -16,12 +16,10 @@ */ #include "script_component.hpp" -private ["_unit", "_anim", "_pos"]; +params ["_unit", "_anim"]; -_unit = _this select 0; -_anim = _this select 1; +private _pos = _unit modelToWorldVisual (_unit selectionPosition "camera"); -_pos = _unit modelToWorldVisual (_unit selectionPosition "camera"); [_unit, "AmovPknlMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); _pos = _pos vectorDiff (_unit selectionPosition "camera"); diff --git a/addons/movement/script_component.hpp b/addons/movement/script_component.hpp index 9b8954bf62..14728cbcbb 100644 --- a/addons/movement/script_component.hpp +++ b/addons/movement/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT movement #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MOVEMENT #define DEBUG_MODE_FULL #endif diff --git a/addons/movement/stringtable.xml b/addons/movement/stringtable.xml index af5ce71af4..4ab3d1253b 100644 --- a/addons/movement/stringtable.xml +++ b/addons/movement/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/mx2a/script_component.hpp b/addons/mx2a/script_component.hpp index aabb74660a..9b36572497 100644 --- a/addons/mx2a/script_component.hpp +++ b/addons/mx2a/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT mx2a #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MX2A #define DEBUG_MODE_FULL #endif diff --git a/addons/mx2a/stringtable.xml b/addons/mx2a/stringtable.xml index f45e10bcaa..ad46cebfde 100644 --- a/addons/mx2a/stringtable.xml +++ b/addons/mx2a/stringtable.xml @@ -11,6 +11,7 @@ MX-2A MX-2A MX-2A + MX-2A Thermal imaging device @@ -22,6 +23,7 @@ Appareil d'imagerie thermique Hőleképező készülék Тепловизионный прибор + Dispositivo di visione termica - + \ No newline at end of file diff --git a/addons/nametags/CfgEventHandlers.hpp b/addons/nametags/CfgEventHandlers.hpp index e75956f440..becf395052 100644 --- a/addons/nametags/CfgEventHandlers.hpp +++ b/addons/nametags/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/nametags/XEH_PREP.hpp b/addons/nametags/XEH_PREP.hpp new file mode 100644 index 0000000000..93a8ff6626 --- /dev/null +++ b/addons/nametags/XEH_PREP.hpp @@ -0,0 +1,10 @@ + +PREP(canShow); +PREP(doShow); +PREP(drawNameTagIcon); +PREP(getVehicleData); +PREP(initIsSpeaking); +PREP(moduleNameTags); +PREP(onDraw3d); +PREP(setText); +PREP(updateSettings); diff --git a/addons/nametags/XEH_preInit.sqf b/addons/nametags/XEH_preInit.sqf index 51b926cbb3..a7feade1c3 100644 --- a/addons/nametags/XEH_preInit.sqf +++ b/addons/nametags/XEH_preInit.sqf @@ -2,14 +2,6 @@ ADDON = false; -PREP(canShow); -PREP(doShow); -PREP(drawNameTagIcon); -PREP(getVehicleData); -PREP(initIsSpeaking); -PREP(moduleNameTags); -PREP(onDraw3d); -PREP(setText); -PREP(updateSettings); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/nametags/XEH_preStart.sqf b/addons/nametags/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/nametags/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/nametags/functions/fnc_doShow.sqf b/addons/nametags/functions/fnc_doShow.sqf index 1b7323921f..615916de7f 100644 --- a/addons/nametags/functions/fnc_doShow.sqf +++ b/addons/nametags/functions/fnc_doShow.sqf @@ -18,23 +18,19 @@ private["_roleImages", "_player", "_vehicle", "_type", "_config", "_text", "_data", "_isAir", "_turretUnits", "_turretRoles", "_index", "_roleType", "_unit", "_toShow"]; - _player = ACE_player; _vehicle = vehicle _player; _type = typeOf _vehicle; _config = configFile >> "CfgVehicles" >> _type; _text = format[" %2
", getText(_config>>"picture"), getText (_config >> "DisplayName")]; - - _data = [_type] call FUNC(getVehicleData); _isAir = _data select 0; _data = _data select 1; -_turretUnits = [_data, { _vehicle turretUnit (_x select 0) } ] call EFUNC(common,map); -_turretRoles = [_data, { _x select 1 } ] call EFUNC(common,map); - +_turretUnits = _data apply {_vehicle turretUnit (_x select 0)}; +_turretRoles = _data apply {_x select 1}; _roleType = CARGO; _toShow = []; @@ -61,7 +57,6 @@ _toShow = []; _toShow pushBack [_x, _roleType]; } forEach crew _vehicle; - _toShow = [ _toShow, [], @@ -75,7 +70,6 @@ _toShow = [ } ] call BIS_fnc_sortBy; - _roleImages = ROLE_IMAGES; { _unit = _x select 0; @@ -83,7 +77,6 @@ _roleImages = ROLE_IMAGES; _text = _text + format["%1
", [_unit] call EFUNC(common,getName), _roleImages select _roleType]; } forEach _toShow; - ("ACE_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutRsc ["ACE_CrewInfo_dialog", "PLAIN", 1, false]; terminate (missionNamespace getVariable [QGVAR(hideCrewInfoHandle), scriptNull]); diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index ac28a427d5..3c206c6c57 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -7,74 +7,75 @@ * 1: Target * 2: Alpha * 4: Height offset - * 5: Draw Type + * 5: Draw name + * 5: Draw rank + * 6: Draw soundwave * * Return value: * None * * Example: - * [ACE_player, bob, 0.5, height, ICON_NAME_SPEAK] call ace_nametags_fnc_drawNameTagIcon + * [ACE_player, bob, 0.5, height, true, true, true] call ace_nametags_fnc_drawNameTagIcon * * Public: No */ #include "script_component.hpp" -params ["_player", "_target", "_alpha", "_heightOffset", "_iconType"]; +TRACE_1("drawName:", _this); -if ((_iconType == ICON_NONE) || {isObjectHidden _target}) exitWith {}; //Don't waste time if not visable +params ["", "_target", "", "_heightOffset"]; -private ["_position", "_color", "_name", "_size", "_icon", "_scale"]; +_fnc_parameters = { + params ["_player", "_target", "_alpha", "_heightOffset", "_drawName", "_drawRank", "_drawSoundwave"]; -//Set Icon: -_icon = ""; -_size = 0; -if (_iconType in [ICON_NAME_SPEAK, ICON_SPEAK]) then { - _icon = format ["%1%2%3",QUOTE(PATHTOF(UI\soundwave)), floor (random 10), ".paa"]; - _size = 1; - _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))]; + //Set Icon: + private _icon = ""; + private _size = 0; + if (_drawSoundwave) then { + _icon = format [QUOTE(PATHTOF(UI\soundwave%1.paa)), floor random 10]; _size = 1; + } else { + if (_drawRank) then { + _icon = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa", toLower rank _target]; + _size = 1; + }; }; + + //Set Text: + private _name = if (_drawName) then { + [_target, true, true] call EFUNC(common,getName) + } else { + "" + }; + + //Set Color: + private _color = [1, 1, 1, _alpha]; + 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 { + _color = [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select ((["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (assignedTeam _target)) max 0); + }; + + private _scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize); + + [ + _icon, + _color, + [], + (_size * _scale), + (_size * _scale), + 0, + _name, + 2, + (0.05 * _scale), + "PuristaMedium" + ] }; -if (_alpha < 0) exitWith {}; //Don't waste time if not visable +private _parameters = [_this, _fnc_parameters, _target, QGVAR(drawParameters), 0.1] call EFUNC(common,cachedCall); +_parameters set [2, _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .3)])]; -//Set Text: -_name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then { - [_target, true, true] call EFUNC(common,getName) -} else { - "" -}; -//Set Color: -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 { - _color = [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select ((["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (assignedTeam _target)) max 0); -}; - -if (isNil "_color") then { - _color = [1, 1, 1, _alpha]; -}; - -// Convert position to ASLW (expected by drawIcon3D) and add height offsets -_position = _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .3)]); - -_scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize); - -drawIcon3D [ - _icon, - _color, - _position, - (_size * _scale), - (_size * _scale), - 0, - _name, - 2, - (0.05 * _scale), - "PuristaMedium" -]; +drawIcon3D _parameters; diff --git a/addons/nametags/functions/fnc_onDraw3d.sqf b/addons/nametags/functions/fnc_onDraw3d.sqf index bbf608b75a..3bb97dba8c 100644 --- a/addons/nametags/functions/fnc_onDraw3d.sqf +++ b/addons/nametags/functions/fnc_onDraw3d.sqf @@ -15,108 +15,143 @@ */ #include "script_component.hpp" -private ["_onKeyPressAlphaMax", "_defaultIcon", "_distance", "_alpha", "_icon", "_targets", "_pos2", "_vecy", "_relPos", "_projDist", "_pos", "_target", "_targetEyePosASL", "_ambientBrightness", "_maxDistance"]; +private ["_defaultIcon", "_distance", "_alpha", "_icon", "_targets", "_relPos", "_projDist", "_target"]; -//don't show nametags in spectator or if RscDisplayMPInterrupt is open +BEGIN_COUNTER(GVAR(onDraw3d)); + +// 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); - -_onKeyPressAlphaMax = if ((GVAR(showPlayerNames) in [3,4])) then { - 2 + (GVAR(showNamesTime) - ACE_time); //after release 1 second of full opacity, 1 second of fading to 0 -} else { - 1 -}; - -_defaultIcon = if (GVAR(showPlayerRanks)) then { - ICON_NAME_RANK; -} else { - ICON_NAME; -}; - -//When cursorTarget is on a vehicle show the nametag for the commander. -//If set to "Only On Keypress" settings, fade just like main tags -if (GVAR(showCursorTagForVehicles) && {_onKeyPressAlphaMax > 0}) then { - _target = cursorTarget; - if ((!(_target isKindOf "CAManBase")) && {!(_target in allUnitsUAV)}) then { - _target = effectiveCommander _target; - if ((!isNull _target) && - {(side (group _target)) == (side (group ACE_player))} && - {_target != ACE_player} && - {GVAR(showNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} && - {!(_target getVariable ["ACE_hideName", false])}) then { - _distance = ACE_player distance _target; - _alpha = (((1 - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(playerNamesMaxAlpha)) min _onKeyPressAlphaMax; - [ACE_player, _target, _alpha, _distance * 0.026, _defaultIcon] call FUNC(drawNameTagIcon); - }; +// Determine flags from current settings +private _drawName = true; +private _drawRank = GVAR(showPlayerRanks); +private _enabledTagsNearby = false; +private _enabledTagsCursor = false; +private _onKeyPressAlphaMax = 1; +switch (GVAR(showPlayerNames)) do { + case 0: { + // Player names Disabled + _drawName = false; + _enabledTagsNearby = (GVAR(showSoundWaves) == 2); + _enabledTagsCursor = false; + }; + case 1: { + // Player names Enabled + _enabledTagsNearby = true; + _enabledTagsCursor = false; + }; + case 2: { + // Player names Only cursor + _enabledTagsNearby = (GVAR(showSoundWaves) == 2); + _enabledTagsCursor = true; + }; + case 3: { + // Player names Only Keypress + _onKeyPressAlphaMax = 2 + (GVAR(showNamesTime) - ACE_time); + _enabledTagsNearby = (_onKeyPressAlphaMax) > 0 || (GVAR(showSoundWaves) == 2); + _enabledTagsCursor = false; + }; + case 4: { + // Player names Only Cursor and Keypress + _onKeyPressAlphaMax = 2 + (GVAR(showNamesTime) - ACE_time); + _enabledTagsNearby = (GVAR(showSoundWaves) == 2); + _enabledTagsCursor = _onKeyPressAlphaMax > 0; }; }; -//"Only Cursor" mode, only show nametags for humans on cursorTarget -if ((GVAR(showPlayerNames) in [2,4]) && {_onKeyPressAlphaMax > 0}) then { +private _ambientBrightness = ((([] call EFUNC(common,ambientBrightness)) + ([0, 0.4] select ((currentVisionMode ace_player) != 0))) min 1) max 0; +private _maxDistance = _ambientBrightness * GVAR(PlayerNamesViewDistance); + +private _camPosAGL = positionCameraToWorld [0, 0, 0]; +private _camPosASL = AGLtoASL _camPosAGL; +private _vecy = (AGLtoASL positionCameraToWorld [0, 0, 1]) vectorDiff _camPosASL; + +// Show nametag for the unit behind the cursor or its commander +if (_enabledTagsCursor) then { _target = cursorTarget; - if ((!isNull _target) && - {_target isKindOf "CAManBase"} && - {(side (group _target)) == (side (group ACE_player))} && - {_target != ACE_player} && - {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 - _icon = if (([_target] call FUNC(isSpeaking)) && {(vehicle _target) == _target}) then {ICON_NAME} else {_defaultIcon}; + if !(_target isKindOf "CAManBase") then { + // When cursorTarget is on a vehicle show the nametag for the commander. + if !(_target in allUnitsUAV) then { + _target = effectiveCommander _target; } else { - _icon = if (([_target] call FUNC(isSpeaking)) && {(vehicle _target) == _target} && {GVAR(showSoundWaves) > 0}) then {ICON_NAME_SPEAK} else {_defaultIcon}; + _target = objNull; }; + }; + if (isNull _target) exitWith {}; - [ACE_player, _target, _alpha, _distance * 0.026, _icon] call FUNC(drawNameTagIcon); + if (_target != ACE_player && + {(side group _target) == (side group ACE_player)} && + {GVAR(showNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} && + {lineIntersectsSurfaces [_camPosASL, eyePos _target, ACE_player, _target] isEqualTo []} && + {!isObjectHidden _target}) then { + + _distance = ACE_player distance _target; + + private _drawSoundwave = (GVAR(showSoundWaves) > 0) && {[_target] call FUNC(isSpeaking)}; + // Alpha: + // - base value determined by GVAR(playerNamesMaxAlpha) + // - decreases when _distance > _maxDistance + // - increases when the unit is speaking + // - it's clamped by the value of _onKeyPressAlphaMax + private _alpha = (((1 + ([0, 0.2] select _drawSoundwave) - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(playerNamesMaxAlpha)) min _onKeyPressAlphaMax; + + if (_alpha > 0) then { + [ACE_player, _target, _alpha, _distance * 0.026, _drawName, _drawRank, _drawSoundwave] call FUNC(drawNameTagIcon); + }; }; }; -if (((GVAR(showPlayerNames) in [1,3]) && {_onKeyPressAlphaMax > 0}) || {GVAR(showSoundWaves) == 2}) then { - _pos = positionCameraToWorld [0, 0, 0]; - _targets = _pos nearObjects ["CAManBase", _maxDistance + 5]; - - if (!surfaceIsWater _pos) then { - _pos = ATLtoASL _pos; - }; - _pos2 = positionCameraToWorld [0, 0, 1]; - if (!surfaceIsWater _pos2) then { - _pos2 = ATLtoASL _pos2; - }; - _vecy = _pos2 vectorDiff _pos; +// Show nametags for nearby units +if (_enabledTagsNearby) then { + // Find valid targets and cache them + private _targets = [[], { + private _nearMen = _camPosAGL nearObjects ["CAManBase", _maxDistance + 7]; + _nearMen = _nearMen select { + _x != ACE_player && + {(side group _x) == (side group ACE_player)} && + {GVAR(showNamesForAI) || {[_x] call EFUNC(common,isPlayer)}} && + {lineIntersectsSurfaces [_camPosASL, eyePos _x, ACE_player, _x] isEqualTo []} && + {!isObjectHidden _x} + }; + private _crewMen = []; + if (vehicle ACE_player != ACE_player) then { + _crewMen = (crew vehicle ACE_player) select { + _x != ACE_player && + {(side group _x) == (side group ACE_player)} && + {GVAR(showNamesForAI) || {[_x] call EFUNC(common,isPlayer)}} && + {lineIntersectsSurfaces [_camPosASL, eyePos _x, ACE_player, _x, true, 1, "GEOM", "NONE"] isEqualTo []} && + {!isObjectHidden _x} + }; + }; + (_nearMen + _crewMen) + }, missionNamespace, QGVAR(nearMen), 0.5] call EFUNC(common,cachedCall); { - _target = _x; + private _target = _x; - _icon = ICON_NONE; - if ((GVAR(showPlayerNames) in [1,3]) && {_onKeyPressAlphaMax > 0}) then { - if (([_target] call FUNC(isSpeaking)) && {(vehicle _target) == _target} && {GVAR(showSoundWaves) > 0}) then {_icon = ICON_NAME_SPEAK;} else {_icon = _defaultIcon}; - } else { - //showSoundWaves must be 2, only draw speak icon - if (([_target] call FUNC(isSpeaking)) && {(vehicle _target) == _target}) then {_icon = ICON_SPEAK;}; + private _relPos = (visiblePositionASL _target) vectorDiff _camPosASL; + private _distance = vectorMagnitude _relPos; + private _projDist = _relPos vectorDistance (_vecy vectorMultiply (_relPos vectorDotProduct _vecy)); + + private _drawSoundwave = (GVAR(showSoundWaves) > 0) && {[_target] call FUNC(isSpeaking)}; + private _alphaMax = _onKeyPressAlphaMax; + if ((GVAR(showSoundWaves) == 2) && _drawSoundwave) then { + _drawName = _drawSoundwave; + _drawRank = false; + _alphaMax = 1; }; + // Alpha: + // - base value determined by GVAR(playerNamesMaxAlpha) + // - decreases when _distance > _maxDistance + // - increases when the unit is speaking + // - it's clamped by the value of _onKeyPressAlphaMax unless soundwaves are forced on and the unit is talking + private _alpha = (((1 + ([0, 0.2] select _drawSoundwave) - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(playerNamesMaxAlpha)) min _alphaMax; - if ((_icon != ICON_NONE) && - {(side (group _target)) == (side (group ACE_player))} && - {_target != ACE_player} && - {GVAR(showNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} && - {!(_target getVariable ["ACE_hideName", false])}) then { - - _targetEyePosASL = eyePos _target; - if (lineIntersects [_pos, _targetEyePosASL, ACE_player, _target]) exitWith {}; // Check if there is line of sight - - _relPos = (visiblePositionASL _target) vectorDiff _pos; - _distance = vectorMagnitude _relPos; - _projDist = _relPos vectorDistance (_vecy vectorMultiply (_relPos vectorDotProduct _vecy)); - - _alpha = (((1 - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(playerNamesMaxAlpha)) min _onKeyPressAlphaMax; - - [ACE_player, _target, _alpha, _distance * 0.026, _icon] call FUNC(drawNameTagIcon); + if (_alpha > 0) then { + [ACE_player, _target, _alpha, _distance * 0.026, _drawName, _drawRank, _drawSoundwave] call FUNC(drawNameTagIcon); }; nil } count _targets; }; + +END_COUNTER(GVAR(onDraw3d)); diff --git a/addons/nametags/script_component.hpp b/addons/nametags/script_component.hpp index 7bf0acbc4a..5b777aee71 100644 --- a/addons/nametags/script_component.hpp +++ b/addons/nametags/script_component.hpp @@ -1,12 +1,17 @@ #define COMPONENT nametags #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_NAMETAGS -#define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_NAMETAGS -#define DEBUG_SETTINGS DEBUG_SETTINGS_NAMETAGS + #define DEBUG_SETTINGS DEBUG_SETTINGS_NAMETAGS #endif #include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml index 9016988452..a945339ead 100644 --- a/addons/nametags/stringtable.xml +++ b/addons/nametags/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -32,7 +32,7 @@ Zeige Spielernamen nur an, wenn die Maus auf sie gerrichtet ist (benötigt Spielernamen) Noms uniquement sous le curseur (si noms affichés) Zobrazit jméno hráče jenom na kurzor (vyžaduje jména hráčů) - Mostra i nomi solo se puntati (richiede mostra nomi abilitato) + Mostra i nomi solo se puntati (insieme ai nomi) Mostrar nome de jogador somente no cursor (requer nome de jogadores) Játékosok nevének mutatása csak a kurzoron (a nevek mutatása szükséges) Показать имена игроков только под курсором (при включенных именах) @@ -46,7 +46,7 @@ Pokaż imiona graczy tylko po przytrzymaniu klawisza (wymagana opcja Pokaż imiona graczy) Játékosnevek mutatása csak gombnyomásra (a nevek mutatása szükséges) Показать имена игроков только по нажатию клавиши (при включенных именах) - Mostra i nomi solo se si preme il tasto (richiede mostra nomi abilitato) + Mostra i nomi solo se si preme il tasto (insieme ai nomi) Mostrar nomes somente ao pressionar teclar (requer nome de jogadores) @@ -56,7 +56,7 @@ Mostrar rango de los jugadores (requiere Mostrar nombres de jugadores) Grade des joueurs (si noms affichés) Zobrazit hodnosti hráčů (vyžaduje jména hráčů) - Mostra i gradi (richiede mostra nomi abilitato) + Mostra i gradi (insieme ai nomi) Mostrar patente de jogadores (requer nome de jogadores) Játékosok rendfokozatának mutatása (a nevek mutatása szükséges) Показывать звания игроков (при вкл. именах) @@ -94,7 +94,7 @@ Pokaż fale dźwiękowe (wymagana opcja Pokaż imiona graczy) Afficher "qui parle" (si noms affichés) "Hanghullámok" mutatása (a nevek mutatása szükséges) - Mostra movimento audio (richiede mostra nomi abilitato) + Mostra movimento audio (insieme ai nomi) Mostrar onda sonora (requer nome de jogadores) @@ -119,6 +119,7 @@ NameTags Névcímkék Имена игроков + Etichette Nomi Player Names View Dist. @@ -130,6 +131,7 @@ Distance de vue des noms de joueurs Játékosok nevének látótávja Дистанция отображения имен + Distanza Visiva Etichette Nomi Distance in meters at which player names are shown. Default: 5 @@ -141,6 +143,7 @@ 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 + Distanza in metri a cui sono visibili i nomi giocatori. Default: 5 Show name tags for AI? @@ -152,6 +155,7 @@ Afficher les noms pour les IA? Névcímkék megjelenítése AI-nál? Показывать имена ботов? + Mostra etichette nomi per IA? Show the name and rank tags for friendly AI units? Default: Do not force @@ -163,6 +167,7 @@ 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 Показывать имена и звания дружественных ботов? По-умолчанию: Не обязывать + Mostra etichette nomi ed etichette gradi per unità IA alleate? Default: Non forzare Force Hide @@ -174,6 +179,7 @@ Forcer la désactivation Erőltetett rejtett Обязательно: Скрывать + Forza Nascosto Force Show @@ -185,6 +191,7 @@ Forcer l'affichage Erőltetett látható Обязательно: Показывать + Forza Mostra Show crew info? @@ -196,6 +203,7 @@ Afficher les informations de l'équipage? Legénységi adatok megjelenítése? Показывать экипаж? + Mostra informazioni equipaggio? Show vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force @@ -207,6 +215,7 @@ 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 Показывать информацию об экипаже техники, или по-умолчанию, позволяет игрокам выбрать свою настройку. По-умолчанию: Не обязывать + Mostra informazioni sull'equipaggio del veicolo, oppure consenti di default di lasciare che siano i giocatori a scegliere. Default: Non Forzare Show for Vehicles @@ -218,6 +227,7 @@ Montrer pour les véhicules Mutatás járműveknél Показывать для техники + Mostra per Veicoli Show cursor NameTag for vehicle commander (only if client has name tags enabled) Default: No @@ -228,6 +238,7 @@ 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 + Mostra il nome sul cursore per il comandante del veicolo (solo se il client ha le Etichette Nomi attive) Default: No This module allows you to customize settings and range of Name Tags. @@ -239,6 +250,7 @@ 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. Этот модуль позволяет настроить опции и дистанцию отображения имен игроков. + Questo modulo ti consente di personalizzare le impostazioni ed il raggio delle Etichette Nomi Only on Cursor @@ -250,6 +262,7 @@ Seulement sous le curseur Csak kurzorra Только под курсором + Solo su Cursore Only on Keypress @@ -261,6 +274,7 @@ Seulement par appui de touche Csak gombnyomásra Только по нажатию клавиши + Solo quando Premi Tasto Only on Cursor and Keypress @@ -272,6 +286,7 @@ Seulement sous le curseur et par appui de touche Csak kurzorra és gombnyomásra Под курсором или по нажатию клавиши + Solo su Cursore e quando Premi Tasto Force Show Only on Cursor @@ -283,6 +298,7 @@ Forcer l'affichage sous le curseur uniquement Erőltetett látható, csak kurzorra Обязательно: Только под курсором + Forza Mostra solo su Cursore Force Show Only on Keypress @@ -294,6 +310,7 @@ Forcer l'affichage par appui de touche uniquement Erőltetett látható, csak gombnyomásra Обязательно: Только по нажатию клавиши + Forza Mostra solo quando Premi Tasto Force Show Only on Cursor and Keypress @@ -305,6 +322,7 @@ Forcer l'affichage sous le curseur et par appui de touche uniquement Erőltetett látható, csak kurzorra és gombnyomásra Обязательно: Под курсором или по нажатию клавиши + Forza Mostra solo su Cursore e quando Premi Tasto Use Nametag settings @@ -316,6 +334,7 @@ Utiliser les paramètre des NamesTags Névcímkék beállításának használata Так же, как имена + Usa impostazioni Etichette Nomi Always Show All @@ -327,6 +346,7 @@ Toujours montrer tout Mindig minden mutatása Всегда показывать + Mostra Sempre Tutto Show player names and set their activation. Default: Enabled @@ -338,6 +358,7 @@ 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 Показывать имена игроков и установить их активацию. По-умолчанию: Включено + Mostra nomi giocatori ed imposta la loro attivazione. Default: Abilitato Effect of sound waves above the heads of speaking players after holding the PTT key. This option works with TFAR and ACRE2. @@ -349,6 +370,7 @@ 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. + Effetto delle onde sonore sopra la testa dei giocatori parlanti quando premono il tasto PTT. Questa opzione funziona con TFAR ed ACRE2 Nametags Size @@ -360,6 +382,7 @@ Taille des noms Névcímkék mérete Размер имен игроков + Dimensione Etichette Nome Text and Icon Size Scaling @@ -371,6 +394,7 @@ Taille du texte et des icones Szöveg és ikon méretének skálázása Масштабирование размера текста и иконок + Proporzione Dimensioni Testo ed Icone diff --git a/addons/nightvision/CfgEventHandlers.hpp b/addons/nightvision/CfgEventHandlers.hpp index 380f190f47..152887a24a 100644 --- a/addons/nightvision/CfgEventHandlers.hpp +++ b/addons/nightvision/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit) ); @@ -6,14 +13,18 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) ); + clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient)); }; }; -class Extended_FiredBIS_EventHandlers { - class AllVehicles { - class ADDON { - clientFiredBIS = QUOTE( _this call FUNC(blending) ); - }; +class Extended_DisplayLoad_EventHandlers { + class RscDisplayCurator { + ADDON = QUOTE(_this call FUNC(updatePPEffects)); + }; +}; + +class Extended_DisplayUnload_EventHandlers { + class RscDisplayCurator { + ADDON = QUOTE(displayNull call FUNC(updatePPEffects)); // emulate zeus display being deleted }; }; diff --git a/addons/nightvision/XEH_PREP.hpp b/addons/nightvision/XEH_PREP.hpp new file mode 100644 index 0000000000..251c8cc5dd --- /dev/null +++ b/addons/nightvision/XEH_PREP.hpp @@ -0,0 +1,7 @@ + +PREP(blending); +PREP(changeNVGBrightness); +PREP(initModule); +PREP(onCameraViewChanged); +PREP(onVisionModeChanged); +PREP(updatePPEffects); diff --git a/addons/nightvision/XEH_postInitClient.sqf b/addons/nightvision/XEH_postInitClient.sqf index 0df7270317..17cb92f9cc 100644 --- a/addons/nightvision/XEH_postInitClient.sqf +++ b/addons/nightvision/XEH_postInitClient.sqf @@ -34,7 +34,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; _this call FUNC(updatePPEffects); _this call FUNC(onVisionModeChanged); }] call EFUNC(common,addEventHandler); -["zeusDisplayChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); + ["cameraViewChanged", { _this call FUNC(updatePPEffects); _this call FUNC(onCameraViewChanged); @@ -70,3 +70,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; }, {false}, [209, [false, false, true]], false] call CBA_fnc_addKeybind; //PageDown + ALT + +// Register fire event handler +["firedPlayer", DFUNC(blending)] call EFUNC(common,addEventHandler); +["firedPlayerVehicle", DFUNC(blending)] call EFUNC(common,addEventHandler); diff --git a/addons/nightvision/XEH_preInit.sqf b/addons/nightvision/XEH_preInit.sqf index ed02b9524e..a7feade1c3 100644 --- a/addons/nightvision/XEH_preInit.sqf +++ b/addons/nightvision/XEH_preInit.sqf @@ -2,11 +2,6 @@ ADDON = false; -PREP(blending); -PREP(changeNVGBrightness); -PREP(initModule); -PREP(onCameraViewChanged); -PREP(onVisionModeChanged); -PREP(updatePPEffects); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/nightvision/XEH_preStart.sqf b/addons/nightvision/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/nightvision/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/nightvision/functions/fnc_blending.sqf b/addons/nightvision/functions/fnc_blending.sqf index 42d586248d..b34584a5d0 100644 --- a/addons/nightvision/functions/fnc_blending.sqf +++ b/addons/nightvision/functions/fnc_blending.sqf @@ -1,15 +1,9 @@ /* * Author: commy2 - * Change the blending when the player fires?? + * Change the blending when the player fires??. Called from the unified fired EH only for the local player and his vehicle. * * Arguments: - * 0: unit - Object the event handler is assigned to - * 1: weapon - Fired weapon - * 2: muzzle - Muzzle that was used - * 3: mode - Current mode of the fired weapon - * 4: ammo - Ammo used - * 5: magazine - magazine name which was used - * 6: projectile - Object of the projectile that was shot + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Nothing @@ -21,17 +15,14 @@ */ #include "script_component.hpp" -if (!hasInterface) exitWith {}; - -params ["_vehicle", "_weapon", "", "", "_ammo", "_magazine"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); 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 {}; +if ((currentVisionMode _player) != 1) exitWith {}; private["_darkness", "_nvgBrightnessCoef", "_silencer", "_visibleFire", "_visibleFireCoef", "_visibleFireTime", "_visibleFireTimeCoef"]; diff --git a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf index 116ab9b5a5..9f02323787 100644 --- a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf +++ b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: The Unit - * 1: Change in brightness (1 or -1) + * 1: Change in brightness (1 or -1) * * Return Value: * Nothing diff --git a/addons/nightvision/functions/fnc_updatePPEffects.sqf b/addons/nightvision/functions/fnc_updatePPEffects.sqf index 72cd6cbd0d..9bf8321353 100644 --- a/addons/nightvision/functions/fnc_updatePPEffects.sqf +++ b/addons/nightvision/functions/fnc_updatePPEffects.sqf @@ -17,12 +17,20 @@ if (!hasInterface) exitWith {}; +disableSerialization; + +params [["_display", displayNull]]; + +if !(_display isEqualType displayNull) then { + _display = displayNull; +}; + private ["_currentVehicle", "_grainSetting", "_blurSetting", "_radBlurSetting", "_config", "_hmd", "_cameraView", "_turret"]; _currentVehicle = vehicle ACE_player; // If the Zeus display is on or the player has no nightvision -if ((!isNull findDisplay 312) || ((currentVisionMode ACE_player) != 1)) exitWith { +if (ctrlIDD _display == 312 || currentVisionMode ACE_player != 1) exitWith { GVAR(ppEffectFilmGrain) ppEffectEnable false; GVAR(ppEffectBlur) ppEffectEnable false; GVAR(ppEffectRadialBlur) ppEffectEnable false; diff --git a/addons/nightvision/script_component.hpp b/addons/nightvision/script_component.hpp index 9afeeb5d8d..ffe3ba3ff5 100644 --- a/addons/nightvision/script_component.hpp +++ b/addons/nightvision/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_NIGHTVISION #define DEBUG_MODE_FULL diff --git a/addons/nightvision/stringtable.xml b/addons/nightvision/stringtable.xml index 2a38b86c54..eb428e5720 100644 --- a/addons/nightvision/stringtable.xml +++ b/addons/nightvision/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -138,24 +138,36 @@ Nachtsicht Ночное виденье Visão Noturna + Noční vidění + Noktowizja + Visione Notturna Settings for night vision. Einstellungen für Nachtsichtgeräte. Настройки ночного виденья Ajustes para visão noturna. + Nastavení nočního vidění + Ustawienia noktowizorów + Impostazioni per visione notturna. Disable NVGs in scope - Deakt. NVGs mit Visier + Deakt. NS mit Visier Убирать ПНВ при прицеливании Desabilitar visão noturna nas lunetas + Zakázat NVG v zaměřovači + Wył. NVG przy celowaniu + Disabilita NVG nei mirini Blocks the usage of night vision goggles whilst aiming down the sight. - Blockiert das Benutzen von Nachtsichtbrillen beim Benutzen des Visiers. + Blockiert die Nachtsichtbrillen beim Verwenden des Visiers. Блокирует использование головного ПНВ при прицеливании через прицел. Bloqueia o uso de visão noturna ao utilizar a mira. + Zabraňuje používání nokovizoru v režimu zaměřovače. + Uniemożliwia korzystanie z gogli noktowizyjnych przy celowaniu. + Blocca l'uso di visori notturni mentre miri con ottiche. \ No newline at end of file diff --git a/addons/noidle/script_component.hpp b/addons/noidle/script_component.hpp index 5a7623b0ba..bf20a9a420 100644 --- a/addons/noidle/script_component.hpp +++ b/addons/noidle/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT noidle #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_NOIDLE #define DEBUG_MODE_FULL #endif diff --git a/addons/noradio/script_component.hpp b/addons/noradio/script_component.hpp index 16b7e9b549..0a60edb063 100644 --- a/addons/noradio/script_component.hpp +++ b/addons/noradio/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_NORADIO #define DEBUG_MODE_FULL diff --git a/addons/norearm/script_component.hpp b/addons/norearm/script_component.hpp index d2e95ee569..3f09149587 100644 --- a/addons/norearm/script_component.hpp +++ b/addons/norearm/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT norearm #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_NOREARM #define DEBUG_MODE_FULL #endif diff --git a/addons/optics/CfgEventHandlers.hpp b/addons/optics/CfgEventHandlers.hpp index 68962af2c4..becf395052 100644 --- a/addons/optics/CfgEventHandlers.hpp +++ b/addons/optics/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -9,11 +16,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class AGM_Optics { - clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call DFUNC(handleFired)};); - }; - }; -}; diff --git a/addons/optics/XEH_PREP.hpp b/addons/optics/XEH_PREP.hpp new file mode 100644 index 0000000000..2b846a552a --- /dev/null +++ b/addons/optics/XEH_PREP.hpp @@ -0,0 +1,4 @@ + +PREP(handleFired); +PREP(onDrawScope); +PREP(onDrawScope2D); diff --git a/addons/optics/XEH_postInit.sqf b/addons/optics/XEH_postInit.sqf index 2048db76c6..c9667f3931 100644 --- a/addons/optics/XEH_postInit.sqf +++ b/addons/optics/XEH_postInit.sqf @@ -10,7 +10,7 @@ GVAR(camera) = objNull; if ((!isNil {is3DEN}) && {is3DEN}) exitWith { ACE_LOGINFO("Eden detected: disabling Optics PIP Camera"); }; - + waitUntil {!isNull ACE_player}; waitUntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}}; @@ -50,3 +50,6 @@ GVAR(camera) = objNull; GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; }; }] call EFUNC(common,addEventHandler); + +// Register fire event handler +["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); diff --git a/addons/optics/XEH_preInit.sqf b/addons/optics/XEH_preInit.sqf index 9616b7158a..a7feade1c3 100644 --- a/addons/optics/XEH_preInit.sqf +++ b/addons/optics/XEH_preInit.sqf @@ -2,8 +2,6 @@ ADDON = false; -PREP(handleFired); -PREP(onDrawScope); -PREP(onDrawScope2D); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/optics/XEH_preStart.sqf b/addons/optics/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/optics/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/optics/functions/fnc_handleFired.sqf b/addons/optics/functions/fnc_handleFired.sqf index f0399c37fc..299b2c30f4 100644 --- a/addons/optics/functions/fnc_handleFired.sqf +++ b/addons/optics/functions/fnc_handleFired.sqf @@ -2,26 +2,18 @@ * Original Author: Taosenai * Adapted By: KoffeinFlummi, commy2 * - * Animates the scope when firing. + * Animates the scope when firing. Called from the unified fired EH only for the local player. * * Arguments: - * 0: Unit (Object) - * 1: Weapon (String) - * 2: Muzzle (String) - * 3: Mode (String) - * 4: Ammo (Object) - * 5: Magazine (String) - * 6: Projectile (Object) + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None */ #include "script_component.hpp" -private ["_unit", "_weapon"]; - -_unit = _this select 0; -_weapon = _this select 1; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // check if compatible scope is used private "_display"; diff --git a/addons/optics/script_component.hpp b/addons/optics/script_component.hpp index 58b2d4756a..ca0176360c 100644 --- a/addons/optics/script_component.hpp +++ b/addons/optics/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT optics #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_OPTICS #define DEBUG_MODE_FULL #endif diff --git a/addons/optics/stringtable.xml b/addons/optics/stringtable.xml index a6818a90d3..4fafdb1996 100644 --- a/addons/optics/stringtable.xml +++ b/addons/optics/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/optionsmenu/CfgEventHandlers.hpp b/addons/optionsmenu/CfgEventHandlers.hpp index 917a0acbd7..d6451e638d 100644 --- a/addons/optionsmenu/CfgEventHandlers.hpp +++ b/addons/optionsmenu/CfgEventHandlers.hpp @@ -1,10 +1,27 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + 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_DisplayLoad_EventHandlers { + class RscDisplayMain { + GVAR(loadMainMenuBox) = QUOTE(_this call COMPILE_FILE(init_loadMainMenuBox)); + + //Hide the button if there is no world (-world=empty) + GVAR(hideButtonEmptyWorld) = "((_this select 0) displayCtrl 80085) ctrlShow (missionName != '');"; + }; +}; diff --git a/addons/optionsmenu/XEH_PREP.hpp b/addons/optionsmenu/XEH_PREP.hpp new file mode 100644 index 0000000000..f1ffe1ed98 --- /dev/null +++ b/addons/optionsmenu/XEH_PREP.hpp @@ -0,0 +1,22 @@ + +PREP(debugDumpToClipboard); +PREP(onListBoxSettingsChanged); +PREP(onListBoxShowSelectionChanged); +PREP(onSettingsMenuOpen); +PREP(onSliderPosChanged); +PREP(onServerSaveInputField); +PREP(onServerSettingsMenuOpen); +PREP(onServerListBoxShowSelectionChanged); +PREP(onCategorySelectChanged); +PREP(resetSettings); +PREP(serverResetSettings); +PREP(settingsMenuUpdateKeyView); +PREP(settingsMenuUpdateList); +PREP(serverSettingsMenuUpdateKeyView); +PREP(serverSettingsMenuUpdateList); +PREP(onServerCategorySelectChanged); +PREP(updateSetting); +PREP(exportSettings); +PREP(toggleIncludeClientSettings); +PREP(moduleAllowConfigExport); +PREP(stringEscape); diff --git a/addons/optionsmenu/XEH_preInit.sqf b/addons/optionsmenu/XEH_preInit.sqf index 21f64c4f46..8b6f55a0ca 100644 --- a/addons/optionsmenu/XEH_preInit.sqf +++ b/addons/optionsmenu/XEH_preInit.sqf @@ -2,27 +2,7 @@ ADDON = false; -PREP(debugDumpToClipboard); -PREP(onListBoxSettingsChanged); -PREP(onListBoxShowSelectionChanged); -PREP(onSettingsMenuOpen); -PREP(onSliderPosChanged); -PREP(onServerSaveInputField); -PREP(onServerSettingsMenuOpen); -PREP(onServerListBoxShowSelectionChanged); -PREP(onCategorySelectChanged); -PREP(resetSettings); -PREP(serverResetSettings); -PREP(settingsMenuUpdateKeyView); -PREP(settingsMenuUpdateList); -PREP(serverSettingsMenuUpdateKeyView); -PREP(serverSettingsMenuUpdateList); -PREP(onServerCategorySelectChanged); -PREP(updateSetting); -PREP(exportSettings); -PREP(toggleIncludeClientSettings); -PREP(moduleAllowConfigExport); -PREP(stringEscape); +#include "XEH_PREP.hpp" GVAR(clientSideOptions) = []; GVAR(clientSideColors) = []; diff --git a/addons/optionsmenu/XEH_preStart.sqf b/addons/optionsmenu/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/optionsmenu/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/optionsmenu/gui/pauseMenu.hpp b/addons/optionsmenu/gui/pauseMenu.hpp index 3333c5476f..2c14aecc99 100644 --- a/addons/optionsmenu/gui/pauseMenu.hpp +++ b/addons/optionsmenu/gui/pauseMenu.hpp @@ -101,10 +101,6 @@ class RscDisplayMovieInterrupt: RscStandardDisplay { }; }; class RscDisplayMain: RscStandardDisplay { - //Hide the button if there is no world (-world=empty) - //Seems odd to use onMouseMoving, but I don't want to overload onLoad - onMouseMoving = QUOTE(((_this select 0) displayCtrl 80085) ctrlShow (missionName != ''); _this execVM QUOTE(QUOTE(PATHTOF(script_loadMainMenuBox.sqf)));); - class controls { class ACE_Open_settingsMenu_Btn : ACE_Open_SettingsMenu_BtnBase { action = "if (missionName != '') then {createDialog 'ACE_settingsMenu';};"; diff --git a/addons/optionsmenu/script_loadMainMenuBox.sqf b/addons/optionsmenu/init_loadMainMenuBox.sqf similarity index 100% rename from addons/optionsmenu/script_loadMainMenuBox.sqf rename to addons/optionsmenu/init_loadMainMenuBox.sqf diff --git a/addons/optionsmenu/script_component.hpp b/addons/optionsmenu/script_component.hpp index d25caa2c42..b257b0a5ba 100644 --- a/addons/optionsmenu/script_component.hpp +++ b/addons/optionsmenu/script_component.hpp @@ -1,6 +1,9 @@ #define COMPONENT optionsmenu // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #include "\z\ace\addons\main\script_mod.hpp" diff --git a/addons/optionsmenu/stringtable.xml b/addons/optionsmenu/stringtable.xml index 129f995cd7..21fff4033d 100644 --- a/addons/optionsmenu/stringtable.xml +++ b/addons/optionsmenu/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -212,7 +212,7 @@ Měřítko UI v menu nastavení Размер интерфейса меню настройки Opción de escalado del menú IU - UI Skalierung + Nutzeroberflächen-Skalierung Beállításmenü kezelőfelületének skálázása Escalar o menu de opções Proporzioni della interfaccia utente @@ -227,6 +227,7 @@ Autoriser l'exportation de la configuration [ACE] Konfiguráció-exportálás engedélyezése [ACE] Разрешить экспорт настроек [ACE] + Consenti Esportazione del Config [ACE] Allow @@ -238,6 +239,7 @@ Autoriser Engedélyezés Разрешить + Consenti Allow export of all settings to a server config formatted. @@ -249,6 +251,7 @@ 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. Разрешить экспорт всех настроек в формате серверного конфига. + Consenti esportazione di tutti i parametri ad config formato per server. When allowed, you have access to the settings modification and export in SP. Clicking export will place the formated config on your clipboard. @@ -260,6 +263,7 @@ 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. Когда разршен, у вас появляется доступ к модификации настроек и экспорту их в одинночном режиме. Нажатие на кнопку Экспорт поместит форматированные настройки в буфер обмена. + Quando consentito, hai accesso alle modifiche delle impostazioni ed esportazione in SP. Cliccando Esporta piazzera il config formattato sul tuo Blocco Note. Hide @@ -271,17 +275,19 @@ Cacher Elrejtés Скрыть + Nascondi Top right, downwards Po prawej u góry, w dół Arriba a la derecha, hacia abajo - Open rechts, nach unten + Oben rechts, nach unten Vpravo nahoře, dolů Superior direito, para baixo Haut droit, vers le bas Jobb felül, lefele Справа — сверху вниз + In Alto a Destra, verso il Basso Top right, to the left @@ -293,6 +299,7 @@ Haut droit, vers la gauche Jobb felül, balra Сверху — справа налево + In Alto a Destra, verso Sinistra Top left, downwards @@ -304,6 +311,7 @@ Haut gauche, vers le bas Bal felül, lefele Слева - сверху вниз + In Alto a Sinistra, verso il Basso Top left, to the right @@ -315,6 +323,7 @@ Haut gauche, vers la droite Bal felül, jobbra Сверху — слева направо + In Alto a Sinistra, verso Destra Top @@ -326,6 +335,7 @@ Haut Fent Сверху + Alto Bottom @@ -337,6 +347,7 @@ Bas Alul Снизу + Basso Debug To Clipboard @@ -348,6 +359,7 @@ Debug vers le presse papier Debug a vágólapra Отладка в буфер обмена + Debug su Blocco Note Sends debug information to RPT and clipboard. @@ -356,10 +368,14 @@ Pošle debug informace do RPT a schránky. Protokolliert Debug-Informationen im RPT und speichert sie in der Zwischenablage. Envia informação de depuração para RPT e área de transferência. + Copie le Debug dans le RPT et le presse papier + Debug információt küld az RPT-be és a vágólapra. Отправляет отладочную информацию в RPT и буфер обмена. + Invia informazioni di debug all'RPT e al Blocco Note Headbug Fix + Behebe Headbug Fix Headbug HeadBug "Fejhiba" fix @@ -367,9 +383,11 @@ Fix Headbug Fix Headbug Corregir error de cabeza (headbug) + Sistema Headbug Resets your animation state. + Setzt die derzeitige Animation zurück. Resetuje aktualną animację. Réinitialise l'état de l'animation Visszaállítja az animációs állapotodat. @@ -377,6 +395,7 @@ Исправляет баг с зациклившейся анимацией. Resetovat aktuální animaci. Restablece tu estado de animación. + Resetta il tuo stato animazione ACE News @@ -388,6 +407,7 @@ Nouveautés ACE ACE hírek Новости ACE + News ACE Show News on Main Menu @@ -399,22 +419,27 @@ Hírek mutatása a főmenüben Показывать новости в Главном Меню Zobrazit zprávy v hlavním menu + Mostra News nel Menù Princinpale All Categories + Alle Kategorien Wszystkie kategorie Todas categorias Все категории Všechny Kategorie Todas las categorías + Tutte le Categorie Logistics + Logistik Logistyka Logística Логистика Logistika Logística + Logistica \ No newline at end of file diff --git a/addons/overheating/ACE_Settings.hpp b/addons/overheating/ACE_Settings.hpp index 2d63614a40..c5a514e5e2 100644 --- a/addons/overheating/ACE_Settings.hpp +++ b/addons/overheating/ACE_Settings.hpp @@ -3,7 +3,27 @@ class ACE_Settings { typeName = "BOOL"; isClientSettable = 1; value = 1; - displayName = CSTRING(SettingDisplayTextName); - description = CSTRING(SettingDisplayTextDesc); + displayName = CSTRING(DisplayTextOnJam_displayName); + description = CSTRING(DisplayTextOnJam_description); + }; + class GVAR(showParticleEffects) { + typeName = "BOOL"; + isClientSettable = 1; + value = 1; + displayName = CSTRING(showParticleEffects_displayName); + description = CSTRING(showParticleEffects_description); + }; + class GVAR(showParticleEffectsForEveryone) { + typeName = "BOOL"; + isClientSettable = 1; + value = 0; + displayName = CSTRING(showParticleEffectsForEveryone_displayName); + description = CSTRING(showParticleEffectsForEveryone_description); + }; + class GVAR(overheatingDispersion) { + typeName = "BOOL"; + value = 1; + displayName = CSTRING(overheatingDispersion_displayName); + description = CSTRING(overheatingDispersion_description); }; }; diff --git a/addons/overheating/CfgEventHandlers.hpp b/addons/overheating/CfgEventHandlers.hpp index f06e95788e..492230513f 100644 --- a/addons/overheating/CfgEventHandlers.hpp +++ b/addons/overheating/CfgEventHandlers.hpp @@ -1,7 +1,14 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); - }; + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; }; class Extended_PostInit_EventHandlers { @@ -10,18 +17,10 @@ class Extended_PostInit_EventHandlers { }; }; -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class GVAR(Overheat) { - clientFiredBIS = QUOTE( if (_this select 0 == ACE_player) then {_this call FUNC(overheat)}; ); - }; - }; -}; - class Extended_Take_EventHandlers { class CAManBase { class GVAR(UnjamReload) { - clientTake = QUOTE( if (_this select 0 == ACE_player && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {_vehicle = vehicle (_this select 0); [ARR_3(_vehicle, currentWeapon _vehicle, true)] call FUNC(clearJam)}; ); + clientTake = QUOTE( _this call FUNC(handleTakeEH) ); }; }; }; diff --git a/addons/overheating/CfgWeapons.hpp b/addons/overheating/CfgWeapons.hpp index 5c9717dbcf..f59c4d7911 100644 --- a/addons/overheating/CfgWeapons.hpp +++ b/addons/overheating/CfgWeapons.hpp @@ -13,133 +13,43 @@ class CfgWeapons { }; }; - class Rifle; - class Rifle_Base_F : Rifle { - // Dispersion, SlowdownFactor and JamChance arrays have 4 values for different temperatures, which are interpolated between. - // These values correspond to temperatures Converted to real life values: 0: 0°C, 1: 333°C, 2: 666°C, 3: 1000°C. + class RifleCore; + class Rifle: RifleCore { + //Mean Rounds Between Stoppages (this will be scaled based on the barrel temp) + GVAR(mrbs) = 3000; - // Dispersion in radians. First value is for temp. 0, second for temp. 1 and so on. Values inbetween get interpolated. Negative values get ignored and can be used to move the starting point to hotter temperatures. - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - // How much the projectile gets slowed down before leaving the barrel. 0.9 means the bullet will lose 10% velocity. Values inbetween get interpolated. Numbers greater 1 increase the velocity, smaller 1 decrease it. - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - // Chance to jam the weapon. 0.0003 means 3 malfunctions on 10,000 rounds fired at this temperature. Values inbetween get interpolated. Negative values get ignored and can be used to move the starting point to hotter temperatures. - // When no reliable data exists for temperature vs. jam chance except MRBS, the following uniform criteria was adopted: [0, 1/MRBS, 5/MRBS, 25/MRBS]. - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + //Dispersion Factor (this will be scaled based on the barrel temp) + GVAR(dispersion) = 1; + + //Slowdown Factor (this will be scaled based on the barrel temp) + GVAR(slowdownFactor) = 1; }; - + class Rifle_Base_F : Rifle {}; class Rifle_Long_Base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + GVAR(dispersion) = 0.75; }; class arifle_MX_Base_F : Rifle_Base_F { - ACE_clearJamAction = "GestureReloadMX"; // Custom jam clearing action. Default uses reload animation. - ACE_checkTemperatureAction = "Gear"; // Custom check temperature action. Default uses gear animation. - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + // Custom jam clearing action. Default uses reload animation. + ACE_clearJamAction = "GestureReloadMX"; }; - - class MMG_02_base_F: Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class MMG_01_base_F: Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - class arifle_MX_SW_F : arifle_MX_Base_F { - ACE_clearJamAction = ""; // Custom jam clearing action. Use empty string to undefine. - ACE_Overheating_allowSwapBarrel = 1; // 1 to enable barrel swap. 0 to disable. Meant for machine guns where you can easily swap the barrel without dismantling the whole weapon. - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + // Custom jam clearing action. Use empty string to undefine. + ACE_clearJamAction = ""; + // 1 to enable barrel swap. 0 to disable. Meant for machine guns where you can easily swap the barrel without dismantling the whole weapon. + GVAR(allowSwapBarrel) = 1; + GVAR(dispersion) = 0.75; }; - - class arifle_Katiba_Base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + class MMG_01_base_F: Rifle_Long_Base_F { + GVAR(allowSwapBarrel) = 1; }; - - class mk20_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + class MMG_02_base_F: Rifle_Long_Base_F { + GVAR(allowSwapBarrel) = 1; }; - - class Tavor_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class SDAR_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class EBR_base_F : Rifle_Long_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class DMR_01_base_F : Rifle_Long_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class GM6_base_F : Rifle_Long_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class LRR_base_F : Rifle_Long_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class LMG_Mk200_F : Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - class LMG_Zafir_F : Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + GVAR(allowSwapBarrel) = 1; }; - - class SMG_01_Base : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class SMG_02_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class pdw2000_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + class LMG_Mk200_F : Rifle_Long_Base_F { + GVAR(allowSwapBarrel) = 1; }; }; diff --git a/addons/overheating/XEH_PREP.hpp b/addons/overheating/XEH_PREP.hpp new file mode 100644 index 0000000000..76bdef2bef --- /dev/null +++ b/addons/overheating/XEH_PREP.hpp @@ -0,0 +1,13 @@ + +PREP(checkTemperature); +PREP(clearJam); +PREP(displayTemperature); +PREP(firedEH); +PREP(getWeaponData); +PREP(handleTakeEH); +PREP(jamWeapon); +PREP(overheat); +PREP(swapBarrel); +PREP(swapBarrelCallback); +PREP(updateTemperature); +PREP(updateTemperatureThread); diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index c1212af0e8..7bf0ba10d8 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -1,7 +1,21 @@ // by esteldunedain #include "script_component.hpp" -if (!hasInterface) exitWith {}; +if (isServer) then { + GVAR(pseudoRandomList) = []; + // Construct a list of pseudo random 2D vectors + for "_i" from 0 to 30 do { + GVAR(pseudoRandomList) pushBack [-1 + random 2, -1 + random 2]; + }; + publicVariable QGVAR(pseudoRandomList); +}; + + +if !(hasInterface) exitWith {}; + +GVAR(cacheWeaponData) = call CBA_fnc_createNamespace; +GVAR(cacheAmmoData) = call CBA_fnc_createNamespace; +GVAR(cacheSilencerData) = call CBA_fnc_createNamespace; // Add keybinds ["ACE3 Weapons", QGVAR(unjamWeapon), localize LSTRING(UnjamWeapon), @@ -9,7 +23,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon) && + if !([ACE_player] call CBA_fnc_canUseWeapon && {currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])} ) exitWith {false}; @@ -18,4 +32,17 @@ if (!hasInterface) exitWith {}; true }, {false}, -[19, [true, false, false]], false] call CBA_fnc_addKeybind; //R Key +[19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key + + +// Schedule cool down calculation of player weapons at (infrequent) regular intervals +[] call FUNC(updateTemperatureThread); + +["SettingsInitialized", { + // Register fire event handler + ["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + // Only add eh to non local players if dispersion is enabled + if (GVAR(overheatingDispersion)) then { + ["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + }; +}] call EFUNC(common,addEventHandler); diff --git a/addons/overheating/XEH_preInit.sqf b/addons/overheating/XEH_preInit.sqf index 2bd256087b..a7feade1c3 100644 --- a/addons/overheating/XEH_preInit.sqf +++ b/addons/overheating/XEH_preInit.sqf @@ -2,13 +2,6 @@ ADDON = false; -PREP(checkTemperature); -PREP(clearJam); -PREP(cooldown); -PREP(displayTemperature); -PREP(jamWeapon); -PREP(overheat); -PREP(swapBarrel); -PREP(swapBarrelCallback); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/overheating/XEH_preStart.sqf b/addons/overheating/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/overheating/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/overheating/config.cpp b/addons/overheating/config.cpp index 0e899e1b25..c57e55913d 100644 --- a/addons/overheating/config.cpp +++ b/addons/overheating/config.cpp @@ -22,3 +22,29 @@ class CfgPatches { #include "ACE_Settings.hpp" +class CfgMovesBasic { + class ManActions { + GVAR(GestureMountMuzzle) = QGVAR(GestureMountMuzzle); + GVAR(GestureDismountMuzzle) = QGVAR(GestureDismountMuzzle); + }; + + class Actions { + class NoActions: ManActions { + GVAR(GestureMountMuzzle)[] = {QGVAR(GestureMountMuzzle), "Gesture"}; + GVAR(GestureDismountMuzzle)[] = {QGVAR(GestureDismountMuzzle), "Gesture"}; + }; + }; +}; + +class CfgGesturesMale { + class States { + class GestureMountMuzzle; + class GVAR(GestureMountMuzzle): GestureMountMuzzle { + speed = 0.3; + }; + class GestureDismountMuzzle; + class GVAR(GestureDismountMuzzle): GestureDismountMuzzle { + speed = 0.3; + }; + }; +}; \ No newline at end of file diff --git a/addons/overheating/functions/fnc_checkTemperature.sqf b/addons/overheating/functions/fnc_checkTemperature.sqf index 0b811f9792..f720665620 100644 --- a/addons/overheating/functions/fnc_checkTemperature.sqf +++ b/addons/overheating/functions/fnc_checkTemperature.sqf @@ -10,24 +10,23 @@ * None * * Example: - * None + * [player, currentWeapon player] call ace_overheating_fnc_checkTemperature * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); - -private ["_action"]; +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); // Play animation and report temperature -_action = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_checkTemperatureAction"); +private _action = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_checkTemperatureAction"); if (_action == "") then { - _action = "Gear"; + _action = "Gear"; }; _player playActionNow _action; -// Launch a PFH that waits a sec before displaying the temperature -[FUNC(displayTemperature), [_player, _weapon], 1.0, 0] call EFUNC(common,waitAndExecute); \ No newline at end of file +// Waits a sec before displaying the temperature +[FUNC(displayTemperature), [_player, _weapon], 1.0] call EFUNC(common,waitAndExecute); diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf index 1c7e959a98..33039328e4 100644 --- a/addons/overheating/functions/fnc_clearJam.sqf +++ b/addons/overheating/functions/fnc_clearJam.sqf @@ -10,48 +10,48 @@ * Return Value: * None * + * Example: + * [player, currentWeapon player, false] call ace_overheating_fnc_clearJam + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_3_PVT(_this,_unit,_weapon,_skipAnim); +params ["_unit", "_weapon", "_skipAnim"]; +TRACE_3("params",_unit,_weapon,_skipAnim); -private ["_jammedWeapons"]; -_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; +private _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; if (_weapon in _jammedWeapons) then { - _jammedWeapons = _jammedWeapons - [_weapon]; + _jammedWeapons = _jammedWeapons - [_weapon]; - _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; + _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; - if (count _jammedWeapons == 0) then { - private "_id"; - - _id = _unit getVariable [QGVAR(JammingActionID), -1]; - [_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler); - _unit setVariable [QGVAR(JammingActionID), -1]; - }; - - if !(_skipAnim) then { - private "_clearJamAction"; - - _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction"); - - if (_clearJamAction == "") then { - _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); + if (_jammedWeapons isEqualTo []) then { + private _id = _unit getVariable [QGVAR(JammingActionID), -1]; + [_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler); + _unit setVariable [QGVAR(JammingActionID), -1]; }; - _unit playActionNow _clearJamAction; - if (_weapon == primaryWeapon _unit) then { - playSound QGVAR(fixing_rifle); - } else { - if (_weapon == secondaryWeapon _unit) then { - playSound QGVAR(fixing_pistol); - }; - }; - }; + if !(_skipAnim) then { - if (GVAR(DisplayTextOnJam)) then { - [localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured); - }; + private _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction"); + + if (_clearJamAction == "") then { + _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); + }; + + _unit playActionNow _clearJamAction; + if (_weapon == primaryWeapon _unit) then { + playSound QGVAR(fixing_rifle); + } else { + if (_weapon == secondaryWeapon _unit) then { + playSound QGVAR(fixing_pistol); + }; + }; + }; + + if (GVAR(DisplayTextOnJam)) then { + [localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured); + }; }; diff --git a/addons/overheating/functions/fnc_cooldown.sqf b/addons/overheating/functions/fnc_cooldown.sqf deleted file mode 100644 index 52052c7251..0000000000 --- a/addons/overheating/functions/fnc_cooldown.sqf +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: esteldunedain - * Calculate cooling down of the weapon. - * - * Argument: - * 0: Last temperature - * 1: Barrel mass - * 2: Time - * - * Return value: - * New temperature - * - * Public: No - */ -#include "\z\ace\addons\overheating\script_component.hpp" - -EXPLODE_3_PVT(_this,_temperature,_barrelMass,_totalTime); - -// If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool -if (_totalTime > 1800) exitWith {0}; - -private ["_barrelSurface", "_time", "_deltaTime"]; -_barrelSurface = _barrelMass / 7850 / 0.003; - -_time = 0; -while {true} do { - _deltaTime = (_totalTime - _time) min 20; - - _temperature = _temperature - ( - // Convective cooling - 25 * _barrelSurface * _temperature - // Radiative cooling - + 0.4 * 5.67e-8 * _barrelSurface * - ( (_temperature + 273.15)*(_temperature + 273.15) - * (_temperature + 273.15)*(_temperature + 273.15) - - 273.15 * 273.15 * 273.15 *273.15 ) - ) * _deltaTime / (_barrelMass * 466); - - if (_temperature < 1) exitWith {0}; - - if (isNil "_temperature") exitWith { - ACE_LOGERROR_3("_totalTime = %1; _time = %2; _deltaTime = %3;",_totalTime,_time,_deltaTime); - 0 - }; - - _time = _time + _deltaTime; - if (_time >= _totalTime) exitWith { _temperature max 0 }; -}; diff --git a/addons/overheating/functions/fnc_displayTemperature.sqf b/addons/overheating/functions/fnc_displayTemperature.sqf index 73c790119d..b2b8d2b4c0 100644 --- a/addons/overheating/functions/fnc_displayTemperature.sqf +++ b/addons/overheating/functions/fnc_displayTemperature.sqf @@ -9,57 +9,40 @@ * Return Values: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_displayTemperature + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); // Calculate cool down of weapon since last shot -private ["_string", "_overheat", "_temperature", "_time", "_barrelMass", "_a"]; -_string = format [QGVAR(%1), _weapon]; -_overheat = _player getVariable [_string, [0, 0]]; -_temperature = _overheat select 0; -_time = _overheat select 1; +private _temperature = [_player, _weapon, 0] call FUNC(updateTemperature); +private _scaledTemperature = (_temperature / 1000) min 1; -// Get physical parameters -_barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; - -// Calculate cooling -_temperature = [_temperature, _barrelMass, ACE_time - _time] call FUNC(cooldown); - -// Store new temperature -_time = ACE_time; -_player setVariable [_string, [_temperature, _time], false]; - - - -private ["_scaledTemperature", "_action", "_color", "_count", "_string", "_text", "_picture"]; -_scaledTemperature = (_temperature / 1000) min 1; - -_color = [ - 2 * _scaledTemperature min 1, - 2 * (1 - _scaledTemperature) min 1, - 00 +private _color = [ + 2 * (_scaledTemperature * 2 min 1) min 1, + 2 * (1 - (_scaledTemperature * 2 min 1)) min 1, + 00 ]; -_count = round (12 * _scaledTemperature); -_string = ""; +private _count = round (12 * _scaledTemperature); +private _string = ""; for "_a" from 1 to _count do { - _string = _string + "|"; + _string = _string + "|"; }; -_text = [_string, _color] call EFUNC(common,stringToColoredText); +private _text = [_string, _color] call EFUNC(common,stringToColoredText); _string = ""; for "_a" from (_count + 1) to 12 do { - _string = _string + "|"; + _string = _string + "|"; }; -_text = composeText [ - _text, - [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText) -]; +_text = composeText [_text, [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)]; -_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); +private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); [_text, _picture] call EFUNC(common,displayTextPicture); diff --git a/addons/overheating/functions/fnc_firedEH.sqf b/addons/overheating/functions/fnc_firedEH.sqf new file mode 100644 index 0000000000..604a2bb31d --- /dev/null +++ b/addons/overheating/functions/fnc_firedEH.sqf @@ -0,0 +1,113 @@ +/* + * Author: Commy2 and esteldunedain + * Handle weapon fire. Called from the unified fired EH 1- always for the local player 2- and for non local players if dispersion is simulated. + * + * Argument: + * None. Parameters inherited from EFUNC(common,firedEH) + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); + +BEGIN_COUNTER(firedEH); + +if ((_unit distance ACE_player) > 3000 //Ignore far away shots + || {(_muzzle != (primaryWeapon _unit)) && {_muzzle != (handgunWeapon _unit)}}) exitWith { // Only rifle or pistol muzzles (ignore grenades / GLs) + END_COUNTER(firedEH); +}; + +// Compute new temperature if the unit is the local player +if (_unit == ACE_player) then { + _this call FUNC(overheat); +}; + +// Get current temperature from the unit variable +private _temperature = _unit getVariable [format [QGVAR(%1_temp), _weapon], 0]; +private _scaledTemperature = linearConversion [0, 1000, _temperature, 0, 1, true]; + +TRACE_2("Unit fired with temp:",_unit,_temperature); + +//Get weapon data from cache: +([_weapon] call FUNC(getWeaponData)) params ["_dispersion", "_slowdownFactor", "_jamChance"]; +TRACE_4("weapon data from cache",_weapon,_dispersion,_slowdownFactor,_jamChance); + +// Dispersion and bullet slow down +if (GVAR(overheatingDispersion)) then { + // Exit if GVAR(pseudoRandomList) isn't synced yet + if (isNil QGVAR(pseudoRandomList)) exitWith {ACE_LOGERROR("No pseudoRandomList sync");}; + + //Dispersion: 0 mils @ 0°C, 0.5 mils @ 333°C, 2.2 mils @ 666°C, 5 mils at 1000°C + _dispersion = _dispersion * 0.28125 * (_scaledTemperature^2); + + _slowdownFactor = _slowdownFactor * linearConversion [0.666, 1, _scaledTemperature, 0, -0.1, true]; + + // Get the pseudo random values for dispersion from the remaining ammo count + (GVAR(pseudoRandomList) select ((_unit ammo _weapon) mod (count GVAR(pseudoRandomList)))) params ["_dispersionX", "_dispersionY"]; + + TRACE_4("change",_dispersion,_slowdownFactor,_dispersionX,_dispersionY); + + TRACE_PROJECTILE_INFO(_projectile); + [_projectile, _dispersionX * _dispersion, _dispersionY * _dispersion, _slowdownFactor * vectorMagnitude (velocity _projectile)] call EFUNC(common,changeProjectileDirection); + TRACE_PROJECTILE_INFO(_projectile); +}; + + +// ------ LOCAL AND NEARBY PLAYERS DEPENDING ON SETTINGS ------------ +// Particle effects only apply to the local player and, depending on settings, to other nearby players +if (_unit != ACE_player && (!GVAR(showParticleEffectsForEveryone) || {_unit distance ACE_player > 20})) exitWith { + END_COUNTER(firedEH); +}; + +//Particle Effects: +if (GVAR(showParticleEffects) && {(ACE_time > ((_unit getVariable [QGVAR(lastDrop), -1000]) + 0.40)) && {_scaledTemperature > 0.1}}) then { + _unit setVariable [QGVAR(lastDrop), ACE_time]; + + private _direction = (_unit weaponDirection _weapon) vectorMultiply 0.25; + private _position = (position _projectile) vectorAdd (_direction vectorMultiply (4*(random 0.30))); + + // Refract SFX, beginning at temp 100°C and maxs out at 500°C + private _intensity = linearConversion [0.1, 0.5, _scaledTemperature, 0, 1, true]; + TRACE_3("refract",_direction,_position,_intensity); + if (_intensity > 0) then { + drop [ + "\A3\data_f\ParticleEffects\Universal\Refract", "", "Billboard", 10, 2, _position, _direction, 0, 1.2, 1.0, + 0.1, [0.10,0.25], [[0.6,0.6,0.6,0.3*_intensity],[0.2,0.2,0.2,0.05*_intensity]], [0,1], 0.1, 0.05, "", "", ""]; + }; + // Smoke SFX, beginning at temp 150°C + private _intensity = linearConversion [0.15, 1, _scaledTemperature, 0, 1, true]; + TRACE_3("smoke",_direction,_position,_intensity); + if (_intensity > 0) then { + drop [ + ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 1, 16], "", "Billboard", 10, 1.2, _position, + [0,0,0.15], 100 + random 80, 1.275, 1, 0.025, [0.15,0.43], [[0.6,0.6,0.6,0.5*_intensity],[0.2,0.2,0.2,0.15*_intensity]], + [0,1], 1, 0.04, "", "", ""]; + }; +}; + +// ------ LOCAL PLAYER ONLY ------------ +// Only compute jamming for the local player +if (_unit != ACE_player) exitWith {END_COUNTER(firedEH);}; + +_jamChance = _jamChance * ([[0.5, 1.5, 7.5, 37.5], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)); + +// increase jam chance on dusty grounds if prone (and at ground level) +if ((stance _unit == "PRONE") && {((getPosATL _unit) select 2) < 1}) then { + private _surface = configFile >> "CfgSurfaces" >> ((surfaceType getPosASL _unit) select [1]); + if (isClass _surface) then { + TRACE_1("dust",getNumber (_surface >> "dust")); + _jamChance = _jamChance + (getNumber (_surface >> "dust")) * _jamChance; + }; +}; + +TRACE_3("check for random jam",_unit,_weapon,_jamChance); +if ((random 1) < _jamChance) then { + [_unit, _weapon] call FUNC(jamWeapon); +}; + +END_COUNTER(firedEH); diff --git a/addons/overheating/functions/fnc_getWeaponData.sqf b/addons/overheating/functions/fnc_getWeaponData.sqf new file mode 100644 index 0000000000..e7da350e91 --- /dev/null +++ b/addons/overheating/functions/fnc_getWeaponData.sqf @@ -0,0 +1,68 @@ +/* + * Author: PabstMirror and esteldunedain + * Get weapon data with caching + * + * Argument: + * 0: weapon type + * + * Return value: + * 0: dispresion + * 1: slowdownFactor + * 2: jamChance + * + * Public: No + */ +#include "script_component.hpp" + +// Look in the cache first +private _weaponData = GVAR(cacheWeaponData) getVariable _weapon; +if (!isNil "_weaponData") exitWith {_weaponData}; + +// Search the config +// The old and new properties have the same name for dispersion, so read whichever is closer to the children +private _property = configFile >> "CfgWeapons" >> _weapon >> QGVAR(dispersion); +private _dispersion = if (isNumber _property) then { + getNumber _property; +} else { + if (isArray _property) then { + // Map old array property to new number property + ((getArray _property) select 3) / 0.004; + } else { + 1; + }; +}; + +// The old and new properties have the same name for slowdownFactor, so read whichever is closer to the children +_property = configFile >> "CfgWeapons" >> _weapon >> QGVAR(slowdownFactor); +private _slowdownFactor = if (isNumber _property) then { + getNumber _property; +} else { + if (isArray _property) then { + // Map old array property to new number property + ((getArray _property) select 3) / 0.9; + } else { + 1; + }; +}; + +// For jam chance, try reading the legacy property first (ace_overheating_jamChance). +private _jamChance = 1 / 3000; +_property = configFile >> "CfgWeapons" >> _weapon >> QGVAR(JamChance); +// If it exists read it, as the weapon is probably third party and not updated to the new properties +if (isArray _property) then { + // Map old array property to new number property + _jamChance = (getArray _property) select 1; +} else { + // No legacy property was found, look for the new one + _property = configFile >> "CfgWeapons" >> _weapon >> QGVAR(mrbs); + if (isNumber _property) then { + _jamChance = 1 / getNumber _property; + }; +}; + +// Cache the values +_weaponData = [_dispersion, _slowdownFactor, _jamChance]; +TRACE_2("building cache",_weapon,_weaponData); +GVAR(cacheWeaponData) setVariable [_weapon, _weaponData]; + +_weaponData diff --git a/addons/overheating/functions/fnc_handleTakeEH.sqf b/addons/overheating/functions/fnc_handleTakeEH.sqf new file mode 100644 index 0000000000..05139119e5 --- /dev/null +++ b/addons/overheating/functions/fnc_handleTakeEH.sqf @@ -0,0 +1,28 @@ +/* + * Author: Commy2 + * Handle "take" event + * I think it fixs jams when manually dragging a new magazine in from player's inventory + * + * Argument: + * 0: unit - Object the event handler is assigned to + * 1: container + * 2: item + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_container", "_item"]; +TRACE_3("params",_unit,_container,_item); + +if ((_unit == ACE_player) + && {_container in [uniformContainer _unit, vestContainer _unit, backpackContainer _unit]} + && {_item == currentMagazine _unit}) then { //Todo: should this be any valid magazine for any jammed gun? + + TRACE_1("clearing jam",currentWeapon _unit); + [_unit, currentWeapon _unit, true] call FUNC(clearJam) + +}; diff --git a/addons/overheating/functions/fnc_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf index 000cd44021..38184808d2 100644 --- a/addons/overheating/functions/fnc_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -9,74 +9,58 @@ * Return value: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_jamWeapon + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_unit,_weapon); +params ["_unit", "_weapon"]; +TRACE_2("params",_unit,_weapon); // don't jam a weapon with no rounds left -if (_unit ammo _weapon == 0) exitWith {}; +private _ammo = _unit ammo _weapon; +if (_ammo == 0) exitWith {}; -private ["_jammedWeapons"]; -_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; +private _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; _jammedWeapons pushBack _weapon; _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; -// this is to re-activate the 'DefaultAction', so you can jam a weapon while full auto shooting -_fnc_stopCurrentBurst = { - EXPLODE_2_PVT(_this,_params,_pfhId); - EXPLODE_4_PVT(_params,_unit,_weapon,_ammo,_startFrame); - - // Skip the first execution of the PFH - if (diag_frameno == _startFrame) exitWith {}; - - // Remove the PFH on the second execution - [_pfhId] call CBA_fnc_removePerFrameHandler; - - _unit setAmmo [_weapon, _ammo]; -}; // Stop current burst -_ammo = _unit ammo _weapon; if (_ammo > 0) then { _unit setAmmo [_weapon, 0]; - [_fnc_stopCurrentBurst, 0, [_unit, _weapon, _ammo, diag_frameno]] call CBA_fnc_addPerFrameHandler; + // this is to re-activate the 'DefaultAction', so you can jam a weapon while full auto shootin + [{ + params ["_unit", "_weapon", "_ammo"]; + _unit setAmmo [_weapon, _ammo]; + }, [_unit, _weapon, _ammo]] call EFUNC(common,execNextFrame); }; // only display the hint once, after you try to shoot an already jammed weapon GVAR(knowAboutJam) = false; if (_unit getVariable [QGVAR(JammingActionID), -1] == -1) then { - private ["_condition", "_statement", "_condition2", "_statement2", "_id"]; - _condition = { - [_this select 1] call EFUNC(common,canUseWeapon) - && {currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []])} - && {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable [QEGVAR(safemode,safedWeapons), []]))} - }; - - _statement = { - playSound3D ["a3\sounds_f\weapons\Other\dry9.wss", _this select 0]; - - if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0} && {GVAR(DisplayTextOnJam)}) then { - [localize LSTRING(WeaponJammed)] call EFUNC(common,displayTextStructured); - GVAR(knowAboutJam) = true; + private _condition = { + [_this select 1] call CBA_fnc_canUseWeapon + && {currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []])} + && {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable [QEGVAR(safemode,safedWeapons), []]))} }; - }; - _condition2 = { - currentWeapon (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []]) - }; + private _statement = { + playSound3D ["a3\sounds_f\weapons\Other\dry9.wss", _this select 0]; - _statement2 = { - [_this select 1, currentWeapon (_this select 1), false] call FUNC(clearJam); - }; + if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0} && {GVAR(DisplayTextOnJam)}) then { + [localize LSTRING(WeaponJammed)] call EFUNC(common,displayTextStructured); + GVAR(knowAboutJam) = true; + }; + }; - //_id = [_unit, format ["%1", localize LSTRING(UnjamWeapon)], "DefaultAction", _condition, _statement, _condition2, _statement2, 10] call EFUNC(common,addActionMenuEventHandler); - _id = [_unit, "DefaultAction", _condition, _statement] call EFUNC(common,addActionEventHandler); + private _id = [_unit, "DefaultAction", _condition, _statement] call EFUNC(common,addActionEventHandler); - _unit setVariable [QGVAR(JammingActionID), _id]; + _unit setVariable [QGVAR(JammingActionID), _id]; }; diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index 6680b759c4..57a4bd7cba 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -15,156 +15,54 @@ * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -private ["_unit", "_weapon", "_ammo", "_projectile", "_velocity", "_variableName", "_overheat", "_temperature", "_time", "_bulletMass", "_energyIncrement", "_barrelMass", "_scaledTemperature", "_intensity", "_position", "_direction", "_dispersion", "_count", "_slowdownFactor", "_jamChance", "_surface"]; +params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"]; +TRACE_4("params",_unit,_weapon,_ammo,_projectile); -_unit = _this select 0; -_weapon = _this select 1; -_ammo = _this select 4; -_projectile = _this select 6; +// Only do heat calculations every 3 bullets +if (((_unit ammo _weapon) % 3) != 0) exitWith {}; -_velocity = velocity _projectile; +BEGIN_COUNTER(overheat); -// each weapon has it's own variable. Can't store the temperature in the weapon since they are not objects unfortunately. -_variableName = format [QGVAR(%1), _weapon]; - -// get old values -_overheat = _unit getVariable [_variableName, [0, 0]]; -_temperature = _overheat select 0; -_time = _overheat select 1; - -// Get physical parameters -_bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass"); -if (_bulletMass == 0) then { - // If the bullet mass is not configured, estimate it directly in grams - _bulletMass = 3.4334 + 0.5171 * (getNumber (configFile >> "CfgAmmo" >> _ammo >> "hit") + getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber")); -}; -_energyIncrement = 0.75 * 0.0005 * _bulletMass * (vectorMagnitudeSqr _velocity); -_barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; - -// Calculate cooling -_temperature = [_temperature, _barrelMass, ACE_time - _time] call FUNC(cooldown); -// Calculate heating -_temperature = _temperature + _energyIncrement / (_barrelMass * 466); // Steel Heat Capacity = 466 J/(Kg.K) - -// set updated values -_time = ACE_time; -_unit setVariable [_variableName, [_temperature, _time], false]; -_scaledTemperature = (_temperature / 1000) min 1 max 0; - -// Smoke SFX, beginning at TEMP 0.15 -private "_intensity"; - -_intensity = (_scaledTemperature - 0.2) * 1.25; -if (_intensity > 0) then { - private ["_position", "_direction"]; - - _position = position _projectile; - _direction = (_unit weaponDirection _weapon) vectorMultiply 0.25; - - drop [ - "\A3\data_f\ParticleEffects\Universal\Refract", - "", - "Billboard", - 1.1, - 2, - _position, - _direction, - 1, - 1.2, - 1.0, - 0.1, - [0.1,0.15], - [[0.06,0.06,0.06,0.32*_scaledTemperature], [0.3,0.3,0.3,0.28*_scaledTemperature], [0.3,0.3,0.3,0.25*_scaledTemperature], [0.3,0.3,0.3,0.22*_scaledTemperature], [0.3,0.3,0.3,0.1*_scaledTemperature]], - [1,0], - 0.1, - 0.05, - "", - "", - "" - ]; - - _intensity = (_scaledTemperature - 0.5) * 2; - if (_intensity > 0) then { - drop [ - ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 1, 16], - "", - "Billboard", - 1, - 1.2, - _position, - [0,0,0.25], - 0, - 1.275, - 1, - 0.025, - [0.28,0.33,0.37], - [[0.6,0.6,0.6,0.3*_intensity]], - [0.2], - 1, - 0.04, - "", - "", - "" - ]; - }; +// Get bullet parameters +private _bulletMass = GVAR(cacheAmmoData) getVariable _ammo; +if (isNil "_bulletMass") then { + _bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass"); + if (_bulletMass == 0) then { + // If the bullet mass is not configured, estimate it + _bulletMass = 3.4334 + 0.5171 * (getNumber (configFile >> "CfgAmmo" >> _ammo >> "hit") + getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber")); + }; + GVAR(cacheAmmoData) setVariable [_ammo, _bulletMass]; }; +// Projectile motion is roughly equal to Barrel heat +// Ref: https://en.wikipedia.org/wiki/Physics_of_firearms +// Muzzle Engergy = 1/2 * m * v^2 = (1/2 * 0.001 g/kg * bulletMass (grams) * v^2) +// Multiple by 3 becase we only calc every 3rd bullet: (3 * 1/2 * 0.001) = 0.0015 +private _energyIncrement = 0.0015 * _bulletMass * (vectorMagnitudeSqr velocity _projectile); -// dispersion and bullet slow down -private ["_dispersion", "_slowdownFactor", "_count"]; - -_dispersion = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_Dispersion"); - -_count = count _dispersion; -if (_count > 0) then { - _dispersion = ([_dispersion, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0; -} else { - _dispersion = 0; +// Increase overheating depending on how obstrusive is the current supressor, +// if any. Typical arma supressors have visibleFire=0.5 and audibleFire=0.3, +// so they produce x2.1 overheating +private _silencer = switch (_weapon) do { + case (primaryWeapon _unit) : {(primaryWeaponItems _unit) select 0}; + case (handgunWeapon _unit) : {(handgunItems _unit) select 0}; + default {""}; +}; +if (_silencer != "") then { + private _silencerCoef = GVAR(cacheSilencerData) getVariable _silencer; + if (isNil "_silencerCoef") then { + _silencerCoef = 1 + + (1 - getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire")) + + (1 - getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire")); + GVAR(cacheSilencerData) setVariable [_silencer, _silencerCoef]; + }; + _energyIncrement = _energyIncrement * _silencerCoef; }; -_slowdownFactor = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_slowdownFactor"); +TRACE_2("heat",_bulletMass,_energyIncrement); -_count = count _slowdownFactor; -if (_count > 0) then { - _slowdownFactor = ([_slowdownFactor, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0; -} else { - _slowdownFactor = 1; -}; +[_unit, _weapon, _energyIncrement] call FUNC(updateTemperature); -[_projectile, _dispersion - 2 * random _dispersion, _dispersion - 2 * random _dispersion, (_slowdownFactor - 1) * vectorMagnitude _velocity] call EFUNC(common,changeProjectileDirection); - - -// jamming -private "_jamChance"; - -_jamChance = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_jamChance"); - -_count = count _jamChance; -if (_count == 0) then { - _jamChance = [0]; - _count = 1; -}; - -_jamChance = [_jamChance, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray); - -// increase jam chance on dusty grounds if prone -if (stance _unit == "PRONE") then { - private "_surface"; - _surface = toArray (surfaceType getPosASL _unit); - _surface deleteAt 0; - - _surface = configFile >> "CfgSurfaces" >> toString _surface; - if (isClass _surface) then { - _jamChance = _jamChance + (getNumber (_surface >> "dust")) * _jamChance; - }; -}; - -if ("Jam" in (missionNamespace getVariable ["ACE_Debug", []])) then { - _jamChance = 0.5; -}; - -if (random 1 < _jamChance) then { - [_unit, _weapon] call FUNC(jamWeapon); -}; +END_COUNTER(overheat); diff --git a/addons/overheating/functions/fnc_swapBarrel.sqf b/addons/overheating/functions/fnc_swapBarrel.sqf index 4bd0f734b9..bbdab91705 100644 --- a/addons/overheating/functions/fnc_swapBarrel.sqf +++ b/addons/overheating/functions/fnc_swapBarrel.sqf @@ -9,17 +9,23 @@ * Return value: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_swapBarrel + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); +// Make the standing player kneel down if (stance _player != "PRONE") then { - [_player, "amovpknlmstpsraswrfldnon", 1] call EFUNC(common,doAnimation); + [_player, "amovpknlmstpsraswrfldnon", 1] call EFUNC(common,doAnimation); }; -_player playActionNow "GestureDismountMuzzle"; -_player playAction "GestureMountMuzzle"; + +// Barrel dismount gesture +_player playActionNow QGVAR(GestureDismountMuzzle); playSound "ACE_BarrelSwap"; -[10, [_player, _weapon], {(_this select 0) call FUNC(swapBarrelCallback)}, {}, (localize LSTRING(SwappingBarrel))] call EFUNC(common,progressBar); +[5, [_player, _weapon], {(_this select 0) call FUNC(swapBarrelCallback)}, {}, (localize LSTRING(SwappingBarrel))] call EFUNC(common,progressBar); diff --git a/addons/overheating/functions/fnc_swapBarrelCallback.sqf b/addons/overheating/functions/fnc_swapBarrelCallback.sqf index 5947e381c7..9c62e77f21 100644 --- a/addons/overheating/functions/fnc_swapBarrelCallback.sqf +++ b/addons/overheating/functions/fnc_swapBarrelCallback.sqf @@ -9,13 +9,24 @@ * Return value: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_swapBarrelCallback + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); + +// Barrel mount gesture +_player playAction QGVAR(GestureMountMuzzle); +playSound "ACE_BarrelSwap"; // don't consume the barrel, but rotate through them. [localize LSTRING(SwappedBarrel), QUOTE(PATHTOF(UI\spare_barrel_ca.paa))] call EFUNC(common,displayTextPicture); -_player setVariable [format [QGVAR(%1), _weapon], [0, 0], false]; +// Publish the temperature variable +_player setVariable [format [QGVAR(%1_temp), _weapon], 0, true]; +// Store the update time +_player setVariable [format [QGVAR(%1_time), _weapon], ACE_time]; diff --git a/addons/overheating/functions/fnc_updateTemperature.sqf b/addons/overheating/functions/fnc_updateTemperature.sqf new file mode 100644 index 0000000000..89d5975024 --- /dev/null +++ b/addons/overheating/functions/fnc_updateTemperature.sqf @@ -0,0 +1,86 @@ +/* + * Author: esteldunedain + * Update temperature of a weapon. + * + * Argument: + * 0: Unit + * 1: Weapon + * 2: Heat increment (J) + * + * Return value: + * Current temperature + * + * Example: + * [player, currentWeapon player, 2000] call ace_overheating_fnc_updateTemperature + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_weapon", "_heatIncrement"]; +TRACE_3("params",_unit,_weapon,_heatIncrement); + +// get old values +// each weapon has it's own variable. Can't store the temperature in the weapon since they are not objects unfortunately. +private _tempVarName = format [QGVAR(%1_temp), _weapon]; +private _timeVarName = format [QGVAR(%1_time), _weapon]; +private _temperature = _unit getVariable [_tempVarName, 0]; +private _lastTime = _unit getVariable [_timeVarName, 0]; + +private _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; + +_fnc_cooling = { + params ["_temperature", "_barrelMass", "_totalTime"]; + + // If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool + if (_totalTime > 1800) exitWith {0}; + + //AR-15 (0.00570m bullet diameter) (barrel diameter usually 0.75" or 0.008255m radius) + //Steel Denisty = 7850 m^3 / kg + //Area of a cylinder (2/r)*(Pi * r^3 + V) - for a 0.008255m radius barrel -> Area = 210(1/meters) * Volume + //Adjusted volume for being hollowed out is ~1.1x + //So Area = 210 * 1.1 * (mass / 7850) = mass * 0.029427 (for steel near that diameter) + + private _barrelSurface = _barrelMass * 0.029427; + + TRACE_4("cooling",_temperature,_totalTime,_barrelMass,_barrelSurface); + + private _time = 0; + while {true} do { + private _deltaTime = (_totalTime - _time) min 20; + + _temperature = _temperature - ( + // Convective cooling + 25 * _barrelSurface * _temperature + // Radiative cooling + + 0.4 * 5.67e-8 * _barrelSurface * + ( (_temperature + 273.15)*(_temperature + 273.15) + * (_temperature + 273.15)*(_temperature + 273.15) + - 273.15 * 273.15 * 273.15 *273.15 ) + ) * _deltaTime / (_barrelMass * 466); + + if (_temperature < 1) exitWith {0}; + + if (isNil "_temperature") exitWith { + diag_log text format ["[ACE] ERROR: _totalTime = %1; _time = %2; _deltaTime = %3;", _totalTime, _time, _deltaTime]; + 0 + }; + + _time = _time + _deltaTime; + if (_time >= _totalTime) exitWith { _temperature max 0 }; + }; +}; + +// Calculate cooling +_temperature = [_temperature, _barrelMass, ACE_time - _lastTime] call _fnc_cooling; +TRACE_1("cooledTo",_temperature); +// Calculate heating +// Steel Heat Capacity = 466 J/(Kg.K) +_temperature = _temperature + _heatIncrement / (_barrelMass * 466); + +// Publish the temperature variable +[_unit, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic); +// Store the update time locally +_unit setVariable [_timeVarName, ACE_time]; + +_temperature diff --git a/addons/overheating/functions/fnc_updateTemperatureThread.sqf b/addons/overheating/functions/fnc_updateTemperatureThread.sqf new file mode 100644 index 0000000000..76a332e480 --- /dev/null +++ b/addons/overheating/functions/fnc_updateTemperatureThread.sqf @@ -0,0 +1,25 @@ +/* + * Author: esteldunedain + * Update cooldown calculation of all player weapons at regular intervals. + * + * Argument: + * None + * + * Return value: + * None + * + * Example: + * [] call ace_overheating_fnc_updateTemperatureThread + * + * Public: No + */ + +#include "script_component.hpp" + +private _currentWeapon = currentWeapon ACE_player; +if ((_currentWeapon != "") && {_currentWeapon == primaryWeapon ACE_player || {_currentWeapon == handgunWeapon ACE_player}}) then { + [ACE_player, _currentWeapon, 0] call FUNC(updateTemperature); +}; + +// Schedule for execution again after 5 seconds +[DFUNC(updateTemperatureThread), [], 5] call EFUNC(common,waitAndExecute); diff --git a/addons/overheating/functions/script_component.hpp b/addons/overheating/functions/script_component.hpp new file mode 100644 index 0000000000..a8668e5b4f --- /dev/null +++ b/addons/overheating/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\overheating\script_component.hpp" \ No newline at end of file diff --git a/addons/overheating/script_component.hpp b/addons/overheating/script_component.hpp index ff124851ad..262accc43b 100644 --- a/addons/overheating/script_component.hpp +++ b/addons/overheating/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT overheating #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_OVERHEATING #define DEBUG_MODE_FULL #endif @@ -9,4 +14,12 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_OVERHEATING #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" + +#define TEMP_TOLERANCE 50 + +#ifdef DEBUG_MODE_FULL + #define TRACE_PROJECTILE_INFO(BULLET) _vdir = vectorNormalized velocity BULLET; _dir = (_vdir select 0) atan2 (_vdir select 1); _up = asin (_vdir select 2); _mv = vectorMagnitude velocity BULLET; TRACE_3("adjusted projectile",_dir,_up,_mv); +#else + #define TRACE_PROJECTILE_INFO(BULLET) /* noDebug */ +#endif diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index 28dc8b95c7..1f5f2fc437 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -1,7 +1,7 @@ - + - + Display text on jam Zeige Text bei Ladehemmung Mostrar texto al encasquillarse @@ -13,7 +13,7 @@ Mostrar texto quando trava acontecer Visualizza testo in caso di inceppamento - + Display a notification whenever your weapon gets jammed Zeige einen Hinweis, wenn die Waffe eine Ladehemmung hat. Mostrar notificación cada vez que el arma se encasquille @@ -25,6 +25,42 @@ Mostra uma notificação quando sua arma sofre um travamento. Visualizza una notifica in caso la tua arma si inceppasse + + Overheating Particle Effects + Partikeleffekt bei Überhitzung + Efekty cząsteczkowe przegrzania + Effetti Particelle Surriscaldamento + + + Show particle effects when weapon overheats + Zeige einen Partikeleffekt, wenn die Waffe überhitzt. + Pokaż efekty cząsteczkowe kiedy broń się przegrzeje + Mostra effetti particellari quando l'arma si surriscalda + + + Overheating Particle Effects for everyone + Zeige Partikeleffekt bei allen + Pokaż efekty cząsteczkowe dla wszystkich + Effetti Particellari Surriscaldamento per tutti + + + Show particle effects when other players weapon overheats + Zeigt Partikeleffekt auch bei überhitzten Waffen von Mitspielern. + Pokazuje efekty cząsteczkowe kiedy broń innego gracza się przegrzeje + Mostra effetti particellari quando l'arma di altri giocatori si surriscalda + + + Overheating Dispersion + Streuung bei Überhitzung + Wpływ na rozrzut + Dispersione Surriscaldamento + + + Overheated weapons will be less accurate and have decreased muzzle velocity. Applys for all players. + Überhitzte Waffen sind weniger genau und verfügen über eine geringere Mündungsgeschwindigkeit. Wird bei allen Spielern angewendet. + Przegrzane bronie będą mniej celne oraz będą miały zmniejszoną prędkość pocisku. Wpływa na wszystkich graczy. + Armi surriscaldate saranno meno precise ed avranno una ridotta velocità alla volata. Applica per tutti i giocatori. + Spare barrel Ersatzlauf @@ -98,16 +134,16 @@ Sostiuisci la canna - Swapping barrel ... - Lauf wird gewechselt ... - Cambiando el cañón ... - Wymienianie lufy ... - Vyměňuji hlaveň ... - Changement du canon ... - Смена ствола ... - Cső kicserélése folyamatban ... - Substituindo cano ... - Sto sostituendo la canna ... + Swapping barrel... + Lauf wird gewechselt... + Cambiando el cañón... + Wymienianie lufy... + Vyměňuji hlaveň... + Changement du canon... + Смена ствола... + Cső kicserélése folyamatban... + Substituindo cano... + Sto sostituendo la canna... Swapped barrel @@ -146,16 +182,16 @@ Controlla la temperatura della canna - Checking temperature ... - Prüfe Temperatur ... - Verificando temperatura ... - Sprawdzanie temperatury ... - Vérification de la température ... - Hőmérséklet ellenőrzése ... - Zjišťuju teplotu ... - Conferindo temperatura ... - Sto controllando la temperatura ... - Проверка температуры ... + Checking temperature... + Prüfe Temperatur... + Verificando temperatura... + Sprawdzanie temperatury... + Vérification de la température... + Hőmérséklet ellenőrzése... + Zjišťuju teplotu... + Conferindo temperatura... + Sto controllando la temperatura... + Проверка температуры... Temperature diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp index 6f8dba89bd..becf395052 100644 --- a/addons/overpressure/CfgEventHandlers.hpp +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -10,42 +16,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHBB);};); - }; - }; - - class Tank { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class Car { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class Helicopter { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class Plane { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class Ship_F { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class StaticWeapon { - class ADDON { - 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 a88fa90894..1f0814a487 100644 --- a/addons/overpressure/CfgWeapons.hpp +++ b/addons/overpressure/CfgWeapons.hpp @@ -49,6 +49,20 @@ class CfgWeapons { GVAR(damage) = 0.85; }; + class cannon_125mm: CannonCore { + GVAR(priority) = 1; + GVAR(angle) = 90; + GVAR(range) = 50; + GVAR(damage) = 0.85; + }; + + class cannon_105mm: 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; diff --git a/addons/overpressure/XEH_PREP.hpp b/addons/overpressure/XEH_PREP.hpp new file mode 100644 index 0000000000..1efd39d6e5 --- /dev/null +++ b/addons/overpressure/XEH_PREP.hpp @@ -0,0 +1,6 @@ + +PREP(getDistance); +PREP(overpressureDamage); +PREP(cacheOverPressureValues); +PREP(firedEHOP); +PREP(firedEHBB); diff --git a/addons/overpressure/XEH_postInit.sqf b/addons/overpressure/XEH_postInit.sqf index 33c2e679c9..f7f0bc2ace 100644 --- a/addons/overpressure/XEH_postInit.sqf +++ b/addons/overpressure/XEH_postInit.sqf @@ -1,3 +1,7 @@ #include "script_component.hpp" ["overpressure", FUNC(overpressureDamage)] call EFUNC(common,addEventHandler); + +// Register fire event handler +["firedPlayer", DFUNC(firedEHBB)] call EFUNC(common,addEventHandler); +["firedPlayerVehicle", DFUNC(firedEHOP)] call EFUNC(common,addEventHandler); diff --git a/addons/overpressure/XEH_preInit.sqf b/addons/overpressure/XEH_preInit.sqf index d0ce7cbcf1..a7feade1c3 100644 --- a/addons/overpressure/XEH_preInit.sqf +++ b/addons/overpressure/XEH_preInit.sqf @@ -2,11 +2,6 @@ ADDON = false; -PREP(fireLauncherBackblast); -PREP(fireOverpressureZone); -PREP(getDistance); -PREP(overpressureDamage); -PREP(cacheOverPressureValues); -PREP(firedEHOP); -PREP(firedEHBB); +#include "XEH_PREP.hpp" + ADDON = true; diff --git a/addons/overpressure/XEH_preStart.sqf b/addons/overpressure/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/overpressure/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf b/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf index 8de8af6375..273843ce8f 100644 --- a/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf +++ b/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf @@ -1,7 +1,7 @@ /* * Author: joko // Jonas - * - * Handle fire of local launchers + * Cache the shot data for a given weapon/mag/ammo combination. + * Will use the config that has the highest priority. * * Argument: * 0: Weapon @@ -9,68 +9,49 @@ * 2: Ammo * * Return value: - * Array: + * Shot Config : * 0: Angle * 1: Range * 2: Damage * + * Example: + * ["cannon_125mm","Sh_125mm_APFSDS_T_Green","24Rnd_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_cacheOverPressureValues + * + * Public: No */ - #include "script_component.hpp" +#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 = [ +private _array = [ getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(priority)), getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(priority)), getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(priority)) ]; -TRACE_1("Proiroity Array",_array); +(_array call CBA_fnc_findMax) params ["", ["_indexOfMaxPriority", 0, [0]]]; -/* for CBA Upadte 2.1 -_priority = _array call CBA_fnc_findMax; -_type = if (isNil "_priority") then { - 0 -} else { - _priority select 1 -}; -*/ +TRACE_2("Priority Array",_array,_indexOfMaxPriority); -// 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 = [ +private _config = [ (configFile >> "CfgWeapons" >> _weapon), (configFile >> "CfgMagazines" >> _magazine), (configFile >> "CfgAmmo" >> _ammo) -] select _type; +] select _indexOfMaxPriority; TRACE_1("ConfigPath",_config); // get the Variables out of the Configes and create a array with then -_return = [ +private _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]; + +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +missionNameSpace setVariable [_varName, _return]; +TRACE_2("Return",_varName,_return); _return diff --git a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf deleted file mode 100644 index 02da9e9564..0000000000 --- a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Author: commy2 and esteldunedain - * - * 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" - -params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; - -// Prevent AI from causing backblast damage -if !([_firer] call EFUNC(common,isPlayer)) exitWith {}; - -private ["_position", "_direction"]; - -_position = getPosASL _projectile; -_direction = [0, 0, 0] vectorDiff (vectorDir _projectile); - -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"]; - - -// Damage to others -private "_affected"; -_affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange]; - -// Let each client handle their own affected units -["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); - -// Damage to the firer -private "_distance"; -_distance = [_position, _direction, _backblastRange, _firer] call FUNC(getDistance); - -TRACE_1("Distance",_distance); - -if (_distance < _backblastRange) then { - private ["_alpha", "_beta", "_damage"]; - - _alpha = sqrt (1 - _distance / _backblastRange); - _beta = sqrt 0.5; - - _damage = _alpha * _beta * _backblastDamage; - [_damage * 100] call BIS_fnc_bloodEffect; - - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_firer] call EFUNC(medical,hasMedicalEnabled))}) then { - [_firer, _damage, "body", "backblast"] call EFUNC(medical,addDamageToUnit); - } else { - _firer setDamage (damage _firer + _damage); - }; -}; - -// Draw debug lines -#ifdef DEBUG_MODE_FULL - [ _position, - _position vectorAdd (_direction vectorMultiply _backblastRange), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - - private "_ref"; - _ref = _direction call EFUNC(common,createOrthonormalReference); - [ _position, - _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - - [ _position, - _position vectorAdd (_direction vectorMultiply (_distance min _backblastRange)), - [1,0,0,1] - ] call EFUNC(common,addLineToDebugDraw); -#endif diff --git a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf deleted file mode 100644 index 02de0eb311..0000000000 --- a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Author: commy2 and esteldunedain - * - * Handle fire of local vehicle weapons creating overpressure zones - * - * 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" - -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? - -private ["_position", "_direction"]; - -_position = getPosASL _projectile; -_direction = vectorDir _projectile; - -private ["_var", "_varName", "_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; - -// 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 = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange]; - -// Let each client handle their own affected units -["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); - -// Draw debug lines -#ifdef DEBUG_MODE_FULL - [ _position, - _position vectorAdd (_direction vectorMultiply _dangerZoneRange), - [1,0,0,1] - ] call EFUNC(common,addLineToDebugDraw); - - private "_ref"; - _ref = _direction call EFUNC(common,createOrthonormalReference); - [ _position, - _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - -#endif diff --git a/addons/overpressure/functions/fnc_firedEHBB.sqf b/addons/overpressure/functions/fnc_firedEHBB.sqf index cf2ac31561..8dc15e0f0a 100644 --- a/addons/overpressure/functions/fnc_firedEHBB.sqf +++ b/addons/overpressure/functions/fnc_firedEHBB.sqf @@ -1,32 +1,90 @@ /* * Author: joko // Jonas - * - * Handle fire of local launchers + * Handle fire of local launchers. Called from the unified fired EH only for the local player. * * Arguments: - * 0: Unit that fired - * 1: Weapon fired - * 2: Muzzle - * 3: Mode - * 4: Ammo - * 5: Magazine - * 6: Projectile + * None. Parameters inherited from EFUNC(common,firedEH) * * Return value: * None + * + * Example: + * [player, "launch_RPG32_F", "launch_RPG32_F", "Single", "R_PG32V_F", "RPG32_F", projectile] call ace_overpressure_fnc_firedEHBB; + * + * Public: No */ #include "script_component.hpp" -private ["_damage","_varName"]; -params ["", "_weapon", "", "", "_ammo", "_magazine", ""]; + +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // 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; +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +private _var = if (isNil _varName) then { + [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); } else { - (missionNameSpace getVariable _varName) select 2; + missionNameSpace getVariable _varName; +}; +_var params["_backblastAngle","_backblastRange","_backblastDamage"]; +TRACE_3("cache",_backblastAngle,_backblastRange,_backblastDamage); + +if (_backblastDamage <= 0) exitWith {}; + +private _position = getPosASL _projectile; +private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile); + +// Damage to others +private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange]; + +// Let each client handle their own affected units +["overpressure", _affected, [_unit, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); + +// Damage to the firer +private _distance = 2 * ([_position, _direction, _backblastRange, _unit] call FUNC(getDistance)); + +TRACE_1("Distance",_distance); + +if (_distance < _backblastRange) then { + private _alpha = sqrt (1 - _distance / _backblastRange); + private _beta = sqrt 0.5; + + private _damage = _alpha * _beta * _backblastDamage; + [_damage * 100] call BIS_fnc_bloodEffect; + + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_unit] call EFUNC(medical,hasMedicalEnabled))}) then { + [_unit, _damage, "body", "backblast"] call EFUNC(medical,addDamageToUnit); + } else { + _unit setDamage (damage _unit + _damage); + }; }; -if (_damage > 0) then { - _this call DFUNC(fireLauncherBackblast) -}; +// Draw debug lines +#ifdef DEBUG_MODE_FULL + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + private _ref = _direction call EFUNC(common,createOrthonormalReference); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + [ _position, + _position vectorAdd (_direction vectorMultiply ((_distance/2) min _backblastRange)), + [1,0,0,1] + ] call EFUNC(common,addLineToDebugDraw); +#endif diff --git a/addons/overpressure/functions/fnc_firedEHOP.sqf b/addons/overpressure/functions/fnc_firedEHOP.sqf index 6cec770deb..dff9215a52 100644 --- a/addons/overpressure/functions/fnc_firedEHOP.sqf +++ b/addons/overpressure/functions/fnc_firedEHOP.sqf @@ -1,32 +1,70 @@ /* * Author: joko // Jonas - * - * Handle fire of Other Weapons + * Handle fire of Vehicle Weapons. Called from the unified fired EH only for the local player vehicle. * * Arguments: - * 0: Unit that fired - * 1: Weapon fired - * 2: Muzzle - * 3: Mode - * 4: Ammo - * 5: Magazine - * 6: Projectile + * None. Parameters inherited from EFUNC(common,firedEH) * * Return value: * None + * + * Example: + * [tank, "cannon_125mm", "cannon_125mm", "player", "Sh_125mm_APFSDS_T_Green", "24Rnd_125mm_APFSDS_T_Green", projectile] call ace_overpressure_fnc_firedEHOP + * + * Public: No */ #include "script_component.hpp" -private ["_damage","_varName"]; -params ["", "_weapon", "", "", "_ammo", "_magazine", ""]; + +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // 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; +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +private _var = if (isNil _varName) then { + [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); } else { - (missionNameSpace getVariable _varName) select 2; + missionNameSpace getVariable _varName; }; +_var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; +TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage); -if (_damage > 0) then { - _this call DFUNC(fireOverpressureZone) -}; +if (_dangerZoneDamage <= 0) exitWith {}; + + + +// The weapon produces overpressure, calculate +private _position = getPosASL _projectile; +private _direction = vectorDir _projectile; + +// Damage to others +private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange]; + +// Let each client handle their own affected units +["overpressure", _affected, [_unit, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); + +// Draw debug lines +#ifdef DEBUG_MODE_FULL + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange), + [1,0,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + private _ref = _direction call EFUNC(common,createOrthonormalReference); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + +#endif diff --git a/addons/overpressure/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf index cabdd267fa..341da388ca 100644 --- a/addons/overpressure/functions/fnc_getDistance.sqf +++ b/addons/overpressure/functions/fnc_getDistance.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 and esteldunedain - * * Calculate the distance to the first intersection of a line * * Arguments: @@ -15,11 +14,12 @@ * Example: * [[1823.41,5729.05,6.66627], [-0.953255,0.109689,-0.281554], 15, ace_player] call ace_overpressure_fnc_getDistance * + * Public: No */ #include "script_component.hpp" params ["_posASL", "_direction", "_maxDistance", "_shooter"]; -TRACE_3("params",_posASL,_direction,_maxDistance); +TRACE_4("params",_posASL,_direction,_maxDistance, _shooter); private _intersections = lineIntersectsSurfaces [_posASL, _posASL vectorAdd (_direction vectorMultiply _maxDistance), _shooter, objNull, true, 99]; @@ -29,9 +29,10 @@ private _distance = 999; { _x params ["_intersectPosASL", "_surfaceNormal", "_intersectObject"]; - - //Hit something solid that can reflect - (Static covers Building) - if ((isNull _intersectObject) || {(_intersectObject isKindOf "Static") || {_intersectObject isKindOf "AllVehicles"}}) exitWith { + TRACE_3("Intersect",_intersectPosASL,_surfaceNormal,_intersectObject); + + //Hit something solid that can reflect - (Static covers Building) [Need to manually filter out _shoot for FFV shots] + if ((isNull _intersectObject) || {(_intersectObject != _shooter) && {(_intersectObject isKindOf "Static") || {_intersectObject isKindOf "AllVehicles"}}}) exitWith { _distance = _posASL vectorDistance _intersectPosASL; TRACE_3("hit solid object",_distance,_intersectObject,typeOf _intersectObject); diff --git a/addons/overpressure/functions/fnc_overpressureDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf index b1c8a5c574..3b8d4ea6f2 100644 --- a/addons/overpressure/functions/fnc_overpressureDamage.sqf +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -1,56 +1,56 @@ /* * Author: commy2 and esteldunedain - * * Calculate and apply backblast damage to potentially affected local units + * Handles the "overpressure" event. * * Argument: * 0: Unit that fired * 1: Pos ASL of the projectile - * 2: Direction of the projectile + * 2: Direction of the projectile (reversed for launcher backblast) * 3: Weapon fired * 4: Magazine * 5: Ammo * * Return value: * None + * + * Example: + * [tank, [1727.57,5786.15,7.24899], [-0.982474,-0.185998,-0.0122501], "cannon_125mm", "24Rnd_125mm_APFSDS_T_Green", "Sh_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_overpressureDamage + * + * Public: No */ #include "script_component.hpp" -private ["_var","_overpressureAngle", "_overpressureRange", "_overpressureDamage"]; params ["_firer", "_posASL", "_direction", "_weapon", "_magazine", "_ammo"]; // 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 { +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +private _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); +TRACE_3("cache",_overpressureAngle,_overpressureRange,_overpressureDamage); { if (local _x && {_x != _firer} && {vehicle _x == _x}) then { - private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"]; + private _targetPositionASL = eyePos _x; + private _relativePosition = _targetPositionASL vectorDiff _posASL; + private _axisDistance = _relativePosition vectorDotProduct _direction; + private _distance = vectorMagnitude _relativePosition; + private _angle = acos (_axisDistance / _distance); - _targetPositionASL = eyePos _x; - _relativePosition = _targetPositionASL vectorDiff _posASL; - _axisDistance = _relativePosition vectorDotProduct _direction; - _distance = vectorMagnitude _relativePosition; - _angle = acos (_axisDistance / _distance); - - _line = [_posASL, _targetPositionASL, _firer, _x]; - _line2 = [_posASL, _targetPositionASL]; + private _line = [_posASL, _targetPositionASL, _firer, _x]; + private _line2 = [_posASL, _targetPositionASL]; TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); if (_angle < _overpressureAngle && {_distance < _overpressureRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { - private ["_alpha", "_beta", "_damage"]; - _alpha = sqrt (1 - _distance / _overpressureRange); - _beta = sqrt (1 - _angle / _overpressureAngle); + private _alpha = sqrt (1 - _distance / _overpressureRange); + private _beta = sqrt (1 - _angle / _overpressureAngle); - _damage = _alpha * _beta * _overpressureDamage; + private _damage = _alpha * _beta * _overpressureDamage; // If the target is the ACE_player if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; @@ -60,6 +60,14 @@ TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage, } else { _x setDamage (damage _x + _damage); }; + + #ifdef DEBUG_MODE_FULL + //Shows damage lines in green + [ _posASL, + _targetPositionASL, + [0,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + #endif }; }; } forEach ((ASLtoAGL _posASL) nearEntities ["CAManBase", _overpressureRange]); diff --git a/addons/overpressure/script_component.hpp b/addons/overpressure/script_component.hpp index fbe7cd1238..5f4005374b 100644 --- a/addons/overpressure/script_component.hpp +++ b/addons/overpressure/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT overpressure #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_OVERPRESSURE #define DEBUG_MODE_FULL #endif diff --git a/addons/parachute/CfgEventHandlers.hpp b/addons/parachute/CfgEventHandlers.hpp index 7a1f8119ca..f972afc2ca 100644 --- a/addons/parachute/CfgEventHandlers.hpp +++ b/addons/parachute/CfgEventHandlers.hpp @@ -1,17 +1,26 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + 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_Respawn_EventHandlers { class CAManBase { class ADDON { respawn = QUOTE(call COMPILE_FILE(XEH_respawn)); }; }; -}; \ No newline at end of file +}; diff --git a/addons/parachute/CfgVehicles.hpp b/addons/parachute/CfgVehicles.hpp index c0f1676eb2..ff9196ca60 100644 --- a/addons/parachute/CfgVehicles.hpp +++ b/addons/parachute/CfgVehicles.hpp @@ -93,7 +93,7 @@ class CfgVehicles { displayName = CSTRING(ReserveParachute); scope = 1; mass = 70; - ParachuteClass = "NonSteerable_Parachute_F"; + ParachuteClass = "Steerable_Parachute_F"; ace_reserveParachute = ""; ace_hasReserveParachute = 0; }; diff --git a/addons/parachute/XEH_PREP.hpp b/addons/parachute/XEH_PREP.hpp new file mode 100644 index 0000000000..c2567b8468 --- /dev/null +++ b/addons/parachute/XEH_PREP.hpp @@ -0,0 +1,9 @@ + +PREP(doLanding); +PREP(handleInfoDisplayChanged); +PREP(hideAltimeter); +PREP(onEachFrame); +PREP(showAltimeter); +PREP(cutParachute); +PREP(checkCutParachute); +PREP(storeParachute); diff --git a/addons/parachute/XEH_preInit.sqf b/addons/parachute/XEH_preInit.sqf index 7bc0823215..bffa5623b8 100644 --- a/addons/parachute/XEH_preInit.sqf +++ b/addons/parachute/XEH_preInit.sqf @@ -17,12 +17,6 @@ ADDON = false; -PREP(doLanding); -PREP(handleInfoDisplayChanged); -PREP(hideAltimeter); -PREP(onEachFrame); -PREP(showAltimeter); -PREP(cutParachute); -PREP(checkCutParachute); -PREP(storeParachute); +#include "XEH_PREP.hpp" + ADDON = true; diff --git a/addons/parachute/XEH_preStart.sqf b/addons/parachute/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/parachute/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/parachute/script_component.hpp b/addons/parachute/script_component.hpp index 5668220421..d86d153f22 100644 --- a/addons/parachute/script_component.hpp +++ b/addons/parachute/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT parachute #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_PARACHUTE #define DEBUG_MODE_FULL #endif diff --git a/addons/parachute/stringtable.xml b/addons/parachute/stringtable.xml index ebedda7405..83b6fc3409 100644 --- a/addons/parachute/stringtable.xml +++ b/addons/parachute/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -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 @@ -57,8 +57,9 @@ Ejtőernyő elvágása Cortar para-quedas Обрезать стропы - Odžíznout Padák + Odžíznout padák Cortar paracaídas + Taglia Paracadute Reserve Parachute @@ -68,8 +69,9 @@ Tartalék ejtőernyő Para-quedas de reserva Запасной парашют - Záložní Padák + Záložní padák Paracaídas de reserva + Paracadute di Riserva - + \ No newline at end of file diff --git a/addons/ragdolls/$PBOPREFIX$ b/addons/ragdolls/$PBOPREFIX$ deleted file mode 100644 index 4c2fcd3ef9..0000000000 --- a/addons/ragdolls/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\ragdolls \ No newline at end of file diff --git a/addons/ragdolls/README.md b/addons/ragdolls/README.md deleted file mode 100644 index 86739775c3..0000000000 --- a/addons/ragdolls/README.md +++ /dev/null @@ -1,12 +0,0 @@ -ace_ragdolls -============ - -Tweaks the ragdoll behaviour to be more responsive to bullet impacts and explosions. - - -## Maintainers - -The people responsible for merging changes to this component or answering potential questions. - -- [KoffeinFlummi](https://github.com/KoffeinFlummi) -- [commy2](https://github.com/commy2) diff --git a/addons/ragdolls/config.cpp b/addons/ragdolls/config.cpp deleted file mode 100644 index 3d9198a41d..0000000000 --- a/addons/ragdolls/config.cpp +++ /dev/null @@ -1,801 +0,0 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"KoffeinFlummi", "Opticalsnare"}; - authorUrl = "https://github.com/KoffeinFlummi/"; - VERSION_CONFIG; - }; -}; - -/* - * BASED ON OPTICALSNARE'S WORK - * He gave permission to use his code here: - * http://forums.bistudio.com/showthread.php?171771-Flying-bodies-Physics-Mod&p=2603042#post2603042 - */ - -class PhysXParams { - epeImpulseDamageCoef = 1320.0; - impulseForceRagdollCoef = 200; - impulseTorqueRagdollCoef = 100; - maxRagdollImpulseForceMagnitude = 500; - maxRagdollImpulseTorqueMagnitude = 150; - ragdollHitDmgLimit = "0.01f"; - ragdollHitForceCoef = "20f"; - ragdollHitTime = "0.05f"; - ragdollOnCollideForceCoef = "20.0f"; - ragdollOnCollideMassLimit = "0.0f"; - ragdollOnCollideMaxForce = "25.0f"; - ragdollOnCollideMaxOffset = "2.0f"; - ragdollOnCollideMaxOffsetSpeed = "50.0f"; - ragdollOnCollideSpeedLimit = "2500.0f"; - ragdollOnCollideVehicleImpulseCoef = "0.5f"; - ragdollUnconsciousSleepCoef = "0f"; - ragdollUnderwaterBuoyancyCoef = 9.7; - ragdollUnderwaterResistanceCoef = 0.005; - ragdollVehicleCollision = 1; -}; - -class RagDollDefaultLimit { - value = 0; - restitution = 0.9; - hardness = 0.5; -}; - -class RagDollDefaultSpring { - enabled = 0; - value = 0.5; - damper = 1; - targetValue = 0; -}; - -class RagDollSphericalJoint { - class TwistLimitLow : RagDollDefaultLimit {}; - - class TwistLimitHigh : RagDollDefaultLimit {}; - - class SwingLimit : RagDollDefaultLimit {}; - - class TwistSpring : RagDollDefaultSpring { - enabled = 1; - }; - - class SwingSpring : RagDollDefaultSpring { - enabled = 1; - damper = 2; - }; - - class JointSpring : RagDollDefaultSpring { - enabled = 0; - }; - type = "spherical"; - enableCollision = 0; - projectionDistance = 0.05; - projectionMode = "point"; -}; - -class RagDollRevoluteJoint { - class LimitLow : RagDollDefaultLimit {}; - - class LimitHigh : RagDollDefaultLimit {}; - - class Spring : RagDollDefaultSpring { - enabled = 0; - }; - type = "revolute"; - enableCollision = 0; - projectionDistance = 0.05; - projectionMode = "point"; -}; - -class RagDollD6Joint_PX3 { - type = "D6"; - enableCollision = 0; - projectionDistance = 0.05; - projectionMode = "point"; - swingLimitY = "0.0f"; - swingLimitZ = "0.0f"; - swingSpring = "0.0f"; - swingDamping = "0.0f"; - swingRestitution = "0.6f"; - swingContactDistance = "0.05f"; - twistLimitLower = "0.0f"; - twistLimitUpper = "0.0f"; - twistSpring = "0.0f"; - twistDamping = "0.0f"; - twistRestitution = "0.6f"; - twistContactDistance = "0.05f"; - driveSpring = "20.0f"; - driveDamping = "20.0f"; - driveMaxForce = "1000000.0f"; - driveUseAcceleration = 1; - driveLinearVelocity[] = {0, 0, 0}; - driveAngularVelocity[] = {0, 0, 0}; -}; - -class CfgRagDollSkeletons { - class BaseRagdoll { - primaryWeaponBone = ""; - secondaryWeaponBone = ""; - networkBonePrimary = ""; - networkBoneSecondary = ""; - weaponSleepLinearVelocity = 20; - weaponSleepAngularVelocity = 20; - weaponDropMinTime = 1.0; - weaponDropMaxTime = 100.0; - weaponDistanceLimit = "10f"; - weaponDistanceLimitTime = "5.0f"; - sleepLinearVelocity = 0.05; - sleepAngularVelocity = 0.05; - simulateMinTime = 30; - simulateMaxTime = 100.0; - simulateDistanceLimit = "0.05f"; - simulateDistanceLimitTime = "5.0f"; - recoveryBlendTime = "0.5f"; - recoveryCosLimit = "0.3f"; - recoveryDistLimit = "0.7f"; - animBlendTime = "0.0f"; - }; - - class Soldier : BaseRagdoll { - primaryWeaponBone = "weapon"; - secondaryWeaponBone = "launcher"; - networkBonePrimary = "chest"; - networkBoneSecondary = "pelvis"; - draggingMask = "dragging"; - hitMask = "hit"; - hitMaskUnderwater = "hitUnderwater"; - - class WeaponLinkBones { - class LinkBone1 { - bone = "leftHand"; - canBeDropped = 1; - prefference = "1.0f"; - }; - - class LinkBone2 { - bone = "rightHand"; - canBeDropped = 1; - prefference = "2.0f"; - }; - - class LinkBone3 { - bone = "chest"; - canBeDropped = 1; - prefference = "1.0f"; - }; - }; - - class Masks { - class DraggingMask { - name = "dragging"; - mask[] = {{"pelvis", 0, 1}, {"chest", 0, 1}, {"head", "0.6f", 0}, {"leftArm", 1, 0}, {"leftForeArm", 1, 0}, {"leftHand", 1, 0}, {"rightArm", 1, 0}, {"rightForeArm", 1, 0}, {"rightHand", 1, 0}, {"leftUpLeg", 1, 0}, {"leftLeg", 1, 0}, {"leftFoot", 1, 0}, {"rightUpLeg", 1, 0}, {"rightLeg", 1, 0}, {"rightFoot", 1, 0}, {"weapon", 0, 1}, {"launcher", 0, 1}}; - }; - - class HitMask { - name = "hit"; - mask[] = {{"pelvis", 1, 0}, {"chest", 1, 0}, {"head", 1, 0}, {"leftArm", 1, 0}, {"leftForeArm", 1, 0}, {"leftHand", 1, 0}, {"rightArm", 1, 0}, {"rightForeArm", 1, 0}, {"rightHand", 1, 0}, {"leftUpLeg", 1, 0}, {"leftLeg", 1, 0}, {"leftFoot", 1, 1}, {"rightUpLeg", 1, 0}, {"rightLeg", 1, 0}, {"rightFoot", 1, 1}, {"weapon", 1, 0}, {"launcher", 1, 0}}; - }; - - class HitMaskUnderwater { - name = "hitUnderwater"; - mask[] = {{"pelvis", 1, 1}, {"chest", 1, 1}, {"head", 1, 0}, {"leftArm", 1, 0}, {"leftForeArm", 1, 0}, {"leftHand", 1, 0}, {"rightArm", 1, 0}, {"rightForeArm", 1, 0}, {"rightHand", 1, 0}, {"leftUpLeg", 1, 0}, {"leftLeg", 1, 0}, {"leftFoot", 1, 0}, {"rightUpLeg", 1, 0}, {"rightLeg", 1, 0}, {"rightFoot", 1, 0}, {"weapon", 1, 0}, {"launcher", 1, 0}}; - }; - }; - - class BaseRagdollBone { - material = "Ragdoll"; - childrenUseStartTrans = 1; - }; - - class Bones { - class Pelvis : BaseRagdollBone { - name = "pelvis"; - type = "capsule"; - startBone = "pelvis"; - endBone = "spine2"; - mass = 15; - radius = 0.12; - networkType = "root"; - }; - - class Chest : BaseRagdollBone { - name = "chest"; - type = "capsule"; - startBone = "spine1"; - endBone = "neck"; - radius = 0.16; - mass = 15; - }; - - class Head : BaseRagdollBone { - name = "head"; - type = "sphere"; - startBone = "head"; - mass = 8; - radius = 0.16; - }; - - class LeftArm : BaseRagdollBone { - name = "leftArm"; - type = "capsule"; - startBone = "leftArm"; - endBone = "leftForeArm"; - mass = 8; - }; - - class LeftForeArm : BaseRagdollBone { - name = "leftForeArm"; - type = "capsule"; - startBone = "leftForeArm"; - endBone = "leftHand"; - mass = 6; - }; - - class LeftHand : BaseRagdollBone { - name = "leftHand"; - type = "sphere"; - startBone = "leftHand"; - mass = 6; - radius = 0.08; - childrenUseStartTrans = 0; - networkType = "leftHand"; - }; - - class RightArm : BaseRagdollBone { - name = "rightArm"; - type = "capsule"; - startBone = "rightArm"; - endBone = "rightForeArm"; - mass = 8; - }; - - class RightForeArm : BaseRagdollBone { - name = "rightForeArm"; - type = "capsule"; - startBone = "rightForeArm"; - endBone = "rightHand"; - mass = 6; - }; - - class RightHand : BaseRagdollBone { - name = "rightHand"; - type = "sphere"; - startBone = "rightHand"; - mass = 6; - radius = 0.08; - childrenUseStartTrans = 0; - networkType = "rightHand"; - }; - - class LeftUpLeg : BaseRagdollBone { - name = "leftUpLeg"; - type = "capsule"; - startBone = "leftUpLeg"; - endBone = "leftLeg"; - mass = 15; - }; - - class LeftLeg : BaseRagdollBone { - name = "leftLeg"; - type = "capsule"; - startBone = "leftLeg"; - endBone = "leftFoot"; - mass = 10; - }; - - class LeftFoot : BaseRagdollBone { - name = "leftFoot"; - type = "box"; - startBone = "leftFoot"; - size[] = {0.15, 0.035, 0.07}; - mass = 8; - networkType = "leftFoot"; - }; - - class RightUpLeg : BaseRagdollBone { - name = "rightUpLeg"; - type = "capsule"; - startBone = "rightUpLeg"; - endBone = "rightLeg"; - mass = 15; - }; - - class RightLeg : BaseRagdollBone { - name = "rightLeg"; - type = "capsule"; - startBone = "rightLeg"; - endBone = "rightFoot"; - mass = 10; - }; - - class RightFoot : BaseRagdollBone { - name = "rightFoot"; - type = "box"; - startBone = "rightFoot"; - size[] = {0.15, 0.035, 0.07}; - mass = 8; - networkType = "rightFoot"; - }; - - class Weapon : BaseRagdollBone { - name = "weapon"; - type = "weapon"; - startBone = "weapon"; - endPosRelToStart[] = {0.0, 1.0, 0.0}; - mass = 3; - }; - - class Launcher : BaseRagdollBone { - name = "launcher"; - type = "weapon"; - startBone = "launcher"; - endPosRelToStart[] = {1.0, 0.0, 0.0}; - mass = 3; - }; - }; - - class JointsPX2 { - class Pelvis_Chest_PX2 : RagDollSphericalJoint { - name = "pelvis_chest"; - bone1 = "pelvis"; - bone2 = "chest"; - axis[] = {0, 1, 0.3}; - - class SwingLimit : SwingLimit { - value = 25; - }; - - class TwistLimitLow : TwistLimitLow { - value = -15; - }; - - class TwistLimitHigh : TwistLimitHigh { - value = 25; - }; - }; - - class Chest_Head_PX2 : RagDollSphericalJoint { - name = "chest_head"; - bone1 = "chest"; - bone2 = "head"; - - class SwingLimit : SwingLimit { - value = 20; - }; - - class TwistLimitLow : TwistLimitLow { - value = -15; - }; - - class TwistLimitHigh : TwistLimitHigh { - value = 15; - }; - }; - - class Chest_LeftArm_PX2 : RagDollSphericalJoint { - name = "chest_leftArm"; - bone1 = "chest"; - bone2 = "leftArm"; - axis[] = {-1, 0.0, 0.5}; - enableCollision = 1; - - class SwingLimit : SwingLimit { - value = 60; - }; - - class TwistLimitLow : TwistLimitLow { - value = -20; - }; - - class TwistLimitHigh : TwistLimitHigh { - value = 20; - }; - }; - - class LeftArm_LeftForeArm_PX2 : RagDollRevoluteJoint { - name = "leftArm_leftForeArm"; - bone1 = "leftArm"; - bone2 = "leftForeArm"; - axis[] = {1, -1, 0.2}; - - class LimitLow : LimitLow { - value = -2; - }; - - class LimitHigh : LimitHigh { - value = 60; - }; - }; - - class LeftForeArm_LeftHand_PX2 : RagDollSphericalJoint { - name = "leftForeArm_leftHand"; - bone1 = "leftForeArm"; - bone2 = "leftHand"; - - class SwingLimit : SwingLimit { - value = 20; - }; - - class TwistLimitLow : TwistLimitLow { - value = -5; - }; - - class TwistLimitHigh : TwistLimitHigh { - value = 5; - }; - }; - - class Chest_RightArm_PX2 : RagDollSphericalJoint { - name = "chest_rightArm"; - bone1 = "chest"; - bone2 = "rightArm"; - axis[] = {1, 0.0, 0.5}; - enableCollision = 1; - - class SwingLimit : SwingLimit { - value = 60; - }; - - class TwistLimitLow : TwistLimitLow { - value = -20; - }; - - class TwistLimitHigh : TwistLimitHigh { - value = 20; - }; - }; - - class RightArm_RightForeArm_PX2 : RagDollRevoluteJoint { - name = "rightArm_rightForeArm"; - bone1 = "rightArm"; - bone2 = "rightForeArm"; - axis[] = {1, 1, -0.2}; - - class LimitLow : LimitLow { - value = -2; - }; - - class LimitHigh : LimitHigh { - value = 60; - }; - }; - - class RightForeArm_RightHand_PX2 : RagDollSphericalJoint { - name = "rightForeArm_rightHand"; - bone1 = "rightForeArm"; - bone2 = "rightHand"; - - class SwingLimit : SwingLimit { - value = 20; - }; - - class TwistLimitLow : TwistLimitLow { - value = -5; - }; - - class TwistLimitHigh : TwistLimitHigh { - value = 5; - }; - }; - - class Pelvis_LeftUpLeg_PX2 : RagDollSphericalJoint { - name = "pelvis_leftUpLeg"; - bone1 = "pelvis"; - bone2 = "leftUpLeg"; - axis[] = {-1.5, -1.1, 2}; - enableCollision = 1; - - class SwingLimit : SwingLimit { - value = 45; - }; - - class TwistLimitLow : TwistLimitLow { - value = -10; - }; - - class TwistLimitHigh : TwistLimitHigh { - value = 20; - }; - }; - - class LeftUpLeg_LeftLeg_PX2 : RagDollRevoluteJoint { - name = "leftUpLeg_leftLeg"; - bone1 = "leftUpLeg"; - bone2 = "leftLeg"; - axis[] = {-1, 0, 0}; - - class LimitLow : LimitLow { - value = -5; - }; - - class LimitHigh : LimitHigh { - value = 110; - }; - }; - - class LeftLeg_LeftFoot_PX2 : RagDollRevoluteJoint { - name = "leftLeg_leftFoot"; - bone1 = "leftLeg"; - bone2 = "leftFoot"; - axis[] = {-1, 0, 0}; - - class LimitLow : LimitLow { - value = -15; - }; - - class LimitHigh : LimitHigh { - value = 45; - }; - }; - - class Pelvis_RightUpLeg_PX2 : RagDollSphericalJoint { - name = "pelvis_rightUpLeg"; - bone1 = "pelvis"; - bone2 = "rightUpLeg"; - axis[] = {1.5, -1.1, 2}; - enableCollision = 1; - - class SwingLimit : SwingLimit { - value = 45; - }; - - class TwistLimitLow : TwistLimitLow { - value = -10; - }; - - class TwistLimitHigh : TwistLimitHigh { - value = 20; - }; - }; - - class RightUpLeg_RightLeg_PX2 : RagDollRevoluteJoint { - name = "rightUpLeg_rightLeg"; - bone1 = "rightUpLeg"; - bone2 = "rightLeg"; - axis[] = {-1, 0, 0}; - - class LimitLow : LimitLow { - value = -5; - }; - - class LimitHigh : LimitHigh { - value = 110; - }; - }; - - class RightLeg_RightFoot_PX2 : RagDollRevoluteJoint { - name = "rightLeg_rightFoot"; - bone1 = "rightLeg"; - bone2 = "rightFoot"; - axis[] = {-1, 0, 0}; - - class LimitLow : LimitLow { - value = -15; - }; - - class LimitHigh : LimitHigh { - value = 45; - }; - }; - }; - - class JointsPX3 { - class Pelvis_Chest_PX3 : RagDollD6Joint_PX3 { - name = "pelvis_chest"; - bone1 = "pelvis"; - bone2 = "chest"; - axis[] = {0, 1, 0.3}; - enableCollision = 0; - swingLimitY = 30; - swingLimitZ = 30; - twistLimitLower = -25; - twistLimitUpper = 25; - driveSpring = 30; - driveDamping = 30; - driveSpringWater = 5; - driveDampingWater = 5; - }; - - class Chest_Head_PX3 : RagDollD6Joint_PX3 { - name = "chest_head"; - bone1 = "chest"; - bone2 = "head"; - swingLimitY = 45; - swingLimitZ = 45; - twistLimitLower = -40; - twistLimitUpper = 40; - driveSpring = 15.0; - driveDamping = 30; - driveSpringWater = 1.5; - driveDampingWater = 3.0; - twistSpring = 15.0; - twistDamping = 30.0; - }; - - class Chest_LeftArm_PX3 : RagDollD6Joint_PX3 { - name = "chest_leftArm"; - bone1 = "chest"; - bone2 = "leftArm"; - enableCollision = 1; - swingLimitY = 85; - swingLimitZ = 85; - twistLimitLower = -60; - twistLimitUpper = 60; - driveSpring = 30; - driveDamping = 30; - driveSpringWater = 3; - driveDampingWater = 3; - }; - - class LeftArm_LeftForeArm_PX3 : RagDollD6Joint_PX3 { - name = "leftArm_leftForeArm"; - bone1 = "leftArm"; - bone2 = "leftForeArm"; - axis[] = {-1, 1, -0.2}; - swingLimitY = 10; - swingLimitZ = 10; - twistLimitLower = -5; - twistLimitUpper = 150; - driveSpring = 10; - driveDamping = 10; - driveSpringWater = 1; - driveDampingWater = 1; - }; - - class LeftForeArm_LeftHand_PX3 : RagDollD6Joint_PX3 { - name = "leftForeArm_leftHand"; - bone1 = "leftForeArm"; - bone2 = "leftHand"; - swingLimitY = 10; - swingLimitZ = 10; - twistLimitLower = -20; - twistLimitUpper = 20; - driveSpring = 10; - driveDamping = 10; - driveSpringWater = 1; - driveDampingWater = 1; - }; - - class Chest_RightArm_PX3 : RagDollD6Joint_PX3 { - name = "chest_rightArm"; - bone1 = "chest"; - bone2 = "rightArm"; - enableCollision = 1; - swingLimitY = 85; - swingLimitZ = 85; - twistLimitLower = -60; - twistLimitUpper = 60; - driveSpring = 30; - driveDamping = 30; - driveSpringWater = 3; - driveDampingWater = 3; - }; - - class RightArm_RightForeArm_PX3 : RagDollD6Joint_PX3 { - name = "rightArm_rightForeArm"; - bone1 = "rightArm"; - bone2 = "rightForeArm"; - axis[] = {-1, -1, 0.2}; - swingLimitY = 10; - swingLimitZ = 10; - twistLimitLower = -5; - twistLimitUpper = 150; - driveSpring = 10; - driveDamping = 10; - driveSpringWater = 1; - driveDampingWater = 1; - }; - - class RightForeArm_RightHand_PX3 : RagDollD6Joint_PX3 { - name = "rightForeArm_rightHand"; - bone1 = "rightForeArm"; - bone2 = "rightHand"; - swingLimitY = 10; - swingLimitZ = 10; - twistLimitLower = -20; - twistLimitUpper = 20; - driveSpring = 10; - driveDamping = 10; - driveSpringWater = 1; - driveDampingWater = 1; - }; - - class Pelvis_LeftUpLeg_PX3 : RagDollD6Joint_PX3 { - name = "pelvis_leftUpLeg"; - bone1 = "pelvis"; - bone2 = "leftUpLeg"; - enableCollision = 1; - swingLimitY = 35; - swingLimitZ = 35; - twistLimitLower = -10; - twistLimitUpper = 60; - driveSpring = 30; - driveDamping = 30; - driveSpringWater = 3; - driveDampingWater = 3; - twistDamping = 30.0; - }; - - class LeftUpLeg_LeftLeg_PX3 : RagDollD6Joint_PX3 { - name = "leftUpLeg_leftLeg"; - bone1 = "leftUpLeg"; - bone2 = "leftLeg"; - axis[] = {1, 0, 0}; - swingLimitY = 10; - swingLimitZ = 10; - twistLimitLower = -5; - twistLimitUpper = 120; - driveSpring = 20; - driveDamping = 20; - driveSpringWater = 2; - driveDampingWater = 2; - }; - - class LeftLeg_LeftFoot_PX3 : RagDollD6Joint_PX3 { - name = "leftLeg_leftFoot"; - bone1 = "leftLeg"; - bone2 = "leftFoot"; - axis[] = {1, 0, 0}; - swingLimitY = 10; - swingLimitZ = 10; - twistLimitLower = -15; - twistLimitUpper = 45; - driveSpring = 20; - driveDamping = 20; - driveSpringWater = 2; - driveDampingWater = 2; - }; - - class Pelvis_RightUpLeg_PX3 : RagDollD6Joint_PX3 { - name = "pelvis_rightUpLeg"; - bone1 = "pelvis"; - bone2 = "rightUpLeg"; - enableCollision = 1; - swingLimitY = 35; - swingLimitZ = 35; - twistLimitLower = -10; - twistLimitUpper = 60; - driveSpring = 30; - driveDamping = 30; - driveSpringWater = 3; - driveDampingWater = 3; - twistDamping = 30.0; - }; - - class RightUpLeg_RightLeg_PX3 : RagDollD6Joint_PX3 { - name = "rightUpLeg_rightLeg"; - bone1 = "rightUpLeg"; - bone2 = "rightLeg"; - axis[] = {1, 0, 0}; - swingLimitY = 10; - swingLimitZ = 10; - twistLimitLower = -5; - twistLimitUpper = 120; - driveSpring = 20; - driveDamping = 20; - driveSpringWater = 2; - driveDampingWater = 2; - }; - - class RightLeg_RightFoot_PX3 : RagDollD6Joint_PX3 { - name = "rightLeg_rightFoot"; - bone1 = "rightLeg"; - bone2 = "rightFoot"; - axis[] = {1, 0, 0}; - swingLimitY = 10; - swingLimitZ = 10; - twistLimitLower = -15; - twistLimitUpper = 45; - driveSpring = 20; - driveDamping = 20; - driveSpringWater = 2; - driveDampingWater = 2; - }; - }; - }; -}; diff --git a/addons/ragdolls/script_component.hpp b/addons/ragdolls/script_component.hpp deleted file mode 100644 index a0de706e10..0000000000 --- a/addons/ragdolls/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT ragdolls -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_RAGDOLLS - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_RAGDOLLS - #define DEBUG_SETTINGS DEBUG_SETTINGS_RAGDOLLS -#endif - -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/rangecard/CfgEventHandlers.hpp b/addons/rangecard/CfgEventHandlers.hpp index 3996e3371d..5da5fd0dc2 100644 --- a/addons/rangecard/CfgEventHandlers.hpp +++ b/addons/rangecard/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); @@ -8,4 +15,4 @@ class Extended_PostInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; -}; \ No newline at end of file +}; diff --git a/addons/rangecard/XEH_PREP.hpp b/addons/rangecard/XEH_PREP.hpp new file mode 100644 index 0000000000..6b13dcc45a --- /dev/null +++ b/addons/rangecard/XEH_PREP.hpp @@ -0,0 +1,9 @@ + +PREP(calculateSolution); +PREP(canCopy); +PREP(canShow); +PREP(canShowCopy); +PREP(onCloseDialog); +PREP(openRangeCard); +PREP(updateClassNames); +PREP(updateRangeCard); diff --git a/addons/rangecard/XEH_preInit.sqf b/addons/rangecard/XEH_preInit.sqf index 5e5685d30f..a7feade1c3 100644 --- a/addons/rangecard/XEH_preInit.sqf +++ b/addons/rangecard/XEH_preInit.sqf @@ -2,13 +2,6 @@ ADDON = false; -PREP(calculateSolution); -PREP(canCopy); -PREP(canShow); -PREP(canShowCopy); -PREP(onCloseDialog); -PREP(openRangeCard); -PREP(updateClassNames); -PREP(updateRangeCard); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/rangecard/XEH_preStart.sqf b/addons/rangecard/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/rangecard/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/rangecard/script_component.hpp b/addons/rangecard/script_component.hpp index 8281f77eb3..251fb7263f 100644 --- a/addons/rangecard/script_component.hpp +++ b/addons/rangecard/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT rangecard #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RANGECARD #define DEBUG_MODE_FULL #endif diff --git a/addons/rangecard/stringtable.xml b/addons/rangecard/stringtable.xml index 309241a565..0bd1160b87 100644 --- a/addons/rangecard/stringtable.xml +++ b/addons/rangecard/stringtable.xml @@ -11,6 +11,7 @@ Table de tir Távolsági kártya Таблица поправок + Tavola Balistica 50 METER increments -- MRAD/MRAD (reticle/turrets) @@ -22,6 +23,7 @@ Incrément de 50m -- MRAD/MRAD (réticule/tourelle) 50 MÉTERES lépések - MRAD/MRAD (célzó/lövegek) Шаг 50 МЕТРОВ - MRAD/MRAD (сетка/маховички) + Incrementi per 50 METRI - MRAD/MRAD (reticolo/torrette) Open Range Card @@ -33,6 +35,7 @@ Ouvrir la table de tir Távolsági kártya kinyitása Открыть таблицу поправок + Apri Tavola Balistica Open Range Card Copy @@ -44,6 +47,7 @@ Ouvrir une copie de la table de tir Távolsági kártya-másolat kinyitása Открыть копию таблицы поправок + Apri Copia Tavola Balistica Open Range Card @@ -55,6 +59,7 @@ Ouvrir la table de tir Távolsági kártya kinyitása Открыть таблицу поправок + Apri Tavola Balistica Open Range Card Copy @@ -66,6 +71,7 @@ Ouvrir une copie de la table de tir Távolsági kártya-másolat kinyitása Открыть копию таблицы поправок + Apri Copia Tavola Balistica Copy Range Card @@ -77,6 +83,7 @@ Recopier la table de tir Távolsági kártya másolása Скопировать таблицу поправок + Copia Tavola Balistica - + \ No newline at end of file diff --git a/addons/realisticnames/CfgMagazines.hpp b/addons/realisticnames/CfgMagazines.hpp index 69d6cfa579..a6a64a4a15 100644 --- a/addons/realisticnames/CfgMagazines.hpp +++ b/addons/realisticnames/CfgMagazines.hpp @@ -394,6 +394,7 @@ class CfgMagazines { // hand grenades class HandGrenade: CA_Magazine { displayName = CSTRING(HandGrenade_Name); + displayNameShort = "M67"; }; class SmokeShell: HandGrenade { displayName = CSTRING(SmokeShell_Name); diff --git a/addons/realisticnames/CfgVehicles.hpp b/addons/realisticnames/CfgVehicles.hpp index 9aea632247..61864a8259 100644 --- a/addons/realisticnames/CfgVehicles.hpp +++ b/addons/realisticnames/CfgVehicles.hpp @@ -170,7 +170,7 @@ class CfgVehicles { // wheeled apcs class B_APC_Wheeled_01_base_F; class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F { - displayName = CSTRING(APC_Wheeled_cannon_Name); + displayName = CSTRING(APC_Wheeled_01_cannon_Name); }; class O_APC_Wheeled_02_base_F; diff --git a/addons/realisticnames/CfgWeapons.hpp b/addons/realisticnames/CfgWeapons.hpp index 2adff28a41..645b6a8984 100644 --- a/addons/realisticnames/CfgWeapons.hpp +++ b/addons/realisticnames/CfgWeapons.hpp @@ -527,10 +527,10 @@ class CfgWeapons { }; // class ACE_LMG_coax_PKT_mem2: LMG_coax {}; class ACE_LMG_coax_MAG58_mem2: LMG_coax { - displayName = "MAG 58"; + displayName = "MAG 58M"; }; class ACE_LMG_coax_MAG58_mem3: LMG_coax { - displayName = "MAG 58"; + displayName = "MAG 58M"; }; class ACE_LMG_coax_L94A1_mem3: LMG_coax { displayName = "L94A1"; diff --git a/addons/realisticnames/script_component.hpp b/addons/realisticnames/script_component.hpp index 0dd8e679a7..33cd56777a 100644 --- a/addons/realisticnames/script_component.hpp +++ b/addons/realisticnames/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT realisticnames #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_REALISTICNAMES #define DEBUG_MODE_FULL #endif diff --git a/addons/realisticnames/stringtable.xml b/addons/realisticnames/stringtable.xml index 4865186563..ad8338b0f1 100644 --- a/addons/realisticnames/stringtable.xml +++ b/addons/realisticnames/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -229,17 +229,17 @@ Bardelas Bardelas - - Patria AMV - Patria AMV - Patria AMV - Patria AMV - Patria AMV - Patria AMV - Patria AMV - Patria AMV - Patria AMV - Patria AMV + + Badger IFV + SPz Badger + Badger IFV + Badger IFV + Badger IFV + Badger IFV + БМП Badger + Badger IFV + Badger IFV + Badger IFV Nemmera @@ -426,7 +426,7 @@ KamAZ Transport KamAZ de transporte KamAZ transportowy - KamAZ-5350 (valník) + KamAZ (valník) KamAZ Transport КамАЗ Транспортный KamAZ Transporte @@ -438,7 +438,7 @@ KamAZ Transport (bedeckt) KamAZ de transporte (cubierto) KamAZ Transportowy (zakryty) - KamAZ-5350 (valník-krytý) + KamAZ (valník-krytý) KamAZ Transport (bâché) КамАЗ Транспортный (крытый) KamAZ Transporte (coberto) @@ -450,7 +450,7 @@ KamAZ Munition KamAZ de munición KamAZ Amunicyjny - KamAZ-5350 (muniční) + KamAZ (muniční) KamAZ Munitions КамАЗ Боеприпасы KamAZ Munições @@ -462,7 +462,7 @@ KamAZ Treibstoff KamAZ de combustible KamAZ cysterna - KamAZ-5350 (cisterna) + KamAZ (cisterna) KamAZ Citerne КамАЗ Заправщик KamAZ Combustível @@ -474,7 +474,7 @@ KamAZ Instandsetzung KamAZ de reparación KamAZ Naprawczy - KamAZ-5350 (opravárenský) + KamAZ (opravárenský) KamAZ Réparation КамАЗ Ремонтный KamAZ Reparador @@ -486,7 +486,7 @@ KamAZ Sanitäter KamAZ médico KamAZ Medyczny - KamAZ-5350 (zdravotnický) + KamAZ (zdravotnický) KamAZ Médical КамАЗ Медицинский KamAZ Médico @@ -594,7 +594,7 @@ Typhoon Transport Typhoon de transporte Typhoon Transportowy - KamAZ-63968 Typhoon (valník) + KamAZ Typhoon (valník) Typhoon Transport Тайфун Транспортный Typhoon Transporte @@ -606,7 +606,7 @@ Typhoon Transport (bedeckt) Typhoon de transporte (cubierto) Typhoon Transportowy (przykryty) - KamAZ-63968 Typhoon (valník-krytý) + KamAZ Typhoon (valník-krytý) Typhoon Transport (bâché) Тайфун Транспортный (крытый) Typhoon Transporte (coberto) @@ -618,7 +618,7 @@ Typhoon Gerät Typhoon con dispositivo Typhoon Urządzenie - KamAZ-63968 Typhoon (zařízení) + KamAZ Typhoon (zařízení) Typhoon Dispositif Тайфун Устройство Typhoon Dispositivo @@ -630,7 +630,7 @@ Typhoon Munition Typhoon de munición Typhoon Amunicyjny - KamAZ-63968 Typhoon (muniční) + KamAZ Typhoon (muniční) Typhoon Munitions Тайфун Боеприпасы Typhoon Munições @@ -642,7 +642,7 @@ Typhoon Treibstoff Typhoon de combustible Typhoon Cysterna - KamAZ-63968 Typhoon (cisterna) + KamAZ Typhoon (cisterna) Typhoon Citerne Тайфун Заправщик Typhoon Combustível @@ -654,7 +654,7 @@ Typhoon Instandsetzung Typhoon de reparación Typhoon Naprawczy - KamAZ-63968 Typhoon (opravárenský) + KamAZ Typhoon (opravárenský) Typhoon Réparation Тайфун Ремонтный Typhoon Reparador @@ -666,7 +666,7 @@ Typhoon Sanitäter Typhoon médico Typhoon Medyczny - KamAZ-63968 Typhoon (zdravotnický) + KamAZ Typhoon (zdravotnický) Typhoon Médical Тайфун Медицинский Typhoon Médico @@ -1730,7 +1730,7 @@ ASP-1 Kir (Black) - ASP-1 Kir (Čená) + ASP-1 Kir (Černá) ASP-1 Kir (Noir) ASP-1 Kir (Negro) ASP-1 Kir (Чёрный) diff --git a/addons/rearm/CfgEventHandlers.hpp b/addons/rearm/CfgEventHandlers.hpp index 93371889e1..17edc1dc30 100644 --- a/addons/rearm/CfgEventHandlers.hpp +++ b/addons/rearm/CfgEventHandlers.hpp @@ -1,10 +1,16 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; - class Extended_Init_EventHandlers { class GVAR(defaultCarriedObject) { // TODO check if we need to add all subclasses class ADDON { diff --git a/addons/rearm/XEH_PREP.hpp b/addons/rearm/XEH_PREP.hpp new file mode 100644 index 0000000000..20dfaf8211 --- /dev/null +++ b/addons/rearm/XEH_PREP.hpp @@ -0,0 +1,25 @@ + +PREP(addRearmActions); +PREP(canRearm); +PREP(canStoreAmmo); +PREP(canTakeAmmo); +PREP(createDummy); +PREP(dropAmmo); +PREP(getConfigMagazines); +PREP(getMaxMagazines); +PREP(getNeedRearmMagazines); +PREP(grabAmmo); +PREP(handleKilled); +PREP(handleUnconscious); +PREP(makeDummy); +PREP(moduleRearmSettings); +PREP(pickUpAmmo); +PREP(rearm); +PREP(rearmEntireVehicle); +PREP(rearmEntireVehicleSuccess); +PREP(rearmEntireVehicleSuccessLocal); +PREP(rearmSuccess); +PREP(rearmSuccessLocal); +PREP(storeAmmo); +PREP(takeAmmo); +PREP(takeSuccess); diff --git a/addons/rearm/XEH_postInit.sqf b/addons/rearm/XEH_postInit.sqf index 607b768b15..c22b84ffb4 100644 --- a/addons/rearm/XEH_postInit.sqf +++ b/addons/rearm/XEH_postInit.sqf @@ -2,3 +2,7 @@ ["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventHandler); ["playerVehicleChanged", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}] call EFUNC(common,addEventHandler); + +if (isServer) then { + addMissionEventHandler ["HandleDisconnect", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}]; +}; diff --git a/addons/rearm/XEH_preInit.sqf b/addons/rearm/XEH_preInit.sqf index c52423f67f..a7feade1c3 100644 --- a/addons/rearm/XEH_preInit.sqf +++ b/addons/rearm/XEH_preInit.sqf @@ -2,29 +2,6 @@ ADDON = false; -PREP(addRearmActions); -PREP(canRearm); -PREP(canStoreAmmo); -PREP(canTakeAmmo); -PREP(createDummy); -PREP(dropAmmo); -PREP(getConfigMagazines); -PREP(getMaxMagazines); -PREP(getNeedRearmMagazines); -PREP(grabAmmo); -PREP(handleKilled); -PREP(handleUnconscious); -PREP(makeDummy); -PREP(moduleRearmSettings); -PREP(pickUpAmmo); -PREP(rearm); -PREP(rearmEntireVehicle); -PREP(rearmEntireVehicleSuccess); -PREP(rearmEntireVehicleSuccessLocal); -PREP(rearmSuccess); -PREP(rearmSuccessLocal); -PREP(storeAmmo); -PREP(takeAmmo); -PREP(takeSuccess); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/rearm/XEH_preStart.sqf b/addons/rearm/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/rearm/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/rearm/functions/fnc_addRearmActions.sqf b/addons/rearm/functions/fnc_addRearmActions.sqf index 2011cc73de..6040fd6fc5 100644 --- a/addons/rearm/functions/fnc_addRearmActions.sqf +++ b/addons/rearm/functions/fnc_addRearmActions.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" private ["_vehicleActions", "_actions", "_action", "_vehicles", "_vehicle", "_needToAdd", "_magazineHelper", "_turretPath", "_magazines", "_magazine", "_icon", "_cnt"]; -params ["_target"]; +params [["_target", objNull, [objNull]]]; _vehicles = nearestObjects [_target, ["AllVehicles"], 20]; if (count _vehicles < 2) exitWith {false}; // Rearming needs at least 2 vehicles @@ -31,16 +31,11 @@ _vehicleActions = []; _magazineHelper = []; { _turretPath = _x; - _magazines = []; - if (_turretPath isEqualTo [-1]) then { - _magazines = [_vehicle, _turretPath] call FUNC(getConfigMagazines); - } else { - _magazines = _vehicle magazinesTurret _turretPath; - }; + _magazines = [_vehicle, _turretPath] call FUNC(getConfigMagazines); { _magazine = _x; - _cnt = { _x == _magazine } count (_vehicle magazinesTurret _turretPath); - if ((_cnt < ([_vehicle, _turretPath, _magazine] call FUNC(getMaxMagazines))) && !(_magazine in _magazineHelper)) then { + _currentMagazines = { _x == _magazine } count (_vehicle magazinesTurret _turretPath); + if ((_currentMagazines < ([_vehicle, _turretPath, _magazine] call FUNC(getMaxMagazines))) && !(_magazine in _magazineHelper)) then { _action = [_magazine, getText(configFile >> "CfgMagazines" >> _magazine >> "displayName"), getText(configFile >> "CfgMagazines" >> _magazine >> "picture"), diff --git a/addons/rearm/functions/fnc_canRearm.sqf b/addons/rearm/functions/fnc_canRearm.sqf index 834e6a9202..202524dd10 100644 --- a/addons/rearm/functions/fnc_canRearm.sqf +++ b/addons/rearm/functions/fnc_canRearm.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" private ["_dummy","_magazineClass"]; -params ["_target", "_unit"]; +params [["_target", objNull, [objNull]], ["_unit", objNull, [objNull]]]; if (GVAR(level) == 0 || {isNull _unit} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {_target distance _unit > REARM_ACTION_DISTANCE} || {_target getVariable [QGVAR(disabled), false]}) exitWith {false}; diff --git a/addons/rearm/functions/fnc_canStoreAmmo.sqf b/addons/rearm/functions/fnc_canStoreAmmo.sqf index 4018775d43..a3139d6f11 100644 --- a/addons/rearm/functions/fnc_canStoreAmmo.sqf +++ b/addons/rearm/functions/fnc_canStoreAmmo.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_target", "_unit"]; +params [["_target", objNull, [objNull]], ["_unit", objNull, [objNull]]]; !(isNull _unit || {!(_unit isKindOf "CAManBase")} || diff --git a/addons/rearm/functions/fnc_canTakeAmmo.sqf b/addons/rearm/functions/fnc_canTakeAmmo.sqf index 43a96515e5..496e7a12a4 100644 --- a/addons/rearm/functions/fnc_canTakeAmmo.sqf +++ b/addons/rearm/functions/fnc_canTakeAmmo.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_target", "_unit"]; +params [["_target", objNull, [objNull]], ["_unit", objNull, [objNull]]]; !(isNull _unit || {!(_unit isKindOf "CAManBase")} || diff --git a/addons/rearm/functions/fnc_createDummy.sqf b/addons/rearm/functions/fnc_createDummy.sqf index f9d335c08a..38955fb806 100644 --- a/addons/rearm/functions/fnc_createDummy.sqf +++ b/addons/rearm/functions/fnc_createDummy.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" private ["_ammo", "_dummyName", "_dummy"]; -params ["_unit", "_magazineClass"]; +params [["_unit", objNull, [objNull]], ["_magazineClass", "", [""]]]; _ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo"); _dummyName = getText (configFile >> "CfgAmmo" >> _ammo >> QGVAR(dummy)); diff --git a/addons/rearm/functions/fnc_dropAmmo.sqf b/addons/rearm/functions/fnc_dropAmmo.sqf index 8fc9ba4945..48433c2f4a 100644 --- a/addons/rearm/functions/fnc_dropAmmo.sqf +++ b/addons/rearm/functions/fnc_dropAmmo.sqf @@ -18,7 +18,7 @@ #include "script_component.hpp" private ["_dummy", "_actionID"]; -params ["_unit", ["_delete", false], ["_unholster", true]]; +params [["_unit", objNull, [objNull]], ["_delete", false, [false]], ["_unholster", true, [true]]]; _dummy = _unit getVariable [QGVAR(dummy), objNull]; if !(isNull _dummy) then { @@ -36,7 +36,7 @@ if (_actionID != -1) then { _unit removeAction _actionID; _unit setVariable [QGVAR(ReleaseActionID), nil]; }; -[_unit, QGVAR(vehRearm), false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", QGVAR(vehRearm), false] call EFUNC(common,statusEffect_set); if (_unholster) then { REARM_UNHOLSTER_WEAPON diff --git a/addons/rearm/functions/fnc_getConfigMagazines.sqf b/addons/rearm/functions/fnc_getConfigMagazines.sqf index 9662f30ce7..dce6c5da64 100644 --- a/addons/rearm/functions/fnc_getConfigMagazines.sqf +++ b/addons/rearm/functions/fnc_getConfigMagazines.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_target", "_turretPath"]; +params [["_target", objNull, [objNull]], ["_turretPath", [], [[]]]]; if (isNull _target) exitWith {[]}; diff --git a/addons/rearm/functions/fnc_getMaxMagazines.sqf b/addons/rearm/functions/fnc_getMaxMagazines.sqf index 632b5e5918..b6211333f0 100644 --- a/addons/rearm/functions/fnc_getMaxMagazines.sqf +++ b/addons/rearm/functions/fnc_getMaxMagazines.sqf @@ -18,7 +18,7 @@ #include "script_component.hpp" private ["_count", "_cfg"]; -params ["_target", "_turretPath", "_magazineClass"]; +params [["_target", objNull, [objNull]], ["_turretPath", [], [[]]], ["_magazineClass", "", [""]]]; if (isNull _target) exitWith {0}; diff --git a/addons/rearm/functions/fnc_getNeedRearmMagazines.sqf b/addons/rearm/functions/fnc_getNeedRearmMagazines.sqf index 7a591c6c32..f56b437708 100644 --- a/addons/rearm/functions/fnc_getNeedRearmMagazines.sqf +++ b/addons/rearm/functions/fnc_getNeedRearmMagazines.sqf @@ -10,7 +10,7 @@ * Return Value * 0: Can Rearm * 1: TurretPath - * 2: Magazine Classname + * 2: Number of current magazines in turret path * * Example: * [tank, "mag"] call ace_rearm_fnc_getNeedRearmMagazines @@ -19,27 +19,22 @@ */ #include "script_component.hpp" -private ["_return", "_magazines", "_cnt"]; +private ["_return", "_magazines", "_currentMagazines"]; params ["_target", "_magazineClass"]; _return = [false, [], 0]; { - _magazines = []; - if (_x isEqualTo [-1]) then { - _magazines = [_target, _x] call FUNC(getConfigMagazines); - } else { - _magazines = _target magazinesTurret _x; - }; + _magazines = [_target, _x] call FUNC(getConfigMagazines); if (_magazineClass in _magazines) then { - _cnt = {_x == _magazineClass} count (_target magazinesTurret _x); + _currentMagazines = {_x == _magazineClass} count (_target magazinesTurret _x); if ((_target magazineTurretAmmo [_magazineClass, _x]) < getNumber (configFile >> "CfgMagazines" >> _magazineClass >> "count")) exitWith { - _return = [true, _x, _cnt]; + _return = [true, _x, _currentMagazines]; }; - if (_cnt < ([_target, _x, _magazineClass] call FUNC(getMaxMagazines))) exitWith { - _return = [true, _x, _cnt]; + if (_currentMagazines < ([_target, _x, _magazineClass] call FUNC(getMaxMagazines))) exitWith { + _return = [true, _x, _currentMagazines]; }; }; diff --git a/addons/rearm/functions/fnc_grabAmmo.sqf b/addons/rearm/functions/fnc_grabAmmo.sqf index 9b09d1282d..161627da28 100644 --- a/addons/rearm/functions/fnc_grabAmmo.sqf +++ b/addons/rearm/functions/fnc_grabAmmo.sqf @@ -16,10 +16,10 @@ */ #include "script_component.hpp" -params ["_dummy", "_unit"]; +params [["_dummy", objNull, [objNull]], ["_unit", objNull, [objNull]]]; REARM_HOLSTER_WEAPON -[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set); [ 5, diff --git a/addons/rearm/functions/fnc_handleKilled.sqf b/addons/rearm/functions/fnc_handleKilled.sqf index b0cdabaed5..5f80246f52 100644 --- a/addons/rearm/functions/fnc_handleKilled.sqf +++ b/addons/rearm/functions/fnc_handleKilled.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; if (!local _unit) exitWith {}; diff --git a/addons/rearm/functions/fnc_handleUnconscious.sqf b/addons/rearm/functions/fnc_handleUnconscious.sqf index f9d703f4ec..eab25fcf64 100644 --- a/addons/rearm/functions/fnc_handleUnconscious.sqf +++ b/addons/rearm/functions/fnc_handleUnconscious.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_isUnconscious"]; +params [["_unit", objNull, [objNull]], ["_isUnconscious", false, [false]]]; if (!local _unit || {!_isUnconscious}) exitWith {}; diff --git a/addons/rearm/functions/fnc_makeDummy.sqf b/addons/rearm/functions/fnc_makeDummy.sqf index 97ab46fdbc..390ff658e0 100644 --- a/addons/rearm/functions/fnc_makeDummy.sqf +++ b/addons/rearm/functions/fnc_makeDummy.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_obj", "_dirAndUp"]; +params [["_obj", objNull, [objNull]], ["_dirAndUp", [[1,0,0],[0,0,1]], [[]]]]; _obj setVectorDirAndUp _dirAndUp; _obj allowDamage false; diff --git a/addons/rearm/functions/fnc_moduleRearmSettings.sqf b/addons/rearm/functions/fnc_moduleRearmSettings.sqf index ec5edd1666..af627862da 100644 --- a/addons/rearm/functions/fnc_moduleRearmSettings.sqf +++ b/addons/rearm/functions/fnc_moduleRearmSettings.sqf @@ -17,7 +17,7 @@ */ #include "script_component.hpp" -params ["_logic", "", "_activated"]; +params ["_logic", "", ["_activated", false, [false]]]; if (!_activated) exitWith {}; diff --git a/addons/rearm/functions/fnc_pickUpAmmo.sqf b/addons/rearm/functions/fnc_pickUpAmmo.sqf index eaaa55ade6..546fc318b7 100644 --- a/addons/rearm/functions/fnc_pickUpAmmo.sqf +++ b/addons/rearm/functions/fnc_pickUpAmmo.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" private ["_magazineClass"]; -params ["_target", "_unit"]; +params [["_target", objNull, [objNull]], ["_unit", objNull, [objNull]]]; _dummy = _unit getVariable [QGVAR(dummy), objNull]; if !(isNull _dummy) exitWith {}; diff --git a/addons/rearm/functions/fnc_rearm.sqf b/addons/rearm/functions/fnc_rearm.sqf index 3208dbfb6f..61009b085d 100644 --- a/addons/rearm/functions/fnc_rearm.sqf +++ b/addons/rearm/functions/fnc_rearm.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" private ["_magazineClass", "_ammo", "_tmpCal", "_cal", "_idx", "_needRearmMags", "_magazineDisplayName"]; -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; _dummy = _unit getVariable [QGVAR(dummy), objNull]; if (isNull _dummy) exitwith {false}; diff --git a/addons/rearm/functions/fnc_rearmEntireVehicle.sqf b/addons/rearm/functions/fnc_rearmEntireVehicle.sqf index c1c08dce52..27fd20c528 100644 --- a/addons/rearm/functions/fnc_rearmEntireVehicle.sqf +++ b/addons/rearm/functions/fnc_rearmEntireVehicle.sqf @@ -16,8 +16,7 @@ * Public: No */ #include "script_component.hpp" - -params ["_target", "_unit", "_vehicle"]; // _target is for future possible finite ammo, _unit placeholder +params [["_target", objNull, [objNull]], ["_unit", objNull, [objNull]], ["_vehicle", objNull, [objNull]]]; // _target is for future possible finite ammo, _unit placeholder [ 10, diff --git a/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf b/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf index cddce3ac3a..c12286516c 100644 --- a/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf +++ b/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" private ["_turretPath", "_magazines", "_magazine", "_currentMagazines", "_maxMagazines", "_maxRounds", "_currentRounds"]; -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; if (isServer) then { { diff --git a/addons/rearm/functions/fnc_rearmEntireVehicleSuccessLocal.sqf b/addons/rearm/functions/fnc_rearmEntireVehicleSuccessLocal.sqf index 962ffa4c0a..7ebd4b8eba 100644 --- a/addons/rearm/functions/fnc_rearmEntireVehicleSuccessLocal.sqf +++ b/addons/rearm/functions/fnc_rearmEntireVehicleSuccessLocal.sqf @@ -4,6 +4,7 @@ * * Arguments: * 0: Vehicle + * 1: TurretPath * * Return Value: * None @@ -16,14 +17,9 @@ #include "script_component.hpp" private ["_magazines", "_magazine", "_currentMagazines", "_maxMagazines", "_maxRounds", "_currentRounds"]; -params ["_vehicle", "_turretPath"]; +params [["_vehicle", objNull, [objNull]], ["_turretPath", [], [[]]]]; -_magazines = []; -if (_turretPath isEqualTo [-1]) then { - _magazines = [_vehicle, _turretPath] call FUNC(getConfigMagazines); -} else { - _magazines = _vehicle magazinesTurret _turretPath; -}; +_magazines = [_vehicle, _turretPath] call FUNC(getConfigMagazines); { _magazine = _x; _currentMagazines = { _x == _magazine } count (_vehicle magazinesTurret _turretPath); diff --git a/addons/rearm/functions/fnc_rearmSuccess.sqf b/addons/rearm/functions/fnc_rearmSuccess.sqf index 7c9b151a39..81cda9f262 100644 --- a/addons/rearm/functions/fnc_rearmSuccess.sqf +++ b/addons/rearm/functions/fnc_rearmSuccess.sqf @@ -22,7 +22,7 @@ #include "script_component.hpp" private ["_dummy", "_weaponSelect", "_turretOwnerID"]; -params ["_args"]; +params [["_args", [objNull, objNull, [], 0, "", 0], [[]], [6]]]; _args params ["_target", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"]; //hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5", _target, _turretPath, _numMagazines, _magazineClass, _numRounds]; diff --git a/addons/rearm/functions/fnc_rearmSuccessLocal.sqf b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf index f869690808..1789767cfd 100644 --- a/addons/rearm/functions/fnc_rearmSuccessLocal.sqf +++ b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf @@ -21,8 +21,8 @@ */ #include "script_component.hpp" -private ["_rounds", "_currentRounds", "_maxMagazines", "_dummy", "_weaponSelect"]; -params ["_args"]; +private ["_rounds", "_currentRounds", "_maxMagazines", "_currentMagazines", "_dummy", "_weaponSelect"]; +params [["_args", [objNull, objNull, [], 0, "", 0], [[]], [6]]]; _args params ["_target", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"]; //hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5\nUnit: %6", _target, _turretPath, _numMagazines, _magazineClass, _numRounds, _unit]; @@ -32,6 +32,11 @@ _currentRounds = 0; _maxMagazines = [_target, _turretPath, _magazineClass] call FUNC(getMaxMagazines); if (_maxMagazines == 1) then { + _currentMagazines = { _x == _magazineClass } count (_target magazinesTurret _turretPath); + if (_currentMagazines == 0 && {!(_turretPath isEqualTo [-1])}) then { + // Driver gun will always retain it's magazines + _target addMagazineTurret [_magazineClass, _turretPath]; + }; if (GVAR(level) == 1) then { // Fill magazine completely _target setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath]; @@ -46,9 +51,12 @@ if (_maxMagazines == 1) then { getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent); }; } else { - for "_idx" from 1 to _maxMagazines do { + for "_idx" from 1 to (_maxMagazines+1) do { _currentRounds = _target magazineTurretAmmo [_magazineClass, _turretPath]; - if (_currentRounds > 0) exitWith { + if (_currentRounds > 0 || {_idx == (_maxMagazines+1)}) exitWith { + if (_idx == (_maxMagazines+1) && {!(_turretPath isEqualTo [-1])}) then { + _target addMagazineTurret [_magazineClass, _turretPath]; + }; if (GVAR(level) == 2) then { //hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMaxMagazines %4\nMagazine: %5\nNumRounds: %6\nMagazine: %7", _target, _turretPath, _numMagazines, _maxMagazines, _currentRounds, _numRounds, _magazineClass]; // Fill only at most _numRounds diff --git a/addons/rearm/functions/fnc_storeAmmo.sqf b/addons/rearm/functions/fnc_storeAmmo.sqf index e23efe0d7c..262affb1ef 100644 --- a/addons/rearm/functions/fnc_storeAmmo.sqf +++ b/addons/rearm/functions/fnc_storeAmmo.sqf @@ -17,12 +17,11 @@ #include "script_component.hpp" private "_dummy"; -params ["_target", "_unit"]; +params [["_target", objNull, [objNull]], ["_unit", objNull, [objNull]]]; _dummy = _unit getVariable [QGVAR(dummy), objNull]; if (isNull _dummy) exitwith {}; - [ 5, _unit, diff --git a/addons/rearm/functions/fnc_takeAmmo.sqf b/addons/rearm/functions/fnc_takeAmmo.sqf index 4f3ef7c9ef..d2de1e1b59 100644 --- a/addons/rearm/functions/fnc_takeAmmo.sqf +++ b/addons/rearm/functions/fnc_takeAmmo.sqf @@ -21,7 +21,7 @@ private ["_ammo", "_tmpCal", "_cal", "_idx"]; -params ["_target", "_unit", "_args"]; +params [["_target", objNull, [objNull]], ["_unit", objNull, [objNull]], ["_args", ["", objNull], [[]]]]; _args params ["_magazineClass", "_vehicle"]; _ammo = getText (configFile >> "CfgMagazines" >> _magazineClass >> "ammo"); diff --git a/addons/rearm/functions/fnc_takeSuccess.sqf b/addons/rearm/functions/fnc_takeSuccess.sqf index 952cfdee08..6d5966c9f9 100644 --- a/addons/rearm/functions/fnc_takeSuccess.sqf +++ b/addons/rearm/functions/fnc_takeSuccess.sqf @@ -19,10 +19,10 @@ #include "script_component.hpp" private ["_ammo", "_dummyName", "_dummy", "_actionID"]; -params ["_args"]; +params [["_args", [objNull, "", objNull], [[]]]]; _args params ["_unit", "_magazineClass", "_target"]; // _target is for future possible finite ammo -[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set); _dummy = [_unit, _magazineClass] call FUNC(createDummy); [_dummy, _unit] call FUNC(pickUpAmmo); diff --git a/addons/rearm/script_component.hpp b/addons/rearm/script_component.hpp index e90e87a422..5d69987a56 100644 --- a/addons/rearm/script_component.hpp +++ b/addons/rearm/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT rearm #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_REARM #define DEBUG_MODE_FULL #endif @@ -28,4 +33,4 @@ #define REARM_UNHOLSTER_WEAPON \ _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRearm); \ _unit selectWeapon _weaponSelect; \ - _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; + _unit setVariable [QGVAR(selectedWeaponOnRearm), nil]; diff --git a/addons/rearm/stringtable.xml b/addons/rearm/stringtable.xml index bbc7c36302..b00f540ac3 100644 --- a/addons/rearm/stringtable.xml +++ b/addons/rearm/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -7,6 +7,8 @@ Ustawienia przezbrajania Настройки перевооружения Ajustes de rearme + Nastavení přezbrojení + Impostazioni Riarmo This module allows you to tweak rearm system settings. @@ -14,6 +16,8 @@ Ten moduł pozwala dostosować ustawienia przezbrajania. Этот модуль позволяет изменить настройки системы перевооружения. Este módulo permite que você ajuste o sistema de rearme. + Tento modul umožňuje upravovat systém přezbrojení. + Questo modulo ti consente di cambiare le impostazioni del sistema Riarmo. Rearm Amount @@ -21,6 +25,8 @@ Szybkość przezbrajania Количество вооружения Quantidade de rearme + Rychlost přezbrojení + Ammontare Riarmo How fast should a vehicle be rearmed? @@ -28,6 +34,8 @@ Jak szybko pojazd zostanie przezbrojony? Как быстро техника должна перевооружаться? Quão rápido o veículo deve ser rearmado? + Jak rychle bude vozidlo přezbrojeno? + Quanto velocemente dovrebbe essere riarmato un veicolo? Entire Vehicle @@ -35,6 +43,8 @@ Cały pojazd Полностью техника Todo o veículo + Celé vozidlo + Tutto il Veicolo Entire Magazine @@ -42,6 +52,8 @@ Cały magazynek Полный магазин Todo o carregador + Celý zásobník + Tutto il Caricatore Amount based on caliber @@ -49,6 +61,8 @@ Ilość zależna od kalibru Количество зависит от калибра Quantidade baseada no calibre + Rychlost závisí na ráži + Ammontare basato sul calibro Rearm @@ -56,27 +70,35 @@ Przezbrój Перевооружить Rearmar + Přezbrojit + Riarma - Rearming %1 with %2 ... - Munitioniere %1 auf mit %2 ... - Przezbrajanie %1 przy pomocy %2 ... - Перевооружается %1 снарядами %2 ... - Rearmando %1 com %2 ... + Rearming %1 with %2... + Munitioniere %1 auf mit %2... + Przezbrajanie %1 przy pomocy %2... + Перевооружается %1 снарядами %2... + Rearmando %1 com %2... + Přezbrojuji %1 za pomoci %2... + Sto Riarmando %1 con %2... - Rearming %1 ... - Munitioniere %1 auf ... - Przezbrajanie %1 ... - Перевооружается %1 ... - Rearmando %1 ... + Rearming %1... + Munitioniere %1 auf... + Przezbrajanie %1... + Перевооружается %1... + Rearmando %1... + Přezbrojuji %1... + Riarmando %1... - Taking %1 for %2 ... - Nehme %1 für %2 ... - Pobieranie %1 dla %2 ... - Забираем %1 для %2 ... - Pegando %1 para %2 ... + Taking %1 for %2... + Nehme %1 für %2... + Pobieranie %1 dla %2... + Забираем %1 для %2... + Pegando %1 para %2... + Beru %1 pro %2... + Sto prendendo %1 per %2... Take ammo @@ -84,6 +106,8 @@ Pobierz amunicję Взять боекомплект Tomar munição + Vít munici + Prendi munizioni Pick up ammo @@ -91,6 +115,8 @@ Podnieś amunicję Поднять боекомплект Pegar munição + Sebrat munici + Raccogli munizioni Store ammo @@ -98,20 +124,25 @@ Przechowaj amunicję Сохранить боекомплект Guardar munição + Uskladnit munici + Riponi munizioni - Storing %1 in %2 ... - Verstaue %1 in %2 ... - Przechowywanie %1 w %2 ... - Сохраняется %1 в %2 ... - Guardando %1 em %2 ... + Storing %1 in %2... + Verstaue %1 in %2... + Przechowywanie %1 w %2... + Сохраняется %1 в %2... + Guardando %1 em %2... + Ukládám %1 v %2... + Sto riponendo %1 in %2... - Picking up ammo ... - Nehme Munition ... - Podnoszenie amunicji ... - Поднятие боекомплекта ... - Pegando munição ... + Picking up ammo... + Nehme Munition... + Podnoszenie amunicji... + Поднятие боекомплекта... + Pegando munição... + Sto raccogliendo le munizioni... Rearmed %1 rounds of %2 on %3 @@ -119,6 +150,8 @@ Przezbrojono %1 pocisków %2 na %3 Перевооружено %1 снарядов %2 на %3 Rearmando %1 cartuchos de %2 em %3 + Přezbrojeno % nábojů z %2 u %3 + Riarmati %1 colpi di %2 su %3 Smoke Screen @@ -148,6 +181,8 @@ 30mm HEI 30мм ОФЗ 30mm HEI + 30mm HEI + 30mm HEI 30mm HEI-T @@ -155,6 +190,8 @@ 30mm HEI-T 30мм ОФЗТ 30mm HEI-T + 30mm HEI-T + 30mm HEI-T AIM-9 Sidewinder @@ -162,6 +199,8 @@ AIM-9 Sidewinder AIM-9 Sidewinder AIM-9 Sidewinder + AIM-9 Sidewinder + AIM-9 Sidewinder Wympel R-73 @@ -169,6 +208,8 @@ Wympel R-73 Р-73 (Вымпел) Wympel R-73 + Wympel R-73 + Wympel R-73 AGM-65 Maverick @@ -176,6 +217,8 @@ AGM-65 Maverick AGM-65 Maverick AGM-65 Maverick + AGM-65 Maverick + AGM-65 Maverick Kh-25MTP @@ -183,6 +226,8 @@ Ch-25MTP Х-25МТП Ch-25MTP + Kh-25MTP + Kh-25MTP Hydra 70 HE @@ -190,6 +235,8 @@ Hydra 70 HE Hydra 70 HE Hydra 70 HE + Hydra 70 HE + Hydra 70 HE S-8 HE @@ -197,6 +244,8 @@ S-8 HE С-8 ОФ S-8 HE + S-8 HE + S-8 HE Hydra 70 AP @@ -204,6 +253,8 @@ Hydra 70 AP Hydra 70 AP Hydra 70 AP + Hydra 70 AP + Hydra 70 AP S-8 AP @@ -211,6 +262,8 @@ S-8 AP С-8КОМ S-8 AP + S-8 AP + S-8 AP GBU-12 @@ -218,6 +271,8 @@ GBU-12 GBU-12 GBU-12 + GBU-12 + GBU-12 FAB-250M-54 @@ -225,6 +280,8 @@ FAB-250M-54 ФАБ-250М-54 FAB-250M-54 + FAB-250M-54 + FAB-250M-54 - + \ No newline at end of file diff --git a/addons/recoil/CfgEventHandlers.hpp b/addons/recoil/CfgEventHandlers.hpp index 60fc3892fc..c0726f161a 100644 --- a/addons/recoil/CfgEventHandlers.hpp +++ b/addons/recoil/CfgEventHandlers.hpp @@ -1,14 +1,18 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(camshake)};); - }; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; diff --git a/addons/recoil/XEH_PREP.hpp b/addons/recoil/XEH_PREP.hpp new file mode 100644 index 0000000000..9e34c47492 --- /dev/null +++ b/addons/recoil/XEH_PREP.hpp @@ -0,0 +1,2 @@ + +PREP(camshake); diff --git a/addons/recoil/XEH_postInit.sqf b/addons/recoil/XEH_postInit.sqf new file mode 100644 index 0000000000..e6b694646f --- /dev/null +++ b/addons/recoil/XEH_postInit.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +// Register fire event handler +["firedPlayer", DFUNC(camShake)] call EFUNC(common,addEventHandler); diff --git a/addons/recoil/XEH_preInit.sqf b/addons/recoil/XEH_preInit.sqf index f6d04886c1..c503c2edbc 100644 --- a/addons/recoil/XEH_preInit.sqf +++ b/addons/recoil/XEH_preInit.sqf @@ -3,6 +3,6 @@ ADDON = false; -PREP(camshake); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/recoil/XEH_preStart.sqf b/addons/recoil/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/recoil/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/recoil/functions/fnc_camshake.sqf b/addons/recoil/functions/fnc_camshake.sqf index 806d48760b..deb454df71 100644 --- a/addons/recoil/functions/fnc_camshake.sqf +++ b/addons/recoil/functions/fnc_camshake.sqf @@ -1,67 +1,74 @@ -// TMR: Small Arms - Recoil initialization and functions -// (C) 2013 Ryan Schultz. See LICENSE. -// Edited prefixes for compatability in AGM_Realism by KoffeinFlummi -// Edited by commy2 +/* + * Author: Orginal by Ryan Schultz, edited by KoffeinFlummi, commy2 + * Adds camera shake when firing. Called from the unified fired EH only for the local player. + * From TMR: Small Arms + * + * Arguments: + * None. Parameters inherited from EFUNC(common,firedEH) + * + * Return Value: + * Nothing + * + * Example: + * [player, (currentWeapon player), (currentMuzzle player)] call ace_recoil_fnc_camShake; + * + * Public: No + */ #include "script_component.hpp" +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); + #define BASE_POWER 0.40 #define BASE_TIME 0.19 #define BASE_FREQ 13 #define RECOIL_COEF 40 -private ["_unit", "_weapon", "_muzzle"]; - -_unit = _this select 0; -_weapon = _this select 1; -_muzzle = _this select 2; - if (toLower _weapon in ["throw", "put"]) exitWith {}; -private ["_powerMod", "_timeMod", "_freqMod"]; - -_powerMod = ([0, -0.1, -0.1, 0, -0.2] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _unit)) + ([0, -1, 0, -1] select (["INTERNAL", "EXTERNAL", "GUNNER", "GROUP"] find cameraView)); -_timeMod = 0; -_freqMod = 0; +private _powerMod = ([0, -0.1, -0.1, 0, -0.2] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _unit)) + ([0, -1, 0, -1] select (["INTERNAL", "EXTERNAL", "GUNNER", "GROUP"] find cameraView)); // to get camshake read kickback -private ["_config", "_recoil"]; +private _recoil = missionNamespace getVariable format [QGVAR(%1-%2), _weapon, _muzzle]; -_config = configFile >> "CfgWeapons" >> _weapon; -_recoil = if (_muzzle == _weapon) then { - getText (_config >> "recoil") -} else { - getText (_config >> _muzzle >> "recoil") -}; +if (isNil "_recoil") then { + private _config = configFile >> "CfgWeapons" >> _weapon; -if (isClass (configFile >> "CfgRecoils" >> _recoil)) then { - _recoil = getArray (configFile >> "CfgRecoils" >> _recoil >> "kickBack"); - if (count _recoil < 2) then { + if (_muzzle == _weapon) then { + _recoil = getText (_config >> "recoil") + } else { + _recoil = getText (_config >> _muzzle >> "recoil") + }; + + if (isClass (configFile >> "CfgRecoils" >> _recoil)) then { + _recoil = getArray (configFile >> "CfgRecoils" >> _recoil >> "kickBack"); + if (count _recoil < 2) then { + _recoil = [0, 0]; + }; + } else { _recoil = [0, 0]; }; -} else { - _recoil = [0, 0]; + + TRACE_3("Caching Recoil config",_weapon,_muzzle,_recoil); + + // parse numbers + _recoil set [0, call compile format ["%1", _recoil select 0]]; + _recoil set [1, call compile format ["%1", _recoil select 1]]; + + missionNamespace setVariable [format [QGVAR(%1-%2), _weapon, _muzzle], _recoil]; }; -// parse numbers -_recoil set [0, call compile format ["%1", _recoil select 0]]; -_recoil set [1, call compile format ["%1", _recoil select 1]]; - -private "_powerCoef"; -_powerCoef = RECOIL_COEF * linearConversion [0, 1, random 1, _recoil select 0, _recoil select 1, false]; +private _powerCoef = RECOIL_COEF * linearConversion [0, 1, random 1, _recoil select 0, _recoil select 1, false]; if (isWeaponRested _unit) then {_powerMod = _powerMod - 0.07}; if (isWeaponDeployed _unit) then {_powerMod = _powerMod - 0.11}; -private "_camshake"; -_camshake = [ +private _camshake = [ _powerCoef * (BASE_POWER + _powerMod) max 0, - BASE_TIME + _timeMod max 0, - BASE_FREQ + _freqMod max 0 + BASE_TIME, + BASE_FREQ ]; -/* - systemChat str _camshake; - copyToClipboard format ["addCamShake %1;", _camshake]; -*/ +TRACE_4("addCamShake",_recoil,_powerCoef,_powerMod,_camshake);\ addCamShake _camshake; diff --git a/addons/recoil/script_component.hpp b/addons/recoil/script_component.hpp index b5a74ec8dd..aa80910be1 100644 --- a/addons/recoil/script_component.hpp +++ b/addons/recoil/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT recoil #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RECOIL #define DEBUG_MODE_FULL #endif diff --git a/addons/refuel/CfgEventHandlers.hpp b/addons/refuel/CfgEventHandlers.hpp index f1a9f1a3c8..c6f26efe1a 100644 --- a/addons/refuel/CfgEventHandlers.hpp +++ b/addons/refuel/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index ff91205434..5b6d9f483b 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -113,7 +113,7 @@ class CfgVehicles { class ACE_Module; - class ACE_moduleRefuelSettings : ACE_Module { + class ACE_moduleRefuelSettings: ACE_Module { scope = 2; displayName = CSTRING(RefuelSettings_Module_DisplayName); icon = QUOTE(PATHTOF(ui\icon_module_refuel.paa)); @@ -134,30 +134,30 @@ class CfgVehicles { }; class ThingX; - class ACE_refuel_fuelNozzle : ThingX { + class ACE_refuel_fuelNozzle: ThingX { XEH_ENABLED; MACRO_NOZZLE_ACTIONS displayName = QGVAR(fuelNozzle); scope = 1; scopeCurator = 1; - model = "\A3\Structures_F_Heli\VR\Helpers\Sign_sphere10cm_F.p3d"; + model = PATHTOF(data\nozzle.p3d); }; class All; - class Static : All {}; + class Static: All {}; - class Building : Static {}; + class Building: Static {}; - class NonStrategic : Building {}; + class NonStrategic: Building {}; class HouseBase: NonStrategic {}; class House: HouseBase {}; - class House_F : House {}; + class House_F: House {}; - class House_Small_F : House_F { + class House_Small_F: House_F { class ACE_Actions { class ACE_MainActions { displayName = ECSTRING(interaction,MainAction); @@ -168,80 +168,80 @@ class CfgVehicles { }; }; - class AllVehicles : All { + class AllVehicles: All { GVAR(flowRate) = 1; }; - class Land : AllVehicles {}; - class LandVehicle : Land {}; - class Car : LandVehicle { + class Land: AllVehicles {}; + class LandVehicle: Land {}; + class Car: LandVehicle { MACRO_CONNECT_ACTIONS }; - class Tank : LandVehicle { + class Tank: LandVehicle { MACRO_CONNECT_ACTIONS GVAR(flowRate) = 4; }; - class StaticWeapon : LandVehicle { + class StaticWeapon: LandVehicle { MACRO_CONNECT_ACTIONS }; - class Air : AllVehicles { + class Air: AllVehicles { GVAR(flowRate) = 8; }; - class Helicopter : Air { + class Helicopter: Air { MACRO_CONNECT_ACTIONS GVAR(fuelCapacity) = 1500; }; - class Helicopter_Base_F : Helicopter {}; + class Helicopter_Base_F: Helicopter {}; - class Helicopter_Base_H : Helicopter_Base_F { + class Helicopter_Base_H: Helicopter_Base_F { GVAR(fuelCapacity) = 3000; }; - class Plane : Air { + class Plane: Air { MACRO_CONNECT_ACTIONS GVAR(fuelCapacity) = 2000; GVAR(flowRate) = 16; }; - class Plane_Base_F : Plane {}; + class Plane_Base_F: Plane {}; - class Ship : AllVehicles {}; + class Ship: AllVehicles {}; - class Ship_F : Ship { + class Ship_F: Ship { MACRO_CONNECT_ACTIONS GVAR(fuelCapacity) = 2000; GVAR(flowRate) = 4; }; - class Boat_Civil_01_base_F : Ship_F { + class Boat_Civil_01_base_F: Ship_F { GVAR(fuelCapacity) = 200; }; - class Boat_F : Ship_F { + class Boat_F: Ship_F { GVAR(flowRate) = 1; }; - class Boat_Armed_01_base_F : Boat_F { + class Boat_Armed_01_base_F: Boat_F { GVAR(fuelCapacity) = 300; }; - class Rubber_duck_base_F : Boat_F { + class Rubber_duck_base_F: Boat_F { GVAR(fuelCapacity) = 30; }; - class SDV_01_base_F : Boat_F { + class SDV_01_base_F: Boat_F { // SDV is using electrical propulsion GVAR(fuelCapacity) = 0; }; - class Car_F : Car { + class Car_F: Car { // Assuming large vehicle tank GVAR(fuelCapacity) = 60; }; - class Kart_01_Base_F : Car_F { + class Kart_01_Base_F: Car_F { GVAR(fuelCapacity) = 8; }; @@ -257,7 +257,7 @@ class CfgVehicles { GVAR(fuelCapacity) = 50; }; - class Quadbike_01_base_F : Car_F { + class Quadbike_01_base_F: Car_F { // Assuming usual Yamaha quad GVAR(fuelCapacity) = 10; }; @@ -284,7 +284,7 @@ class CfgVehicles { GVAR(fuelCapacity) = 269; }; - class Truck_F : Car_F { + class Truck_F: Car_F { GVAR(fuelCapacity) = 400; GVAR(flowRate) = 2; }; @@ -294,7 +294,7 @@ class CfgVehicles { GVAR(fuelCapacity) = 583; }; - class B_Truck_01_transport_F : Truck_01_base_F {}; + class B_Truck_01_transport_F: Truck_01_base_F {}; class B_Truck_01_mover_F: B_Truck_01_transport_F {}; @@ -310,7 +310,7 @@ class CfgVehicles { GVAR(fuelCapacity) = 600; }; - class Van_01_base_F : Truck_F { + class Van_01_base_F: Truck_F { // Small Truck // Assuming 80L as in Ford Transit GVAR(fuelCapacity) = 80; @@ -319,7 +319,7 @@ class CfgVehicles { class Van_01_fuel_base_F: Van_01_base_F { transportFuel = 0; //1k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0.38,-3.17,-.7},{-0.41,-3.17,-.7}}; + GVAR(hooks)[] = {{0.38,-3.17,-.7},{-0.41,-3.17,-.7}}; GVAR(fuelCargo) = 2000; }; @@ -338,11 +338,11 @@ class CfgVehicles { class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{-1.08,-4.81,-.8}}; + GVAR(hooks)[] = {{-1.08,-4.81,-.8}}; GVAR(fuelCargo) = 1000; }; - class APC_Tracked_02_base_F : Tank_F { + class APC_Tracked_02_base_F: Tank_F { // BM-2T // Assuming 1 L/km GVAR(fuelCapacity) = 1000; @@ -370,111 +370,111 @@ class CfgVehicles { GVAR(fuelCapacity) = 1160; }; - class MBT_01_arty_base_F : MBT_01_base_F { + class MBT_01_arty_base_F: MBT_01_base_F { // Assuming similar 2S3 GVAR(fuelCapacity) = 830; }; - class MBT_02_arty_base_F : MBT_02_base_F { + class MBT_02_arty_base_F: MBT_02_base_F { // Assuming similar 2S3 GVAR(fuelCapacity) = 830; }; - class Heli_Attack_01_base_F : Helicopter_Base_F { + class Heli_Attack_01_base_F: Helicopter_Base_F { // Commanche }; - class Heli_Attack_02_base_F : Helicopter_Base_F { + class Heli_Attack_02_base_F: Helicopter_Base_F { // Mi-48 Kajman }; - class Heli_Light_01_base_F : Helicopter_Base_H { + class Heli_Light_01_base_F: Helicopter_Base_H { // MH-6 GVAR(fuelCapacity) = 242; }; - class Heli_Light_02_base_F : Helicopter_Base_H { + class Heli_Light_02_base_F: Helicopter_Base_H { // Ka-60 Kasatka GVAR(fuelCapacity) = 1450; }; - class Heli_light_03_base_F : Helicopter_Base_F { + class Heli_light_03_base_F: Helicopter_Base_F { // AW159 GVAR(fuelCapacity) = 1004; }; - class Heli_Transport_01_base_F : Helicopter_Base_H { + class Heli_Transport_01_base_F: Helicopter_Base_H { // Ghost Hawk // Assuming similar UH60 GVAR(fuelCapacity) = 1360; }; - class Heli_Transport_02_base_F : Helicopter_Base_H { + class Heli_Transport_02_base_F: Helicopter_Base_H { // AW101 GVAR(fuelCapacity) = 3222; }; - class Heli_Transport_03_base_F : Helicopter_Base_H { + class Heli_Transport_03_base_F: Helicopter_Base_H { // Chinook 47I GVAR(fuelCapacity) = 3914; }; - class Heli_Transport_04_base_F : Helicopter_Base_H { + class Heli_Transport_04_base_F: Helicopter_Base_H { // Mi-290 Taru GVAR(fuelCapacity) = 3914; }; - class Plane_CAS_01_base_F : Plane_Base_F { + class Plane_CAS_01_base_F: Plane_Base_F { // Assuming similar to A10 GVAR(fuelCapacity) = 6223; }; - class Plane_CAS_02_base_F : Plane_Base_F { + class Plane_CAS_02_base_F: Plane_Base_F { // Yak-130 GVAR(fuelCapacity) = 2099; }; - class UAV_01_base_F : Helicopter_Base_F { + class UAV_01_base_F: Helicopter_Base_F { // Darter is electrical GVAR(fuelCapacity) = 0; }; - class UAV : Plane {}; + class UAV: Plane {}; - class UAV_02_base_F : UAV { + class UAV_02_base_F: UAV { // Assuming similar YAHBON-R2 GVAR(fuelCapacity) = 270; }; - class UGV_01_base_F : Car_F { + class UGV_01_base_F: Car_F { // Stomper GVAR(fuelCapacity) = 100; }; - class Plane_Fighter_03_base_F : Plane_Base_F { + class Plane_Fighter_03_base_F: Plane_Base_F { // L-159 ALCA GVAR(fuelCapacity) = 1914; }; // Vanilla fuel vehicles - class Truck_02_fuel_base_F : Truck_02_base_F { + class Truck_02_fuel_base_F: Truck_02_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0.99,-3.47,-0.67},{-1.04,-3.47,-0.67}}; + GVAR(hooks)[] = {{0.99,-3.47,-0.67},{-1.04,-3.47,-0.67}}; GVAR(fuelCargo) = 10000; }; - class B_Truck_01_fuel_F : B_Truck_01_mover_F { + class B_Truck_01_fuel_F: B_Truck_01_mover_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{.28,-4.99,-.3},{-.25,-4.99,-.3}}; + GVAR(hooks)[] = {{.28,-4.99,-.3},{-.25,-4.99,-.3}}; GVAR(fuelCargo) = 10000; }; - class O_Truck_03_fuel_F : Truck_03_base_F { + class O_Truck_03_fuel_F: Truck_03_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{1.3,-1.59,-.62},{-1.16,-1.59,-.62}}; + GVAR(hooks)[] = {{1.3,-1.59,-.62},{-1.16,-1.59,-.62}}; GVAR(fuelCargo) = 10000; }; @@ -490,18 +490,18 @@ class CfgVehicles { }; }; - class B_Slingload_01_Fuel_F : Slingload_01_Base_F { + class B_Slingload_01_Fuel_F: Slingload_01_Base_F { XEH_ENABLED; transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0.55,3.02,-0.5},{-0.52,3.02,-0.5}}; + GVAR(hooks)[] = {{0.55,3.02,-0.5},{-0.52,3.02,-0.5}}; GVAR(fuelCargo) = 10000; }; - class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F { + class O_Heli_Transport_04_fuel_F: Heli_Transport_04_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{-1.52,1.14,-1.18}}; + GVAR(hooks)[] = {{-1.52,1.14,-1.18}}; GVAR(fuelCargo) = 10000; }; @@ -509,39 +509,57 @@ class CfgVehicles { class Land_Pod_Heli_Transport_04_fuel_F: Pod_Heli_Transport_04_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{-1.49,1.41,-.3}}; + GVAR(hooks)[] = {{-1.49,1.41,-.3}}; GVAR(fuelCargo) = 10000; }; + class StorageBladder_base_F: NonStrategic { + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + position = "[-3.35,2.45,0.17]"; + distance = 4; + condition = "true"; + }; + }; + }; + class Land_StorageBladder_01_F: StorageBladder_base_F { + XEH_ENABLED; + MACRO_REFUEL_ACTIONS + transportFuel = 0; //60k + GVAR(hooks)[] = {{-3.35,2.45,0.17}}; + GVAR(fuelCargo) = 60000; + }; + // Vanilla buildings - class Land_Fuelstation_Feed_F : House_Small_F { + class Land_Fuelstation_Feed_F: House_Small_F { XEH_ENABLED; transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,-0.5}}; + GVAR(hooks)[] = {{0,0,-0.5}}; GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; - class Land_fs_feed_F : House_Small_F { + class Land_fs_feed_F: House_Small_F { XEH_ENABLED; transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{-0.4,0.022,-.23}}; + GVAR(hooks)[] = {{-0.4,0.022,-.23}}; GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; /* // Barrels found in config \ - BarrelHelper : Misc_thing 100 - BarrelBase : BarrelHelper 100 - Barrels : BarrelBase 400 - Barrel1 : BarrelBase 100 - Barrel2 : BarrelBase 100 - Barrel3 : BarrelBase 100 - Barrel4 : BarrelBase 100 - Barrel5 : BarrelBase 100 - Barrel6 : BarrelBase 100 - Wooden_barrel : BarrelBase 100 - Wooden_barrels : Wooden_barrel 400 + BarrelHelper: Misc_thing 100 + BarrelBase: BarrelHelper 100 + Barrels: BarrelBase 400 + Barrel1: BarrelBase 100 + Barrel2: BarrelBase 100 + Barrel3: BarrelBase 100 + Barrel4: BarrelBase 100 + Barrel5: BarrelBase 100 + Barrel6: BarrelBase 100 + Wooden_barrel: BarrelBase 100 + Wooden_barrels: Wooden_barrel 400 */ // Trucks diff --git a/addons/refuel/XEH_PREP.hpp b/addons/refuel/XEH_PREP.hpp new file mode 100644 index 0000000000..dac451da17 --- /dev/null +++ b/addons/refuel/XEH_PREP.hpp @@ -0,0 +1,28 @@ + +PREP(canCheckFuel); +PREP(canConnectNozzle); +PREP(canDisconnect); +PREP(canReturnNozzle); +PREP(canTakeNozzle); +PREP(canTurnOff); +PREP(canTurnOn); +PREP(checkFuel); +PREP(connectNozzle); +PREP(connectNozzleAction); +PREP(disconnect); +PREP(dropNozzle); +PREP(getFuel); +PREP(handleDisconnect); +PREP(handleKilled); +PREP(handleUnconscious); +PREP(makeJerryCan); +PREP(moduleRefuelSettings); +PREP(readFuelCounter); +PREP(refuel); +PREP(reset); +PREP(resetLocal); +PREP(returnNozzle); +PREP(setFuel); +PREP(takeNozzle); +PREP(turnOff); +PREP(turnOn); diff --git a/addons/refuel/XEH_postInit.sqf b/addons/refuel/XEH_postInit.sqf index d823fcf039..16c4232457 100644 --- a/addons/refuel/XEH_postInit.sqf +++ b/addons/refuel/XEH_postInit.sqf @@ -1,3 +1,7 @@ #include "script_component.hpp" ["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventHandler); + +if (isServer) then { + addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}]; +}; diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index 691df0478d..a7feade1c3 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -2,31 +2,6 @@ ADDON = false; -PREP(canCheckFuel); -PREP(canConnectNozzle); -PREP(canDisconnect); -PREP(canReturnNozzle); -PREP(canTakeNozzle); -PREP(canTurnOff); -PREP(canTurnOn); -PREP(checkFuel); -PREP(connectNozzle); -PREP(connectNozzleAction); -PREP(disconnect); -PREP(dropNozzle); -PREP(getFuel); -PREP(handleKilled); -PREP(handleUnconscious); -PREP(makeJerryCan); -PREP(moduleRefuelSettings); -PREP(readFuelCounter); -PREP(refuel); -PREP(reset); -PREP(resetLocal); -PREP(returnNozzle); -PREP(setFuel); -PREP(takeNozzle); -PREP(turnOff); -PREP(turnOn); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/refuel/XEH_preStart.sqf b/addons/refuel/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/refuel/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/refuel/XEH_respawn.sqf b/addons/refuel/XEH_respawn.sqf index 39225f2521..87b8db3514 100644 --- a/addons/refuel/XEH_respawn.sqf +++ b/addons/refuel/XEH_respawn.sqf @@ -6,6 +6,6 @@ _unit = _this select 0; if !(local _unit) exitWith {}; -[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; _unit setVariable [QGVAR(isRefueling), false]; diff --git a/addons/refuel/data/nozzle.p3d b/addons/refuel/data/nozzle.p3d new file mode 100644 index 0000000000..1ce9583028 Binary files /dev/null and b/addons/refuel/data/nozzle.p3d differ diff --git a/addons/refuel/data/nozzle.rvmat b/addons/refuel/data/nozzle.rvmat new file mode 100644 index 0000000000..8386d34613 --- /dev/null +++ b/addons/refuel/data/nozzle.rvmat @@ -0,0 +1,73 @@ +ambient[] = {1,1,1,1}; +diffuse[] = {1,1,1,1}; +forcedDiffuse[] = {0,0,0,0}; +emmisive[] = {0,0,0,1}; +specular[] = {0.16,0.16,0.16,0}; +specularPower = 100; +PixelShaderID = "Super"; +VertexShaderID = "Super"; +class Stage1 { + texture = "z\ace\addons\refuel\data\nozzle_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 = "z\ace\addons\refuel\data\nozzle_as.paa"; + 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\refuel\data\nozzle_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(1,0.7)"; + uvSource = "none"; +}; +class Stage7 { + texture = "a3\data_f\env_co.paa"; + useWorldEnvMap = "true"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; +}; diff --git a/addons/refuel/data/nozzle_as.paa b/addons/refuel/data/nozzle_as.paa new file mode 100644 index 0000000000..8fdf7e90c6 Binary files /dev/null and b/addons/refuel/data/nozzle_as.paa differ diff --git a/addons/refuel/data/nozzle_co.paa b/addons/refuel/data/nozzle_co.paa new file mode 100644 index 0000000000..3593767dc7 Binary files /dev/null and b/addons/refuel/data/nozzle_co.paa differ diff --git a/addons/refuel/data/nozzle_nohq.paa b/addons/refuel/data/nozzle_nohq.paa new file mode 100644 index 0000000000..8192abe3ed Binary files /dev/null and b/addons/refuel/data/nozzle_nohq.paa differ diff --git a/addons/refuel/data/nozzle_smdi.paa b/addons/refuel/data/nozzle_smdi.paa new file mode 100644 index 0000000000..82e8695557 Binary files /dev/null and b/addons/refuel/data/nozzle_smdi.paa differ diff --git a/addons/refuel/functions/fnc_canCheckFuel.sqf b/addons/refuel/functions/fnc_canCheckFuel.sqf index a1584ea333..e0046dea3d 100644 --- a/addons/refuel/functions/fnc_canCheckFuel.sqf +++ b/addons/refuel/functions/fnc_canCheckFuel.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; !(isNull _unit || {!(_unit isKindOf "CAManBase")} || diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf index 812234818e..a8495d3cd2 100644 --- a/addons/refuel/functions/fnc_canConnectNozzle.sqf +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -16,11 +16,11 @@ */ #include "script_component.hpp" -private ["_nozzle"]; -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; !(isNull _nozzle || + {isEngineOn _target} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE} || {!isNull (_target getVariable [QGVAR(nozzle), objNull])}) // TODO verify cant connect multiple fuel lines diff --git a/addons/refuel/functions/fnc_canDisconnect.sqf b/addons/refuel/functions/fnc_canDisconnect.sqf index 50d22702a0..8bb24a8df2 100644 --- a/addons/refuel/functions/fnc_canDisconnect.sqf +++ b/addons/refuel/functions/fnc_canDisconnect.sqf @@ -16,8 +16,7 @@ */ #include "script_component.hpp" -private ["_sink"]; -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (isNull _unit || {isNull _nozzle} || @@ -25,5 +24,5 @@ if (isNull _unit || {!local _unit} || {(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; -_sink = _nozzle getVariable [QGVAR(sink), objNull]; +private _sink = _nozzle getVariable [QGVAR(sink), objNull]; !((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]}) diff --git a/addons/refuel/functions/fnc_canReturnNozzle.sqf b/addons/refuel/functions/fnc_canReturnNozzle.sqf index 139c921d34..4f3abe1d30 100644 --- a/addons/refuel/functions/fnc_canReturnNozzle.sqf +++ b/addons/refuel/functions/fnc_canReturnNozzle.sqf @@ -16,9 +16,8 @@ */ #include "script_component.hpp" -private ["_nozzle"]; -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; -_nozzle = _unit getVariable QGVAR(nozzle); +private _nozzle = _unit getVariable QGVAR(nozzle); (_this call FUNC(canConnectNozzle)) && {_target == (_nozzle getVariable [QGVAR(source), objNull])} diff --git a/addons/refuel/functions/fnc_canTakeNozzle.sqf b/addons/refuel/functions/fnc_canTakeNozzle.sqf index 85f5b815a5..0ed998993b 100644 --- a/addons/refuel/functions/fnc_canTakeNozzle.sqf +++ b/addons/refuel/functions/fnc_canTakeNozzle.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; if (isNull _unit || {!(_unit isKindOf "CAManBase")} || diff --git a/addons/refuel/functions/fnc_canTurnOff.sqf b/addons/refuel/functions/fnc_canTurnOff.sqf index 7d2d3652e0..e44e1fc669 100644 --- a/addons/refuel/functions/fnc_canTurnOff.sqf +++ b/addons/refuel/functions/fnc_canTurnOff.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (isNull _unit || {isNull _nozzle} || diff --git a/addons/refuel/functions/fnc_canTurnOn.sqf b/addons/refuel/functions/fnc_canTurnOn.sqf index 3053e699a2..98173e0fa4 100644 --- a/addons/refuel/functions/fnc_canTurnOn.sqf +++ b/addons/refuel/functions/fnc_canTurnOn.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (isNull _unit || {isNull _nozzle} || diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index b50e9a8171..6ba7a4928e 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -15,17 +15,17 @@ * Public: No */ #include "script_component.hpp" -private ["_fuel"]; -params ["_unit", "_target"]; -_fuel = [_target] call FUNC(getFuel); +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; + +private _fuel = [_target] call FUNC(getFuel); [ 5, [_unit, _target, _fuel], { params ["_args"]; - _args params ["_unit", "_target", "_fuel"]; + _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_fuel", 0, [0]]]; if (_fuel > 0 ) then { ["displayTextStructured", [_unit], [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,targetEvent); } else { diff --git a/addons/refuel/functions/fnc_connectNozzle.sqf b/addons/refuel/functions/fnc_connectNozzle.sqf index f5d8d35759..d6b599b771 100644 --- a/addons/refuel/functions/fnc_connectNozzle.sqf +++ b/addons/refuel/functions/fnc_connectNozzle.sqf @@ -21,10 +21,9 @@ #define PLACE_CANCEL 0 #define PLACE_APPROVE 1 -private ["_nozzle", "_actionID"]; -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if (isNull _nozzle) exitWith {}; GVAR(placeAction) = PLACE_WAITING; @@ -32,19 +31,18 @@ GVAR(placeAction) = PLACE_WAITING; [{[localize LSTRING(Connect_Action), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame); _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; -_actionID = _unit addAction [format ["%1", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}]; +private _actionID = _unit addAction [format ["%1", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}]; [{ - private["_virtualPos", "_virtualPosASL", "_lineInterection"]; params ["_args","_pfID"]; - _args params ["_unit", "_target", "_nozzle", "_actionID"]; + _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_actionID", -1, [0]]]; - _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); + private _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); if (cameraView == "EXTERNAL") then { _virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); }; - _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); - _lineInterection = lineIntersects [eyePos ace_player, _virtualPosASL, ace_player]; + private _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); + private _lineInterection = lineIntersects [eyePos ace_player, _virtualPosASL, ace_player]; //Don't allow placing in a bad position: if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 42190aacc6..b68983dd81 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -18,31 +18,31 @@ * Public: No */ #include "script_component.hpp" -private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_endASL", "_rate", "_maxFuel"]; +private ["_closeInDistance", "_endPosTestOffset"]; -params ["_unit", "_target", "_startingPosition", "_nozzle"]; -_startingOffset = _target worldToModel _startingPosition; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_startingPosition", [0,0,0], [[]], 3], ["_nozzle", objNull, [objNull]]]; +private _startingOffset = _target worldToModel _startingPosition; -_startDistanceFromCenter = vectorMagnitude _startingOffset; -_closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]); +private _startDistanceFromCenter = vectorMagnitude _startingOffset; +private _closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]); -_closeInMax = _startDistanceFromCenter; -_closeInMin = 0; +private _closeInMax = _startDistanceFromCenter; +private _closeInMin = 0; while {(_closeInMax - _closeInMin) > 0.01} do { _closeInDistance = (_closeInMax + _closeInMin) / 2; _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); _endPosTestOffset set [2, (_startingOffset select 2)]; - _endPosTest = _target modelToWorldVisual _endPosTestOffset; + private _endPosTest = _target modelToWorldVisual _endPosTestOffset; - _doesIntersect = false; + private _doesIntersect = false; { if (_doesIntersect) exitWith {}; - _startingPosShifted = _startingPosition vectorAdd _x; + private _startingPosShifted = _startingPosition vectorAdd _x; _startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted}; { _endPosShifted = _endPosTest vectorAdd _x; - _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; + private _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; //Uncomment to see the lazor show, and see how the scanning works: // drawLine3D [_startingPosShifted, _endPosShifted, [1,0,0,1]]; @@ -66,7 +66,7 @@ if (((_startDistanceFromCenter - _closeInDistance) < 0.1) || {!([_target, _unit, }; //Move it out slightly, for visibility sake (better to look a little funny than be embedded//sunk in the hull and be useless) -_closeInDistance = (_closeInDistance - 0.0085); +_closeInDistance = (_closeInDistance - 0.05); _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); _endPosTestOffset set [2, (_startingOffset select 2)]; @@ -75,14 +75,13 @@ _endPosTestOffset set [2, (_startingOffset select 2)]; 2, [_unit, _nozzle, _target, _endPosTestOffset], { - private "_actionID"; params ["_args"]; - _args params ["_unit", "_nozzle", "_target", "_endPosTestOffset"]; - _unit setVariable [QGVAR(nozzle), nil]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_target", objNull, [objNull]], ["_endPosTestOffset", [0,0,0], [[]], 3]]; + _unit setVariable [QGVAR(nozzle), nil, true]; _unit setVariable [QGVAR(isRefueling), false]; - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); REFUEL_UNHOLSTER_WEAPON - _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; _unit setVariable [QGVAR(ReleaseActionID), nil]; @@ -90,6 +89,37 @@ _endPosTestOffset set [2, (_startingOffset select 2)]; detach _nozzle; _nozzle attachTo [_target, _endPosTestOffset]; + _endPosTestOffset params ["_x", "_y"]; + private _bb = boundingBoxReal _target; + _bb params ["_ll", "_rr"]; + _ll set [2, 0]; + _rr set [2, 0]; + _ll params ["_x1", "_y1"]; + _rr params ["_x2", "_y2"]; + private _c1 = _ll vectorCos _endPosTestOffset; + private _c2 = _ll vectorCos [_x1, _y2, 0]; + private _cn = (_ll vectorCrossProduct [0, 0, 1]) vectorCos _endPosTestOffset; + private _dirAndUp = [[1, 0, 0],[0, 0, 1]]; + if (_c1 > _c2 && (_cn > 0)) then { + _dirAndUp = [[1, 0, 0.8],[0, 0, 1]]; + } else { + _c1 = [_x1, _y2, 0] vectorCos _endPosTestOffset; + _c2 = [_x1, _y2, 0] vectorCos _rr; + _cn = ([_x1, _y2, 0] vectorCrossProduct [0, 0, 1]) vectorCos _endPosTestOffset; + if (_c1 > _c2 && (_cn > 0)) then { + _dirAndUp = [[0, -1, 0.8],[0, 0, 1]]; + } else { + _c1 = _rr vectorCos _endPosTestOffset; + _c2 = _rr vectorCos [_x2, _y1, 0]; + _cn = (_rr vectorCrossProduct [0, 0, 1]) vectorCos _endPosTestOffset; + if (_c1 > _c2 && (_cn > 0)) then { + _dirAndUp = [[-1, 0, 0.8],[0, 0, 1]]; + } else { + _dirAndUp = [[0, 1, 0.8],[0, 0, 1]]; + }; + }; + }; + [[_nozzle, _dirAndUp], "{(_this select 0) setVectorDirAndUp (_this select 1)}", 2] call EFUNC(common,execRemoteFnc); _nozzle setVariable [QGVAR(sink), _target, true]; _nozzle setVariable [QGVAR(isConnected), true, true]; _target setVariable [QGVAR(nozzle), _nozzle, true]; diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf index e007ddf05f..41fde6d365 100644 --- a/addons/refuel/functions/fnc_disconnect.sqf +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -16,10 +16,9 @@ */ #include "script_component.hpp" -private ["_sink"]; -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; -_sink = _nozzle getVariable [QGVAR(sink), objNull]; +private _sink = _nozzle getVariable [QGVAR(sink), objNull]; if (isNull _sink) exitWith {}; _sink setVariable [QGVAR(nozzle), objNull, true]; diff --git a/addons/refuel/functions/fnc_dropNozzle.sqf b/addons/refuel/functions/fnc_dropNozzle.sqf index c44c20c059..575d318068 100644 --- a/addons/refuel/functions/fnc_dropNozzle.sqf +++ b/addons/refuel/functions/fnc_dropNozzle.sqf @@ -18,7 +18,7 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle", ["_disconnectOnly", false]]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_disconnectOnly", false, [false]]]; detach _nozzle; _nozzle setVariable [QGVAR(isRefueling), false, true]; diff --git a/addons/refuel/functions/fnc_getFuel.sqf b/addons/refuel/functions/fnc_getFuel.sqf index 9bbb4987be..47c9992788 100644 --- a/addons/refuel/functions/fnc_getFuel.sqf +++ b/addons/refuel/functions/fnc_getFuel.sqf @@ -15,10 +15,9 @@ */ #include "script_component.hpp" -private ["_fuel"]; -params ["_target"]; +params [["_target", objNull, [objNull]]]; -_fuel = _target getVariable QGVAR(currentFuelCargo); +private _fuel = _target getVariable QGVAR(currentFuelCargo); if (isNil "_fuel") then { _fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo)); diff --git a/addons/refuel/functions/fnc_handleDisconnect.sqf b/addons/refuel/functions/fnc_handleDisconnect.sqf new file mode 100644 index 0000000000..edc3393cb4 --- /dev/null +++ b/addons/refuel/functions/fnc_handleDisconnect.sqf @@ -0,0 +1,26 @@ +/* + * Author: GitHawk + * Cleans up refuel + * + * Arguments: + * 0: Player + * + * Return Value: + * None + * + * Example: + * [player] call ace_refuel_fnc_handleDisconnect + * + * Public: No + */ +#include "script_component.hpp" + +params [["_disconnectedPlayer", objNull, [objNull]]]; + +if (isNull _disconnectedPlayer) exitWith {}; + +private _nozzle = _disconnectedPlayer getVariable [QGVAR(nozzle), objNull]; + +if (isNull _nozzle) exitWith {}; + +[_disconnectedPlayer, _nozzle] call FUNC(dropNozzle); diff --git a/addons/refuel/functions/fnc_handleKilled.sqf b/addons/refuel/functions/fnc_handleKilled.sqf index 897337c062..045bf47028 100644 --- a/addons/refuel/functions/fnc_handleKilled.sqf +++ b/addons/refuel/functions/fnc_handleKilled.sqf @@ -15,12 +15,12 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; if (!local _unit) exitWith {}; _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { [_unit, _nozzle] call FUNC(dropNozzle); }; diff --git a/addons/refuel/functions/fnc_handleUnconscious.sqf b/addons/refuel/functions/fnc_handleUnconscious.sqf index 6a6e561230..bfcdcb3776 100644 --- a/addons/refuel/functions/fnc_handleUnconscious.sqf +++ b/addons/refuel/functions/fnc_handleUnconscious.sqf @@ -16,14 +16,12 @@ */ #include "script_component.hpp" -params ["_unit", "_isUnconscious"]; +params [["_unit", objNull, [objNull]], ["_isUnconscious", false, [false]]]; if (!local _unit || {!_isUnconscious}) exitWith {}; -private "_nozzle"; - -[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +[_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { [_unit, _nozzle] call FUNC(dropNozzle); }; diff --git a/addons/refuel/functions/fnc_makeJerryCan.sqf b/addons/refuel/functions/fnc_makeJerryCan.sqf index 96bb058265..23bf5395a4 100644 --- a/addons/refuel/functions/fnc_makeJerryCan.sqf +++ b/addons/refuel/functions/fnc_makeJerryCan.sqf @@ -16,8 +16,7 @@ */ #include "script_component.hpp" -private ["_actions", "_action"]; -params ["_target", ["_fuelAmount", 20]]; +params [["_target", objNull, [objNull]], ["_fuelAmount", 20, [0]]]; if (isNull _target || {_target isKindOf "AllVehicles"} || @@ -28,7 +27,7 @@ _target setVariable [QGVAR(jerryCan), true, true]; _target setVariable [QGVAR(source), _target, true]; // Main Action -_action = [QGVAR(Refuel), +private _action = [QGVAR(Refuel), localize LSTRING(Refuel), QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), {}, diff --git a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf index 6cdc78b9f7..4d8f89425e 100644 --- a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf +++ b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf @@ -15,7 +15,7 @@ #include "script_component.hpp" -params ["_logic", "_units", "_activated"]; +params ["_logic", "", ["_activated", false, [false]]]; if !(_activated) exitWith {}; diff --git a/addons/refuel/functions/fnc_readFuelCounter.sqf b/addons/refuel/functions/fnc_readFuelCounter.sqf index af95c044e3..ac7a84f97a 100644 --- a/addons/refuel/functions/fnc_readFuelCounter.sqf +++ b/addons/refuel/functions/fnc_readFuelCounter.sqf @@ -16,18 +16,17 @@ */ #include "script_component.hpp" -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; [ 2, [_unit, _target], { - private ["_currentFuel", "_fuelCounter"]; params ["_args"]; - _args params ["_unit", "_target"]; + _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; - _currentFuel = [_target] call FUNC(getFuel); - _fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel)); + private _currentFuel = [_target] call FUNC(getFuel); + private _fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel)); [[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured); }, "", diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 74697212b1..ed986f8025 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -6,7 +6,7 @@ * 0: Unit * 1: Target * 2: Nozzle - * 3: Connection Point + * 3: Connection Point * * Return Value: * None @@ -18,16 +18,18 @@ #define PFH_STEPSIZE 0.1 -private ["_rate", "_maxFuel"]; -params ["_unit", "_target", "_nozzle", "_connectToPoint"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_connectToPoint", [0,0,0], [[]], 3]]; -_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE; -_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity)); +private _rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE; +private _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity)); [{ - private ["_source", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; params ["_args", "_pfID"]; - _args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"]; + _args params [["_source", objNull, [objNull]], ["_sink", objNull, [objNull]], ["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_rate", 1, [0]], ["_startFuel", 0, [0]], ["_maxFuel", 0, [0]], ["_connectFromPoint", [0,0,0], [[]], 3], ["_connectToPoint", [0,0,0], [[]], 3]]; + + if !(_nozzle getVariable [QGVAR(isConnected), false]) exitWith { + [_pfID] call CBA_fnc_removePerFrameHandler; + }; if (!alive _source || {!alive _sink}) exitWith { [objNull, _nozzle] call FUNC(dropNozzle); @@ -36,7 +38,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _sink setVariable [QGVAR(nozzle), objNull, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; - _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2); + private _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2); if (_tooFar && {!(_nozzle getVariable [QGVAR(jerryCan), false])}) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); @@ -47,10 +49,10 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f [_pfID] call cba_fnc_removePerFrameHandler; }; - _finished = false; - _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; + private _finished = false; + private _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; if (_fueling) then { - _fuelInSource = [_source] call FUNC(getFuel); + private _fuelInSource = [_source] call FUNC(getFuel); if (_fuelInSource == 0) exitWith { [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); _nozzle setVariable [QGVAR(isRefueling), false, true]; @@ -64,7 +66,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); }; - _fuelInSink = (_unit getVariable [QGVAR(tempFuel), _startFuel]) + ( _rate / _maxFuel); + private _fuelInSink = (_unit getVariable [QGVAR(tempFuel), _startFuel]) + ( _rate / _maxFuel); if (_fuelInSink > 1) then { _fuelInSink = 1; _finished = true; diff --git a/addons/refuel/functions/fnc_reset.sqf b/addons/refuel/functions/fnc_reset.sqf index f235180b0e..dee28e4301 100644 --- a/addons/refuel/functions/fnc_reset.sqf +++ b/addons/refuel/functions/fnc_reset.sqf @@ -15,8 +15,7 @@ */ #include "script_component.hpp" -private ["_nozzle", "_nozzleTarget", "_rope"]; -params ["_target"]; +params [["_target", objNull, [objNull]]]; if (local _target) then { _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; @@ -26,14 +25,14 @@ if (local _target) then { _target setVariable [QGVAR(engineHit), nil, true]; _target setVariable [QGVAR(isConnected), false, true]; -_nozzle = _target getVariable [QGVAR(ownedNozzle), nil]; +private _nozzle = _target getVariable [QGVAR(ownedNozzle), nil]; if !(isNil "_nozzle") then { - _nozzleTarget = _nozzle getVariable [QGVAR(sink), nil]; + private _nozzleTarget = _nozzle getVariable [QGVAR(sink), nil]; if !(isNil "_nozzleTarget") then { _nozzleTarget setVariable [QGVAR(nozzle), nil, true]; }; - _rope = _nozzle getVariable [QGVAR(rope), nil]; + private _rope = _nozzle getVariable [QGVAR(rope), nil]; if !(isNil "_rope") then { ropeDestroy _rope; }; diff --git a/addons/refuel/functions/fnc_resetLocal.sqf b/addons/refuel/functions/fnc_resetLocal.sqf index a8b0c184cc..2e80ab98d7 100644 --- a/addons/refuel/functions/fnc_resetLocal.sqf +++ b/addons/refuel/functions/fnc_resetLocal.sqf @@ -15,23 +15,22 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; - +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (isNull _unit || {isNull _nozzle} || {!(_unit isKindOf "CAManBase")} || {!local _unit}) exitWith {}; -private ["_attachedNozzle", "_actionID"]; -_attachedNozzle = _unit getVariable [QGVAR(nozzle), nil]; + +private _attachedNozzle = _unit getVariable [QGVAR(nozzle), nil]; if (isNil "_attachedNozzle") exitWith {}; if (_nozzle != _attachedNozzle) exitWith {}; -_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; +private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; _unit setVariable [QGVAR(isRefueling), false, true]; _unit setVariable [QGVAR(ReleaseActionID), nil]; - _unit setVariable [QGVAR(nozzle), nil]; + _unit setVariable [QGVAR(nozzle), nil, true]; }; diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index d3fca33021..32cedb5ac7 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -16,11 +16,10 @@ */ #include "script_component.hpp" -private ["_nozzle", "_dummy", "_actionID"]; -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; -_source = _nozzle getVariable QGVAR(source); +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +private _source = _nozzle getVariable QGVAR(source); if (isNull _nozzle || {_source != _target}) exitWith {false}; @@ -28,15 +27,14 @@ if (isNull _nozzle || {_source != _target}) exitWith {false}; 2, [_unit, _nozzle, _target], { - private "_actionID"; params ["_args"]; - _args params ["_unit", "_nozzle", "_target"]; - _unit setVariable [QGVAR(nozzle), nil]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_target", objNull, [objNull]]]; + _unit setVariable [QGVAR(nozzle), nil, true]; detach _nozzle; - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); REFUEL_UNHOLSTER_WEAPON _unit setVariable [QGVAR(isRefueling), false]; - _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; _unit setVariable [QGVAR(ReleaseActionID), nil]; diff --git a/addons/refuel/functions/fnc_setFuel.sqf b/addons/refuel/functions/fnc_setFuel.sqf index a182d463ae..b5276454fa 100644 --- a/addons/refuel/functions/fnc_setFuel.sqf +++ b/addons/refuel/functions/fnc_setFuel.sqf @@ -15,8 +15,8 @@ * Public: No */ #include "script_component.hpp" -private ["_maxFuel"]; -params ["_target", "_fuel"]; + +params [["_target", objNull, [objNull]], ["_fuel", nil, [0]]]; if (isNull _target || {isNil "_fuel"}) exitWith {}; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 3c52748efc..ecff435dcf 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -18,14 +18,13 @@ */ #include "script_component.hpp" -private ["_endPosOffset"], -params ["_unit", "_target", ["_nozzle", objNull]]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; -[_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_refuel", true] call EFUNC(common,statusEffect_set); REFUEL_HOLSTER_WEAPON -_endPosOffset = [0, 0, 0]; +private _endPosOffset = [0, 0, 0]; if (isNull _nozzle) then { // func is called on fuel truck _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true]; if !(local _target) then { @@ -35,7 +34,7 @@ if (isNull _nozzle) then { // func is called on fuel truck }; _target setVariable [QGVAR(isConnected), true, true]; - _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks"); + _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hooks)); if (count _endPosOffset == 2) then { if (_unit distance (_target modelToWorld (_endPosOffset select 0)) < _unit distance (_target modelToWorld (_endPosOffset select 1))) then { _endPosOffset = _endPosOffset select 0; @@ -49,28 +48,27 @@ if (isNull _nozzle) then { // func is called on fuel truck 2, [_unit, _target, _endPosOffset], { - private ["_newNozzle", "_rope", "_actionID"]; params ["_args"]; - _args params ["_unit", "_target", "_endPosOffset"]; + _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_endPosOffset", [0,0,0], [[]], 3]]; - _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit; - _newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model - _unit setVariable [QGVAR(nozzle), _newNozzle]; + private _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit; + _newNozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"]; + _unit setVariable [QGVAR(nozzle), _newNozzle, true]; - _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], REFUEL_HOSE_LENGTH]; + private _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH]; _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; _newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(rope), _rope, true]; _target setVariable [QGVAR(ownedNozzle), _newNozzle, true]; _unit setVariable [QGVAR(isRefueling), true]; - _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; }; _actionID = _unit addAction [ format ["%1", localize ELSTRING(dragging,Drop)], - '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); REFUEL_UNHOLSTER_WEAPON', + '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); REFUEL_UNHOLSTER_WEAPON', nil, 20, false, @@ -90,24 +88,23 @@ if (isNull _nozzle) then { // func is called on fuel truck 2, [_unit, _nozzle], { - private ["_actionID"]; params ["_args"]; - _args params ["_unit", "_nozzle"]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (_nozzle getVariable [QGVAR(jerryCan), false]) then { _nozzle attachTo [_unit, [0,1,0], "pelvis"]; } else { - _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model + _nozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"]; }; - _unit setVariable [QGVAR(nozzle), _nozzle]; + _unit setVariable [QGVAR(nozzle), _nozzle, true]; _unit setVariable [QGVAR(isRefueling), true]; - _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; }; _actionID = _unit addAction [ format ["%1", localize ELSTRING(dragging,Drop)], - '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); REFUEL_UNHOLSTER_WEAPON', + '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); REFUEL_UNHOLSTER_WEAPON', nil, 20, false, @@ -128,18 +125,24 @@ if (isNull _nozzle) then { // func is called on fuel truck }; if !(_nozzle getVariable [QGVAR(jerryCan), false]) then { [{ - private ["_nozzle"]; params ["_args", "_pfID"]; - _args params ["_unit", "_source", "_endPosOffset"]; - - if (_unit distance (_source modelToWorld _endPosOffset) > (REFUEL_HOSE_LENGTH - 2)) exitWith { - _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; + _args params [["_unit", player, [objNull]], ["_source", objNull, [objNull]], ["_endPosOffset", [0, 0, 0], [[]], 3]]; + _args params ["", "", "", ["_nozzle", _unit getVariable [QGVAR(nozzle), objNull], [objNull]]]; + if (isNull _source || {_unit distance (_source modelToWorld _endPosOffset) > (REFUEL_HOSE_LENGTH - 2)} || {!alive _source}) exitWith { if !(isNull _nozzle) then { [_unit, _nozzle] call FUNC(dropNozzle); REFUEL_UNHOLSTER_WEAPON - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); - [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); + [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); + if (isNull _source || {!alive _source}) then { + private _rope = _nozzle getVariable [QGVAR(rope), objNull]; + if !(isNull _rope) then { + ropeDestroy _rope; + }; + deleteVehicle _nozzle; + } else { + [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); + }; }; [_pfID] call cba_fnc_removePerFrameHandler; }; diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index 115c1eabe2..4b82e19486 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -16,14 +16,14 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; [ 2, [_unit, _nozzle], { params ["_args"]; - _args params ["_unit", "_nozzle"]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; _nozzle setVariable [QGVAR(isRefueling), false, true]; [LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured); }, diff --git a/addons/refuel/functions/fnc_turnOn.sqf b/addons/refuel/functions/fnc_turnOn.sqf index 017a8ee021..b18d1b57ca 100644 --- a/addons/refuel/functions/fnc_turnOn.sqf +++ b/addons/refuel/functions/fnc_turnOn.sqf @@ -16,15 +16,14 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; [ 2, [_unit, _nozzle], { - private "_source"; params ["_args"]; - _args params ["_unit", "_nozzle"]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; _nozzle setVariable [QGVAR(isRefueling), true, true]; [LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured); }, diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index e8c7514651..0c24c3915b 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT refuel #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_REFUEL #define DEBUG_MODE_FULL #endif diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index b0fb6ec0c6..b37cda5b28 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -7,6 +7,8 @@ Ustawienia tankowania Настройки дозаправки Ajustes de reabastecimento + Nastavení tankování + Impostazioni Rifornimento Flow Rate @@ -14,6 +16,8 @@ Szybkość przepływu Скорость заправки Velocidade da vazão + Rychlost tankování + Rateo Flusso How fast should a vehicle be refueled? @@ -21,6 +25,8 @@ Jak szybko pojazd powinien zostać zatankowany? Как быстро техника должна быть заправлена? Quão rápido deve ser o veículo reabastecido? + Jak rychle bude vozidlo natankováno? + Quanto velocemente dovrebbe essere rifornito un veicolo? Refuel @@ -28,6 +34,8 @@ Zatankuj Дозаправка Reabastecimento + Natankovat + Rifornisci Take fuel nozzle @@ -35,13 +43,17 @@ Weź nalewak Взять топливный шланг Pegar o bocal de combustível + Vzít výdejní pistoli + Prenti manica benzina - Taking fuel nozzle ... - Nehme Zapfpistole ... - Pobieranie nalewaka ... - Берем топливный шланг ... + Taking fuel nozzle... + Nehme Zapfpistole... + Pobieranie nalewaka... + Берем топливный шланг... Pegando o bocal de combustível... + Beru výdejní pistoli... + Sto prendendo manica benzina... Connect fuel nozzle @@ -49,13 +61,17 @@ Podłącz nalewak Присоединить топливный шланг Conectar o bocal de combustível + Připojit výdejní pistoli + Collega manica benzina - Connecting fuel nozzle ... - Zapfpistole anschließen ... - Podłączanie nalewaka ... - Присоединяем топливный шланг ... + Connecting fuel nozzle... + Zapfpistole anschließen... + Podłączanie nalewaka... + Присоединяем топливный шланг... Conectando o bocal de combustível... + Připojuji výdejní pistoli... + Sto collegando la manica benzina... Disconnect fuel nozzle @@ -63,6 +79,8 @@ Odepnij nalewak Отсоединить топливный шланг Desconectar o bocal de combustível + Odpojit výdejní pistoli + Scollega manica benzina Connect @@ -70,6 +88,8 @@ Podłącz Присоединить Conectar + Připojit + Collega Check remaining fuel @@ -77,13 +97,17 @@ Sprawdź ilość paliwa Проверить остаток топлива Verificar combustível restante + Zkontrolovat zůstatek paliva + Controlla benzina rimanente - Checking remaining fuel ... - Überprüfe verbleibenden Kraftstoff ... - Sprawdzanie ilości paliwa ... - Проверяем остаток топлива ... + Checking remaining fuel... + Überprüfe verbleibenden Kraftstoff... + Sprawdzanie ilości paliwa... + Проверяем остаток топлива... Verificando combustível restante... + Kontroluji zůstatek paliva... + Sto controllando la benzina rimanente... There are %1 liters left. @@ -91,6 +115,8 @@ Zostało %1 litrów. Осталось %1 л. Há %1 litros restantes. + Zbývá ještě %1 litrů. + Sono rimasti %1 litri. There is no fuel left. @@ -98,6 +124,8 @@ W zbiorniku nie ma paliwa. Топлива нет. Não há combustível + Bez paliva. + Non è rimasta più benzina. Cancel @@ -105,6 +133,8 @@ Anuluj Отменить Cancelar + Zrušit + Cancella Failed @@ -112,6 +142,8 @@ Porażka Не удалось Falhou + Neúspěšný + Fallito Stop fueling @@ -119,13 +151,17 @@ Zatrzymaj tankowanie Остановить заправку Parar reabastecimento + Zastavit tankování + Ferma rifornimento - Stopping fueling ... - Stoppe Betankung ... - Zatrzymywanie tankowania ... - Останавливаем заправку ... + Stopping fueling... + Stoppe Betankung... + Zatrzymywanie tankowania... + Останавливаем заправку... Parando reabastecimento... + Zastavuji tankování... + Sto fermando il rifornimento... Start fueling @@ -133,13 +169,17 @@ Rozpocznij tankowanie Начать заправку Começar reabastecimento + Začít tankovat + Inizia rifornimento - Starting fueling ... - Beginne Betankung ... - Rozpoczynanie tankowania ... - Начинаем заправку ... + Starting fueling... + Beginne Betankung... + Rozpoczynanie tankowania... + Начинаем заправку... Começando reabastecimento... + Spouštím tankování... + Sto iniziando il rifornimento... %1 Liters fueled @@ -147,6 +187,8 @@ Zatankowano %1 litrów %1 литров заправлено %1 litros abastecidos + %1 litrů natankováno + %1 litri riforniti The fuel source is empty. @@ -154,6 +196,8 @@ Źródło paliwa jest puste. Источник топлива пустой. A fonte de combustível está vazia. + Zdroj paliva je prázdný. + La fonte di benzina èvuota. Maximum fuel hose length reached. @@ -161,6 +205,8 @@ Osiągnięto maksymalną długość przewodu paliwowego. Достигнута максимальная длина шланга. Distância máxima da mangueira de combustível alcançada. + Dosažena maximální délka hadice + Distanza massima della manica raggiunta. Fueling completed @@ -168,6 +214,8 @@ Tankowanie ukończone Заправка завершена Reabastecimento completo + Tankování dokončeno + Rifornimento completato Fueling stopped @@ -175,6 +223,8 @@ Tankowanie zatrzymane Заправка остановлена Reabastecimento parado + Tankování zastaveno + Rifornimento fermato Fueling started @@ -182,6 +232,8 @@ Tankowanie rozpoczęte Заправка начата Reabastecimento iniciado + Tankování zahájeno + Rifornimento iniziato Return fuel nozzle @@ -189,13 +241,17 @@ Zwróć nalewak Вернуть топливный шланг Retornar bocal de combustível + Vrátit výdejní pistoli + Riponi manica benzina - Returning fuel nozzle ... - Stecke Zapfpistole zurück ... - Zwracanie nalewaka ... - Возвращаем топливный шланг ... + Returning fuel nozzle... + Stecke Zapfpistole zurück... + Zwracanie nalewaka... + Возвращаем топливный шланг... Retornando bocal de combustível... + Vracím výdejní pistoli... + Sto riponendo la manica della benzina... Check fuel counter @@ -203,13 +259,17 @@ Sprawdź wskaźnik paliwa Проверить счетчик топлива Verificar contador de combustível + Zkonrolovat palivoměr + Controlla indicatore livello benzina - Checking fuel counter ... - Betrachte Tankuhr ... - Sprawdzanie wskaźnika paliwa ... - Проверяем счетчик топлива ... + Checking fuel counter... + Betrachte Tankuhr... + Sprawdzanie wskaźnika paliwa... + Проверяем счетчик топлива... Verificando contador de combustível... + Konroluji palivoměr... + Sto controllando l'indicatore del livello benzina... %1 liters have been fueled. @@ -217,6 +277,8 @@ %1 litrów zostało zatankowane. Было заправлено %1 л. %1 litros foram abastecidos. + %1 litrů bylo natankováno. + %1 litri sono stati riforniti. - \ No newline at end of file + diff --git a/addons/reload/CfgEventHandlers.hpp b/addons/reload/CfgEventHandlers.hpp index 75c2280e24..a3dd6de29b 100644 --- a/addons/reload/CfgEventHandlers.hpp +++ b/addons/reload/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/reload/XEH_PREP.hpp b/addons/reload/XEH_PREP.hpp new file mode 100644 index 0000000000..bfd89b098e --- /dev/null +++ b/addons/reload/XEH_PREP.hpp @@ -0,0 +1,6 @@ + +PREP(canCheckAmmo); +PREP(canLinkBelt); +PREP(checkAmmo); +PREP(displayAmmo); +PREP(startLinkingBelt); diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf index bd26583668..16f3d9b40e 100644 --- a/addons/reload/XEH_postInit.sqf +++ b/addons/reload/XEH_postInit.sqf @@ -7,9 +7,9 @@ if (!hasInterface) exitWith {}; ["ACE3 Weapons", QGVAR(checkAmmo), localize LSTRING(checkAmmo), { // Conditions: canInteract - if !([ACE_player, (vehicle ACE_player), ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, vehicle ACE_player, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon) || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false}; + if !(ACE_player call CBA_fnc_canUseWeapon || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false}; // Statement [ACE_player] call FUNC(checkAmmo); @@ -20,26 +20,26 @@ if (!hasInterface) exitWith {}; ["setAmmoSync", { //To propagate the setAmmo change, do it on all clients - PARAMS_3(_unit,_weapon,_ammo); + params ["_unit", "_weapon", "_ammo"]; + TRACE_3("setAmmoSync EH",_unit,_weapon,_ammo); + _unit setAmmo [_weapon, _ammo]; }] call EFUNC(common,addEventhandler); // Listen for attempts to link ammo ["linkedAmmo", { - EXPLODE_3_PVT(_this,_receiver,_giver,_magazine); + params ["_receiver", "_giver", "_magazine"]; - private ["_magazineCfg","_magazineType"]; - _magazineType = currentMagazine _receiver; - _magazineCfg = configFile >> "CfgMagazines" >> _magazineType; + private _magazineType = currentMagazine _receiver; + private _magazineCfg = configFile >> "CfgMagazines" >> _magazineType; // Return the magazine if it's the wrong type if (_magazineType != (_magazine select 0)) exitWith { ["returnedAmmo", [_giver], [_giver,_receiver,_magazine]] call EFUNC(common,targetEvent); }; - private ["_ammoCount","_ammoMissing","_ammoAdded","_ammoRemaining"]; - _ammoCount = _receiver ammo currentWeapon _receiver; - _ammoMissing = getNumber (_magazineCfg >> "count") - _ammoCount; + private _ammoCount = _receiver ammo currentWeapon _receiver; + private _ammoMissing = getNumber (_magazineCfg >> "count") - _ammoCount; // Return the magazine if the belt is full or empty if ((_ammoCount == 0) || _ammoMissing == 0) exitWith { @@ -47,19 +47,18 @@ if (!hasInterface) exitWith {}; }; // Add the ammo - _ammoAdded = _ammoMissing min (_magazine select 1); - ["setAmmoSync", [_receiver, (currentWeapon _receiver), (_ammoCount + _ammoAdded)]] call EFUNC(common,globalEvent); + private _ammoAdded = _ammoMissing min (_magazine select 1); + ["setAmmoSync", [_receiver, currentWeapon _receiver, _ammoCount + _ammoAdded]] call EFUNC(common,globalEvent); if ((_magazine select 1) - _ammoAdded > 0) then { - ["returnedAmmo", [_giver], [_giver,_receiver,[_magazineType,(_magazine select 1) - _ammoAdded]]] call EFUNC(common,targetEvent); + ["returnedAmmo", [_giver], [_giver, _receiver, [_magazineType, (_magazine select 1) - _ammoAdded]]] call EFUNC(common,targetEvent); }; - }] call EFUNC(common,addEventhandler); - // Listen for returned magazines ["returnedAmmo", { - EXPLODE_3_PVT(_this,_receiver,_giver,_magazine); + params ["_receiver", "", "_magazine"]; + TRACE_2("returnedAmmo EH",_receiver,_magazine); _receiver addMagazine _magazine; }] call EFUNC(common,addEventhandler); diff --git a/addons/reload/XEH_preInit.sqf b/addons/reload/XEH_preInit.sqf index 278abf7bd2..a7feade1c3 100644 --- a/addons/reload/XEH_preInit.sqf +++ b/addons/reload/XEH_preInit.sqf @@ -2,10 +2,6 @@ ADDON = false; -PREP(canCheckAmmo); -PREP(canLinkBelt); -PREP(checkAmmo); -PREP(displayAmmo); -PREP(startLinkingBelt); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/reload/XEH_preStart.sqf b/addons/reload/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/reload/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/reload/functions/fnc_canLinkBelt.sqf b/addons/reload/functions/fnc_canLinkBelt.sqf index 4461b4f3e3..13fad4d460 100644 --- a/addons/reload/functions/fnc_canLinkBelt.sqf +++ b/addons/reload/functions/fnc_canLinkBelt.sqf @@ -11,29 +11,27 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_target); +params ["_player", "_target"]; if (vehicle _target != _target) exitWith {false}; -private ["_magazineCfg","_magazineType"]; -_magazineType = currentMagazine _target; -_magazineCfg = configFile >> "CfgMagazines" >> _magazineType; +private _magazineType = currentMagazine _target; +private _magazineCfg = configFile >> "CfgMagazines" >> _magazineType; + if (getNumber (_magazineCfg >> "ACE_isBelt") == 0) exitWith {false}; // Check if the ammo is not empty or full -private "_ammoCount"; -_ammoCount = _target ammo currentWeapon _target; +private _ammoCount = _target ammo currentWeapon _target; // Exit if the belt is full or empty -if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false}; +if (_ammoCount == 0 || getNumber (_magazineCfg >> "count") - _ammoCount == 0) exitWith {false}; // Check if the player has any of the same magazines // Calculate max ammo -private "_maxAmmo"; -_maxAmmo = 0; +private _maxAmmo = 0; { _maxAmmo = _maxAmmo max (_x select 1); -} forEach ([magazinesAmmo _player, {_this select 0 == _magazineType}] call EFUNC(common,filter)); +} forEach (magazinesAmmo _player select {_x select 0 == _magazineType}); _maxAmmo > 0 diff --git a/addons/reload/functions/fnc_checkAmmo.sqf b/addons/reload/functions/fnc_checkAmmo.sqf index 2499a9a893..b0581a143a 100644 --- a/addons/reload/functions/fnc_checkAmmo.sqf +++ b/addons/reload/functions/fnc_checkAmmo.sqf @@ -13,10 +13,9 @@ #define COUNT_BARS 12 -EXPLODE_1_PVT(_this,_unit); +params ["_unit"]; -private ["_target"]; -_target = vehicle _unit; +private _target = vehicle _unit; if (count _this > 1) then { _target = _this select 1; diff --git a/addons/reload/functions/fnc_displayAmmo.sqf b/addons/reload/functions/fnc_displayAmmo.sqf index 993283ca56..7fff5564c0 100644 --- a/addons/reload/functions/fnc_displayAmmo.sqf +++ b/addons/reload/functions/fnc_displayAmmo.sqf @@ -12,13 +12,11 @@ #define COUNT_BARS 12 -EXPLODE_1_PVT(_this,_target); +params ["_target"]; -private ["_weapon","_muzzle","_magazine","_showNumber","_ammo","_maxRounds","_count","_text","_color","_picture","_ammoBarsStructuredText", "_a", "_loadedName", "_string"]; - -_weapon = currentWeapon _target; -_muzzle = currentMuzzle _target; -_magazine = currentMagazine _target; +private _weapon = currentWeapon _target; +private _muzzle = currentMuzzle _target; +private _magazine = currentMagazine _target; // currentWeapon returns "" for static weapons before they are shot once if (_target isKindOf "StaticWeapon") then { @@ -31,8 +29,8 @@ if (_target isKindOf "StaticWeapon") then { if (_magazine == "") then { // Try to get magazine using magazinesAmmoFull - private ["_magazines"]; - _magazines = magazinesAmmoFull _target; + private _magazines = magazinesAmmoFull _target; + { if (_x select 2) exitWith { _magazine = _x select 0; @@ -45,10 +43,10 @@ if (_magazine == "") exitWith {}; if (_weapon == "") exitWith {}; if (!( _muzzle isEqualType "")) then {_muzzle = _weapon}; -_showNumber = false; -_ammo = 0; -_maxRounds = 1; -_count = 0; +private _showNumber = false; +private _ammo = 0; +private _maxRounds = 1; +private _count = 0; // not grenade launcher if (_muzzle == _weapon) then { @@ -75,16 +73,16 @@ if (_muzzle == _weapon) then { }; }; -_ammoBarsStructuredText = if (_showNumber) then { +private _ammoBarsStructuredText = if (_showNumber) then { parseText format ["%1x", _count] } else { - _color = [((2 * (1 - _ammo / _maxRounds)) min 1), ((2 * _ammo / _maxRounds) min 1), 0]; + private _color = [((2 * (1 - _ammo / _maxRounds)) min 1), ((2 * _ammo / _maxRounds) min 1), 0]; - _string = ""; + private _string = ""; for "_a" from 1 to _count do { _string = _string + "|"; }; - _text = [_string, _color] call EFUNC(common,stringToColoredText); + private _text = [_string, _color] call EFUNC(common,stringToColoredText); _string = ""; for "_a" from (_count + 1) to (_maxRounds min COUNT_BARS) do { @@ -97,11 +95,11 @@ _ammoBarsStructuredText = if (_showNumber) then { if (_target isKindOf "StaticWeapon") then { //Vehicle mags (usualy) don't have pictures, so just show the text above ammo count - _loadedName = getText (configFile >> "CfgMagazines" >> _magazine >> "displaynameshort"); + private _loadedName = getText (configFile >> "CfgMagazines" >> _magazine >> "displaynameshort"); _loadedName = parseText format ["%1", _loadedName]; - _text = composeText [_loadedName, linebreak, _ammoBarsStructuredText]; + private _text = composeText [_loadedName, linebreak, _ammoBarsStructuredText]; [_text] call EFUNC(common,displayTextStructured); } else { - _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); + private _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); [_ammoBarsStructuredText, _picture] call EFUNC(common,displayTextPicture); }; diff --git a/addons/reload/functions/fnc_startLinkingBelt.sqf b/addons/reload/functions/fnc_startLinkingBelt.sqf index 4bed7f700a..5924e1b4e1 100644 --- a/addons/reload/functions/fnc_startLinkingBelt.sqf +++ b/addons/reload/functions/fnc_startLinkingBelt.sqf @@ -11,48 +11,45 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_target); +params ["_player", "_target"]; if (vehicle _target != _target) exitWith {false}; -private ["_magazineCfg","_magazineType", "_condition", "_onFailure", "_onFinish"]; -_magazineType = currentMagazine _target; -_magazineCfg = configFile >> "CfgMagazines" >> _magazineType; +private _magazineType = currentMagazine _target; +private _magazineCfg = configFile >> "CfgMagazines" >> _magazineType; + if (getNumber (_magazineCfg >> "ACE_isBelt") == 0) exitWith {false}; // Check if the ammo is not empty or full -private "_ammoCount"; -_ammoCount = _target ammo currentWeapon _target; +private _ammoCount = _target ammo currentWeapon _target; // Exit if the belt is full or empty if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false}; // Check if the player has any of the same same magazines // Calculate max ammo it can link -private "_maxAmmo"; -_maxAmmo = 0; +private _maxAmmo = 0; { _maxAmmo = _maxAmmo max (_x select 1); -} forEach ([magazinesAmmo _player, {_this select 0 == _magazineType}] call EFUNC(common,filter)); +} forEach (magazinesAmmo _player select {_x select 0 == _magazineType}); if (_maxAmmo == 0) exitWith {}; - // Condition to call each frame -_condition = { - EXPLODE_2_PVT((_this select 0),_player,_target); +private _condition = { + (_this select 0) params ["_player", "_target"]; ([_player, _target, []] call EFUNC(common,canInteractWith)) && ((_player distance _target) < 3) && ((speed _target) < 1) }; -_onFinish = { - EXPLODE_3_PVT((_this select 0),_player,_target,_magazine); +private _onFinish = { + (_this select 0) params ["_player", "_target", "_magazine"]; // Raise event on remote unit ["linkedAmmo", [_target], [_target, _player, _magazine]] call EFUNC(common,targetEvent); }; -_onFailure = { +private _onFailure = { EXPLODE_3_PVT((_this select 0),_player,_target,_magazine); [_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); diff --git a/addons/reload/script_component.hpp b/addons/reload/script_component.hpp index 8a1c097ab0..09993faaa4 100644 --- a/addons/reload/script_component.hpp +++ b/addons/reload/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT reload #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RELOAD #define DEBUG_MODE_FULL #endif diff --git a/addons/reload/stringtable.xml b/addons/reload/stringtable.xml index fc0c534e93..f7412e1d2e 100644 --- a/addons/reload/stringtable.xml +++ b/addons/reload/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -65,10 +65,10 @@ Linking belt... Attache d'une bande... Enlazando cinta... - Сцепка лент ... + Сцепка лент... Spojuji pás... Podłączanie taśmy... - Gurt anhängen ... + Gurt anhängen... Töltényheveder összekötése folyamatban... Attacco la tracolla... Ligando cintos... diff --git a/addons/reloadlaunchers/CfgEventHandlers.hpp b/addons/reloadlaunchers/CfgEventHandlers.hpp index 0cd959a047..becf395052 100644 --- a/addons/reloadlaunchers/CfgEventHandlers.hpp +++ b/addons/reloadlaunchers/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/reloadlaunchers/XEH_PREP.hpp b/addons/reloadlaunchers/XEH_PREP.hpp new file mode 100644 index 0000000000..b730d2780e --- /dev/null +++ b/addons/reloadlaunchers/XEH_PREP.hpp @@ -0,0 +1,6 @@ + +PREP(addMissileReloadActions); +PREP(canLoad); +PREP(getLoadableMissiles); +PREP(load); +PREP(reloadLauncher); diff --git a/addons/reloadlaunchers/XEH_preInit.sqf b/addons/reloadlaunchers/XEH_preInit.sqf index 3b60f99b8e..a7feade1c3 100644 --- a/addons/reloadlaunchers/XEH_preInit.sqf +++ b/addons/reloadlaunchers/XEH_preInit.sqf @@ -2,10 +2,6 @@ ADDON = false; -PREP(addMissileReloadActions); -PREP(canLoad); -PREP(getLoadableMissiles); -PREP(load); -PREP(reloadLauncher); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/reloadlaunchers/XEH_preStart.sqf b/addons/reloadlaunchers/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/reloadlaunchers/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf b/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf index 9b083a04c6..e75d826513 100644 --- a/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf +++ b/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf @@ -22,7 +22,7 @@ private "_magazines"; _magazines = magazines _unit; // case sensitvity -_magazines = [_magazines, {toLower _this}] call EFUNC(common,map); +_magazines = _magazines apply {toLower _x}; // get reloaders magazine types compatible with targets launcher. No duplicates. -[getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"), {toLower _this in _magazines}] call EFUNC(common,filter) +getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select {toLower _x in _magazines} // return diff --git a/addons/reloadlaunchers/script_component.hpp b/addons/reloadlaunchers/script_component.hpp index bc6b7f6e6c..fc78723f2a 100644 --- a/addons/reloadlaunchers/script_component.hpp +++ b/addons/reloadlaunchers/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT reloadlaunchers #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RELOADLAUNCHERS #define DEBUG_MODE_FULL #endif diff --git a/addons/reloadlaunchers/stringtable.xml b/addons/reloadlaunchers/stringtable.xml index d82970a3d5..5e38ce4009 100644 --- a/addons/reloadlaunchers/stringtable.xml +++ b/addons/reloadlaunchers/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -14,15 +14,15 @@ Recarregar lançador - Loading launcher ... - Chargement du lanceur ... - Panzerabwehr wird geladen ... - Cargando lanzador ... - Зарядка ПУ ... - Nabíjím odpalovač ... - Ładowanie wyrzutni ... - Kilövő betöltés alatt ... - Carico il lanciamissili ... + Loading launcher... + Chargement du lanceur... + Panzerabwehr wird geladen... + Cargando lanzador... + Зарядка ПУ... + Nabíjím odpalovač... + Ładowanie wyrzutni... + Kilövő betöltés alatt... + Carico il lanciamissili... Recarregando lançador... diff --git a/addons/repair/CfgEden.hpp b/addons/repair/CfgEden.hpp new file mode 100644 index 0000000000..3adbe6b336 --- /dev/null +++ b/addons/repair/CfgEden.hpp @@ -0,0 +1,48 @@ +class Cfg3DEN { + class Object { + class AttributeCategories { + class ace_attributes { + class Attributes { + class ace_isEngineer { + property = QUOTE(ace_isEngineer); + value = 0; + control = "Combo"; + displayName = CSTRING(AssignEngineerRole_role_DisplayName); + tooltip = CSTRING(AssignEngineerRole_role_Description); + expression = "_this setVariable ['%s',_value];"; + typeName = "NUMBER"; + condition = "objectBrain"; + defaultValue = 0; + class values { + class none {name = CSTRING(AssignEngineerRole_role_none); value = 0; default = 1;}; + class engineer {name = CSTRING(AssignEngineerRole_role_engineer); value = 1; default = 0;}; + class specialist {name = CSTRING(AssignEngineerRole_role_specialist); value = 2; default = 0;}; + }; + }; + class ace_isRepairVehicle { + property = QUOTE(ace_isRepairVehicle); + value = 0; + control = "CheckboxNumber"; + displayName = CSTRING(AssignRepairVehicle_role_DisplayName); + tooltip = CSTRING(AssignRepairVehicle_role_Description); + expression = "_this setVariable ['%s',_value];"; + typeName = "NUMBER"; + condition = "objectVehicle"; + defaultValue = 0; + }; + class ace_isRepairFacility { + property = QUOTE(ace_isRepairFacility); + value = 0; + control = "CheckboxNumber"; + displayName = CSTRING(AssignRepairFacility_role_DisplayName); + tooltip = CSTRING(AssignRepairFacility_role_Description); + expression = "_this setVariable ['%s',_value];"; + typeName = "NUMBER"; + condition = "(1 - objectBrain) * (1 - objectVehicle)"; + defaultValue = 0; + }; + }; + }; + }; + }; +}; diff --git a/addons/repair/CfgEventHandlers.hpp b/addons/repair/CfgEventHandlers.hpp index 798a10316a..882a542c7f 100644 --- a/addons/repair/CfgEventHandlers.hpp +++ b/addons/repair/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index 0b370bd2d3..1968023881 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -302,8 +302,8 @@ class CfgVehicles { MACRO_REPAIRVEHICLE }; - class thingX; - class ACE_RepairItem_Base: thingX { + class ThingX; + class ACE_RepairItem_Base: ThingX { XEH_ENABLED; icon = "iconObject_circle"; mapSize = 0.7; diff --git a/addons/repair/XEH_PREP.hpp b/addons/repair/XEH_PREP.hpp new file mode 100644 index 0000000000..e3604c95a7 --- /dev/null +++ b/addons/repair/XEH_PREP.hpp @@ -0,0 +1,39 @@ + +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(getClaimObjects); +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); diff --git a/addons/repair/XEH_preInit.sqf b/addons/repair/XEH_preInit.sqf index 8efa47e7b3..a7feade1c3 100644 --- a/addons/repair/XEH_preInit.sqf +++ b/addons/repair/XEH_preInit.sqf @@ -2,43 +2,6 @@ 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(getClaimObjects); -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); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/repair/XEH_preStart.sqf b/addons/repair/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/repair/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/repair/config.cpp b/addons/repair/config.cpp index 2e991b54a6..d377342adf 100644 --- a/addons/repair/config.cpp +++ b/addons/repair/config.cpp @@ -17,3 +17,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgActions.hpp" #include "CfgVehicles.hpp" +#include "CfgEden.hpp" diff --git a/addons/repair/functions/fnc_getClaimObjects.sqf b/addons/repair/functions/fnc_getClaimObjects.sqf index bc15975d1c..c2311a467f 100644 --- a/addons/repair/functions/fnc_getClaimObjects.sqf +++ b/addons/repair/functions/fnc_getClaimObjects.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: Unit that does the repairing - * 1: Max range to seach from unit (meters) + * 1: Max range to seach from unit (meters) * 2: Array of arrays of classnames * * Return Value: diff --git a/addons/repair/functions/fnc_repair_failure.sqf b/addons/repair/functions/fnc_repair_failure.sqf index 3fabb58e80..8616dd4808 100644 --- a/addons/repair/functions/fnc_repair_failure.sqf +++ b/addons/repair/functions/fnc_repair_failure.sqf @@ -63,6 +63,7 @@ if (isNil _callback) then { } else { _callback = missionNamespace getVariable _callback; }; +if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};}; _args call _callback; diff --git a/addons/repair/functions/fnc_repair_success.sqf b/addons/repair/functions/fnc_repair_success.sqf index 9625dad1df..c18116f862 100644 --- a/addons/repair/functions/fnc_repair_success.sqf +++ b/addons/repair/functions/fnc_repair_success.sqf @@ -58,6 +58,8 @@ if (isNil _callback) then { } else { _callback = missionNamespace getVariable _callback; }; +if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};}; + _args call _callback; //todo: repair litter? diff --git a/addons/repair/functions/fnc_setDamage.sqf b/addons/repair/functions/fnc_setDamage.sqf index 410a9b0396..78c7cae709 100644 --- a/addons/repair/functions/fnc_setDamage.sqf +++ b/addons/repair/functions/fnc_setDamage.sqf @@ -23,23 +23,15 @@ TRACE_2("params",_vehicle,_damage); 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; +(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []], ["_allHitPointsSelections", []], ["_allHitPointDamages", []]]; // set damage of the vehicle _vehicle setDamage _damage; // restore original hitpoint damage values { - _vehicle setHitPointDamage [_x, _hitPointDamages select _forEachIndex]; -} forEach _hitPoints; + _vehicle setHitIndex [_forEachIndex, _x]; +} forEach _allHitPointDamages; // normalize hitpoints [_vehicle] call FUNC(normalizeHitPoints); diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index ff5d40a6ae..adae522925 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_REPAIR #define DEBUG_MODE_FULL diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml index 64fecd5de8..8338b86e7e 100644 --- a/addons/repair/stringtable.xml +++ b/addons/repair/stringtable.xml @@ -38,13 +38,14 @@ Vyměnit kolo - Replacing Wheel ... - Ersetze Reifen ... - Wymienianie koła ... + Replacing Wheel... + Ersetze Reifen... + Wymienianie koła... Trocando roda... - Замена колеса ... - Měním kolo ... - Cambiando rueda ... + Замена колеса... + Měním kolo... + Cambiando rueda... + Sto sostituendo la ruota... Wheel replaced @@ -54,6 +55,7 @@ Колесо заменено Kolo vyměněno Rueda cambiada + Ruota sostituita Remove Wheel @@ -68,13 +70,14 @@ Снять колесо - Removing Wheel ... - Entferne Reifen ... - Zdejmowanie koła ... + Removing Wheel... + Entferne Reifen... + Zdejmowanie koła... Removendo roda... - Снятие колеса ... - Odstraňuji kolo ... - Quitando rueda ... + Снятие колеса... + Odstraňuji kolo... + Quitando rueda... + Sto rimuovendo la ruota... Wheel removed @@ -84,6 +87,7 @@ Колесо снято Kolo odstraněno Rueda quitada + Ruota rimossa Change Track @@ -93,15 +97,17 @@ Заменить гусеницу Vyměnit pás Cambiar oruga + Cambia cingolo - Replacing Track ... - Tausche Kette aus ... - Wymienianie gąsienicy ... + Replacing Track... + Tausche Kette aus... + Wymienianie gąsienicy... Trocando esteira... - Замена гусеницы ... - Měním pás ... - Cambiando oruga ... + Замена гусеницы... + Měním pás... + Cambiando oruga... + Sto sostituendo il cingolo... Track replaced @@ -111,6 +117,7 @@ Гусеница заменена Pás vyměněn Oruga cambiada + Cingolo sostituito Remove Track @@ -120,15 +127,17 @@ Снять гусеницу Odstranit pás Quitar oruga + Rimuovi cingolo - Removing Track ... - Entferne Kette ... - Zdejmowanie gąsienicy ... + Removing Track... + Entferne Kette... + Zdejmowanie gąsienicy... Removendo esteira... - Снятие гусеницы ... - Odstraňuji pás ... - Quitando oruga ... + Снятие гусеницы... + Odstraňuji pás... + Quitando oruga... + Sto rimuovendo il cingolo... Track removed @@ -138,6 +147,7 @@ Гусеница снята Pás odstraněn Oruga quitada + Cingolo rimosso Full Repair @@ -147,15 +157,17 @@ Полный ремонт Kompletní oprava Reparación completa + Riparazione completa - Repairing Vehicle ... - Entferne Fahrzeug ... - Naprawianie pojazdu ... + Repairing Vehicle... + Entferne Fahrzeug... + Naprawianie pojazdu... Reparando veículo... - Ремонт транспорта ... - Opravuji vozidlo ... - Reparando vehículo ... + Ремонт транспорта... + Opravuji vozidlo... + Reparando vehículo... + Sto riparando il veicolo... Full Repair Locations @@ -165,6 +177,7 @@ Места полного ремонта Oblast pro kompletní opravu Lugares de reparación completa + Luoghi Riparazione Completa At what locations can a vehicle be fully repaired? @@ -174,6 +187,7 @@ В каких местах транспорт может быть полностью отремеонтирован? ¿En qué lugares puede un vehículo ser reparado totalmente? V které oblasti může být vozidlo plně opraveno? + In quali luoghi è possibile riparare completamente un veicolo? Allow Full Repair @@ -183,6 +197,7 @@ Полный ремонт выполняют Povolit kompletní opravu Permitir reparación completa + Consenti Riparazione Completa Who can perform a full repair on a vehicle? @@ -192,6 +207,7 @@ Quem pode reparar o veículo por completo? ¿Quién puede realizar una reparación completa de un vehículo? Kdo může provést úplné opravy na vozidle? + Chi può eseguire una riparazione completa su un veicolo? Add Spare Parts @@ -201,6 +217,7 @@ Añadir repuestos Добавлять запчасти Přidat náhradní díly + Aggiungi Parti di Ricambio Add spare parts to vehicles (requires Cargo component)? @@ -210,6 +227,7 @@ ¿Añadir repuestos para vehículos (requiere componente de carga)? Добавлять запасные части в технику (требуется модуль Грузоперевозок)? Přidat náhradní díly do vozidla (vyžaduje úložný prostor)? + Aggiungi parti di ricambio ai veicoli (richiede componente Cargo)? Repair >> @@ -231,6 +249,7 @@ Отображать текст при ремонте Zobrazit text při opravě Mostrar texto en la reparación + Mostra testo mentre ripari Display a notification whenever you repair a vehicle @@ -240,30 +259,31 @@ Отображать оповещение каждый раз, когда вы ремонтируете транспорт Mostrar una notificación cada vez que se reparare un vehículo Zobrazit oznámení kdykoliv opravíš vozidlo + Mostra una notifica quando stai riparando un veicolo - Repairing ... - Reparieren ... - Reparando ... - Réparation ... + Repairing... + Reparieren... + Reparando... + Réparation... Naprawianie... - Opravuji ... + Opravuji... Reparando... - Sto riparando ... - javítása ... - Ремонтируем ... + Sto riparando... + javítása... + Ремонтируем... - Repairing %1 ... - Repariere %1 ... - Reparando %1 ... - Réparation %1 ... + Repairing %1... + Repariere %1... + Reparando %1... + Réparation %1... Naprawianie %1... - Opravuji %1 ... + Opravuji %1... Reparando %1... - Sto riparando %1 ... - %1 javítása ... - Ремонтируем %1 ... + Sto riparando %1... + %1 javítása... + Ремонтируем %1... Repaired %1 @@ -285,6 +305,7 @@ Полностью отремонтированная часть Kompletně opravená část Parte totalmente reparado + Parte riparata completamente Partially repaired %1 @@ -294,6 +315,7 @@ Частично отремонтировано: %1 Parcialmente reparada %1 %1 - částečně opraveno + %1 parzialmente riparato Fully repaired %1 @@ -303,6 +325,7 @@ Полностью отремонтировано: %1 %1 - kompletně opraveno Totalmente reparada %1 + %1 completamente riparato Partially repaired %1 @@ -312,6 +335,7 @@ Частично отремонтировано: %1 Parcialmente reparada %1 %1 - částečně opraveno + %1 parzialmente riparato Body @@ -356,6 +380,7 @@ Estabilizador Horizontal Esquerdo Estabilizador horizontal izquierdo Levý horizontální stabilizátor + Stabilizzatore Orizzontale Sinistro Right Horizontal Stabilizer @@ -364,6 +389,7 @@ Estabilizador Horizontal Direito Estabilizador horizontal derecho Pravý horizontální stabilizátor + Stabilizzatore Orizzontale Destro Vertical Stabilizer @@ -372,6 +398,7 @@ Вертикальный стабилизатор Estabilizador Vertical Estabilizador vertical + Stabilizzatore Verticale Fuel Tank @@ -393,6 +420,7 @@ Трансмиссия Transmissão Transmisión + Trasmissione Gear @@ -402,6 +430,7 @@ Engrenagem Rueda Podvozek + Motore Starter @@ -411,6 +440,7 @@ Стартер Arranque Motor de arranque + Motore d'avviamento Tail @@ -420,6 +450,7 @@ Хвост Tail Cauda + Coda Pitot Tube @@ -429,6 +460,7 @@ Кокпит Tubo de Pitot Tubo del pitot + Tubo di Pitot Static Port @@ -438,6 +470,7 @@ Porta Estática Puerto estático Statický port + Porta Statica Ammo @@ -447,6 +480,7 @@ Боеприпасы Munição Munición + Munizioni Turret @@ -480,6 +514,7 @@ Rakety Rakiety Misiles + Missili Left Track @@ -645,6 +680,7 @@ Лебедка Cabrestante Naviják + Gancio Glass (right) @@ -684,6 +720,9 @@ ERA + ERA + ERA + ERA Repair Settings @@ -693,6 +732,7 @@ Ремонт Ajustes de reparación Nastavení oprav + Impostazioni Riparazioni Provides a repair system for all types of vehicles. @@ -702,6 +742,7 @@ Предоставляет систему ремонта для всех типов транспортных средств. Proporciona un sistema de reparación para todo tipo de vehículos. Poskytuje rozsáhlý systém oprav pro všechny typy vozidel. + Fornisce un sistema di riparazione per tutti i tipi di veicoli. Anyone @@ -711,6 +752,7 @@ Кто угодно Kdokoliv Cualquiera + Chiunque Engineer only @@ -720,6 +762,7 @@ Только инженеры Pouze inženýr Solo ingeniero + Solo Geniere Repair Specialist only @@ -729,6 +772,7 @@ Только ремонтные специалисты Pouze specialista na opravování Solo especialista en reparación + Solo Specialista Riparazioni Allow Wheel @@ -738,6 +782,7 @@ Разрешить замену колес Možnost Výměny Kol Permitir rueda + Consenti Ruota Who can remove and replace wheels? @@ -747,6 +792,7 @@ Кто может снимать и заменять колеса? Kdo může odstranit a vyměnit kola? ¿Quién puede quitar y cambiar las ruedas? + Chi può rimuovere e sostituire le ruote? Allow Repair @@ -756,6 +802,7 @@ Разрешить ремонт Možnost Opravování Permitir reparación + Consenti Riparazioni Who can perform repair actions? @@ -765,6 +812,7 @@ Кто может выполнять ремонт? Kdo může provádět opravy? ¿Quién puede realizar reparaciones? + Chi può eseguire riparazioni? Repair Threshold @@ -774,6 +822,7 @@ Лимит ремкомплекта Umbral de reparación Práh oprav + Limite Riparazioni What is the maximum damage that can be repaired with a toolkit? @@ -783,6 +832,7 @@ Какой максимальный урон можно починить с помощью ремкомплекта? ¿Cuál es el daño máximo que puede ser reparado con una caja de herramientas? Jaké maximální poškození může být opraveno pomocí opravárenské sady? + Qual'è il danno massimo che può essere riparato con il Toolkit? Repair Threshold (Engineer) @@ -792,6 +842,7 @@ Лимит инженера Umbral de Reparación (Ingeniero) Práh oprav (Inženýr) + Limite Riparazioni (Geniere) What is the maximum damage that can be repaired by an engineer? @@ -801,6 +852,7 @@ Какой максимальный урон может починить инженер? ¿Cuál es el daño máximo que puede ser reparado por un ingeniero? Jaké maximální poškození může být opraveno pomoci inženýra? + Qual'è il danno massimo che può essere riparato da un Geniere? Remove toolkit on use @@ -810,6 +862,7 @@ Удалять ремкомплект после использования Eliminar conjunto de herramientas al usarlo Odstranit sadu nástrojů po použití + Rimuovi Toolkit dopo l'uso Should the toolkit be removed on usage? @@ -819,6 +872,7 @@ Следует ли удалять ремкомплект после использования? ¿Deben retirarse las herramientas al usarlas? Má být odstraněna sada nástroju po použití? + Il Toolkit dev'essere rimosso dopo l'uso? Anywhere @@ -828,6 +882,7 @@ Где угодно Kdekoliv En cualquier sitio + Ovunque Repair Vehicle only @@ -837,6 +892,7 @@ Только у ремонтного транспорта Reparar solo en vehículo Pouze opravárenské vozidlo + Solo Veicoli Riparazioni Repair Facility only @@ -846,6 +902,7 @@ Только у ремонтных сооружений Reparar solo en instalación Pouze opravárenské zařízení + Solo Strutture Riparazioni Repair Facility or Vehicle @@ -855,6 +912,7 @@ Только у ремонтного транспорта или ремонтных сооружений Reparar en instalación o vehículo Opravárenské zařízení nebo vozidlo + Strutture Riparazioni o Veicoli Assign Engineer @@ -864,6 +922,7 @@ Назначить инженером Přiřadit Inženýra Asignar ingeniero + Assegna Geniere List @@ -873,6 +932,7 @@ Список Seznam Lista + Lista List of unit names that will be classified as engineer, separated by commas. @@ -882,6 +942,7 @@ Список имен юнитов, которые будут классифицированы как инженеры, разделенный запятыми. Lista de los nombres de las unidades que serán clasificados como ingeniero, separados por comas. Seznam jmen jednotek, které budou klasifikovány jako inženýr, oddělit čárkami. + Lista di unità che verranno classificate come genieri, separate da virgole. Is Engineer @@ -891,6 +952,7 @@ Это инженер Es un ingeniero Inženýr + E' Geniere Select the engineering skill level of the unit @@ -900,6 +962,7 @@ Укажите уровень инженерного мастерства для юнита Selecciona el nivel de conocimientos de ingeniería de la unidad Vyberte úroveň dovednosti inženýra pro jednotku + Seleziona il livello di abilità geniere dell'unità None @@ -909,6 +972,7 @@ Нет Nikdo Ningún + Nessuna Engineer @@ -918,6 +982,7 @@ Инженер Inženýr Ingeniero + Geniere Specialist @@ -927,6 +992,7 @@ Специалист Specialista Especialista + Specialista Riparazioni Assign one or multiple units as an engineer @@ -936,6 +1002,7 @@ Назначить одного или нескольких юнитов инженерами Asignar una o varias unidades como ingeniero Přiřaďte jednu nebo více osob jako inženýra + Assegna una o più unità come genieri Assign Repair Vehicle @@ -945,6 +1012,7 @@ Назначить ремонтный транспорт Asignar vehículo de reparación Přiřaďte opraváresnké vozidlo + Assegna Veicolo Riparazioni List @@ -954,6 +1022,7 @@ Список Seznam Lista + Lista List of vehicles that will be classified as repair vehicle, separated by commas. @@ -963,6 +1032,7 @@ Список транспортных средств, которые будут классифицированы как ремонтные, разделенный запятыми. Lista de los vehículos que se clasifican como vehículo de reparación, separados por comas. Seznam vozidel, která budou klasifikována jako opravárenská, oddělit čárkami. + Lista di Veicoli che verranno considerati veicoli riparazioni, separati da virgole. Is Repair Vehicle @@ -972,6 +1042,7 @@ Это ремонтный транспорт Es un vehículo de reparación Opravárenské vozidlo + E' Veicolo Riparazioni Is the vehicle classified as a repair vehicle? @@ -981,6 +1052,7 @@ Классифицируется ли этот транспорт как ремонтный? ¿Está el vehículo clasificado como un vehículo de reparación? Je vozidlo klasifikováno jako opravárenské? + Il veicolo è classificato dome veicolo riparazioni? Assign one or multiple vehicles as a repair vehicle @@ -990,6 +1062,7 @@ Назначить одно или несколько транспортных средств ремонтными Asignar uno o varios vehículos como vehículo de reparación Přiřaďte jedno nebo více vozidel jako opravárenské vozidlo + Assegna uno o più veicoli come veicoli riparazioni Assign Repair Facility @@ -999,6 +1072,7 @@ Назначить ремонтное сооружение Asignar instalación de reparación Přiřaďte opravárenské zařízení + Assegna Struttura Riparazioni List @@ -1008,6 +1082,7 @@ Список Seznam Lista + Lista List of objects that will be classified as repair Facility, separated by commas. @@ -1017,6 +1092,7 @@ Список объектов, которые будут классифицированы как ремонтные, разделенный запятыми. Lista de los objetos que se clasifican como instalaciones para la reparación, separados por comas. Seznam objektů, které budou klasifikovány jako opravárenské zařízení, oddělit čárkami. + Lista di oggetti che verranno classificati come strutture riparazioni, separate da virgole. Is Repair Facility @@ -1026,6 +1102,7 @@ Это ремонтное сооружение Es una instalación de reparación Opravárenské zařízení + E' Struttura Riparazioni Is the object classified as a repair Facility? @@ -1035,6 +1112,7 @@ Классифицируется ли этот объект как ремонтное сооружение? ¿Está el objeto clasificado como una instalación de reparación? Je objekt klasifikován jako opravárenské zařízení? + L'oggetto è classificato come struttura riparazioni? Assign one or multiple objects as a repair Facility @@ -1044,6 +1122,7 @@ Definir um ou mais objetos como instalação de reparos Asignar uno o varios objetos como una instalación de reparación Přiřaďte jeden nebo více objektů jako opravárenské zařízení + Assegna uno o più oggetti come strutture riparazioni Add Spare Parts @@ -1053,6 +1132,7 @@ Añadir repuestos Добавить запчасти Přidat náhradní díly + Aggiungi Parti di Ricambio Add spare parts to one or multiple objects @@ -1062,6 +1142,7 @@ Añadir repuestos a uno o varios objetos Добавить запасные части в одно или несколько транспортных средств Přidat náhradní díly do jednoho nebo více objektů + Aggiungi parti di ricambio ad uno o più oggetti List @@ -1071,6 +1152,7 @@ Lista Список Seznam + Lista List of objects that will get spare parts added, separated by commas. @@ -1080,6 +1162,7 @@ Lista de los objetos que tendrán repuestos añadidos, separados por comas. Список транспортных средств, в которые будут добавляться запчасти, разделенный запятыми. Seznam objektů, které dostanou náhradní díly, oddělit čárkami. + Lista di oggetti a cui verranno aggiunte parti di ricambio, separate da virgole. Part @@ -1089,6 +1172,7 @@ Pieza Запчасть Díl + Parte Spare part. @@ -1098,6 +1182,7 @@ Pieza de recambio. Запасная часть. Náhradní díl. + Parte di ricambio. Amount @@ -1107,6 +1192,7 @@ Cantidad Количество Množství + Quantità Number of selected spare parts. @@ -1116,6 +1202,7 @@ Número de piezas de repuesto seleccionados. Число выбранных запасных частей. Počet vybraných náhradních dílů. + Numero di parti di ricambio selezionate. Wheel repair requirements @@ -1125,6 +1212,7 @@ Для ремонта колес требуется Requerimentos para reparo de rodas Vyžaduje opravu kol + Requisiti riparazione ruote Items required to remove/replace wheels @@ -1134,6 +1222,7 @@ Предметы, которые требуются для снятия/замены колес Itens requeridos para remover/trocar rodas Položka vyžaduje odstraněná/vyměněná kola + Oggetti richiesti per riparare/rimuovere ruote - + \ No newline at end of file diff --git a/addons/respawn/CfgEventHandlers.hpp b/addons/respawn/CfgEventHandlers.hpp index 00b6f01cea..69d602300e 100644 --- a/addons/respawn/CfgEventHandlers.hpp +++ b/addons/respawn/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/respawn/XEH_PREP.hpp b/addons/respawn/XEH_PREP.hpp new file mode 100644 index 0000000000..ab8a3c6a1f --- /dev/null +++ b/addons/respawn/XEH_PREP.hpp @@ -0,0 +1,16 @@ + +PREP(canMoveRallypoint); +PREP(handleKilled); +PREP(handlePlayerChanged); +PREP(handleRespawn); +PREP(handleInitPostServer); +PREP(initRallypoint); +PREP(module); +PREP(moduleFriendlyFire); +PREP(moduleRallypoint); +PREP(moveRallypoint); +PREP(removeBody); +PREP(restoreGear); +PREP(showFriendlyFireMessage); +PREP(teleportToRallypoint); +PREP(updateRallypoint); diff --git a/addons/respawn/XEH_preInit.sqf b/addons/respawn/XEH_preInit.sqf index eda5293876..a7feade1c3 100644 --- a/addons/respawn/XEH_preInit.sqf +++ b/addons/respawn/XEH_preInit.sqf @@ -2,20 +2,6 @@ ADDON = false; -PREP(canMoveRallypoint); -PREP(handleKilled); -PREP(handlePlayerChanged); -PREP(handleRespawn); -PREP(handleInitPostServer); -PREP(initRallypoint); -PREP(module); -PREP(moduleFriendlyFire); -PREP(moduleRallypoint); -PREP(moveRallypoint); -PREP(removeBody); -PREP(restoreGear); -PREP(showFriendlyFireMessage); -PREP(teleportToRallypoint); -PREP(updateRallypoint); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/respawn/XEH_preStart.sqf b/addons/respawn/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/respawn/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/respawn/script_component.hpp b/addons/respawn/script_component.hpp index 0ecb27b1d4..ee681d1d98 100644 --- a/addons/respawn/script_component.hpp +++ b/addons/respawn/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT respawn #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RESPAWN #define DEBUG_MODE_FULL #endif diff --git a/addons/respawn/stringtable.xml b/addons/respawn/stringtable.xml index 42bd14945f..82bc957d1c 100644 --- a/addons/respawn/stringtable.xml +++ b/addons/respawn/stringtable.xml @@ -2,16 +2,16 @@ - Deploy in 5 seconds ... - Déploiement dans 5 secondes ... - Wird in 5 Sekunden errichtet ... - Despliegue en 5 segundos ... - Возрождение через 5 секунд ... - Rozmieszczenie za 5 sekund ... + Deploy in 5 seconds... + Déploiement dans 5 secondes... + Wird in 5 Sekunden errichtet... + Despliegue en 5 segundos... + Возрождение через 5 секунд... + Rozmieszczenie za 5 sekund... Respawn za 5 sekund... - Kihelyezés 5 másodperc múlva ... - Dispiegamento in 5 secondi ... - Será posicionado em 5 segundos ... + Kihelyezés 5 másodperc múlva... + Dispiegamento in 5 secondi... + Será posicionado em 5 segundos... Rallypoint deployed @@ -155,6 +155,7 @@ Système de Respawn Respawn-rendszer Возрождение + Sistema Respawn Save Gear? @@ -166,6 +167,7 @@ Sauver l'équipement? Felszerelés elmentése? Сохранять снаряжение? + Salva Equipaggiamento? Respawn with the gear a soldier had just before his death? @@ -177,6 +179,7 @@ Conserve l'équipement au Respawn Az egység halála előtti felszerelésével való respawnolása? Возрождать солдата с тем же снаряжением, которое было на нем при смерти? + Respawna con l'equipaggiamento che il soldato aveva appena prima di morire? Remove bodies? @@ -188,6 +191,7 @@ Enlever les coprs? Holttestek eltávolítása? Удалять трупы? + Rimuovi corpi? Remove player bodies after disconnect? @@ -199,6 +203,7 @@ Enlève les corps de joueurs après déconnection Játékosi testek eltávolítása távozás után? Удалять трупы игроков после дисконнекта? + Rimuovi i corpi dei giocatori quando si disconnettono? This module enables you to configure ACE functionality specific to respawns. @@ -208,6 +213,7 @@ Este módulo permite que você personalize as configurações do renascimento (Spawn). Этот модуль позволяет настроить систему возрождения. Ce module permet de régler les options de Respawn + Questo modulo ti permette di configurare le funzionalità ACE specifiche dei respawn. Friendly Fire Messages @@ -219,6 +225,7 @@ Message de tirs fraticides Baráti tűz üzenetek Сообщения об огне по своим + Messaggi Fuoco Amico Using this module in your mission will make it so any friendly fire kills will be displayed in form of a message in chat. @@ -228,6 +235,7 @@ 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. + Usando questo modulo nella tua missione farà in modo che ogni uccisione per fuoco amico venga mostrata in forma di messaggio in chat. Rallypoint System @@ -239,6 +247,7 @@ Système de point de ralliement Gyülekezőpont-rendszer Система точек сбора + Sistema Punto di Raccolta 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. @@ -247,6 +256,7 @@ 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 Возрождения. + Questo modulo ti consente di usare Punti di Raccolta in missione, a cui ti puoi teleportare rapidamente dalla bandiera in base. Richiede il piazzamento di oggetti speciali in mappa - base e bandiera. Entrambi disponibili nella categoria Vuoto -> Respawn ACE Move Rallypoint @@ -258,6 +268,7 @@ Bouger le point de ralliement Gyülekezőpont mozgatása Двигать точку сбора + Sposta Punto di Raccolta ACE Respawn @@ -269,6 +280,7 @@ 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 0cd959a047..becf395052 100644 --- a/addons/safemode/CfgEventHandlers.hpp +++ b/addons/safemode/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/safemode/XEH_PREP.hpp b/addons/safemode/XEH_PREP.hpp new file mode 100644 index 0000000000..ab2a755a66 --- /dev/null +++ b/addons/safemode/XEH_PREP.hpp @@ -0,0 +1,5 @@ + +PREP(lockSafety); +PREP(playChangeFiremodeSound); +PREP(setSafeModeVisual); +PREP(unlockSafety); diff --git a/addons/safemode/XEH_postInit.sqf b/addons/safemode/XEH_postInit.sqf index f3ab06d20e..d9be666426 100644 --- a/addons/safemode/XEH_postInit.sqf +++ b/addons/safemode/XEH_postInit.sqf @@ -13,7 +13,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon) && {currentWeapon ACE_player != binocular ACE_player}) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon && {currentWeapon ACE_player != binocular ACE_player}) exitWith {false}; // Statement [ACE_player, currentWeapon ACE_player, currentMuzzle ACE_player] call FUNC(lockSafety); diff --git a/addons/safemode/XEH_preInit.sqf b/addons/safemode/XEH_preInit.sqf index e6eb91b8bd..a7feade1c3 100644 --- a/addons/safemode/XEH_preInit.sqf +++ b/addons/safemode/XEH_preInit.sqf @@ -2,9 +2,6 @@ ADDON = false; -PREP(lockSafety); -PREP(playChangeFiremodeSound); -PREP(setSafeModeVisual); -PREP(unlockSafety); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/safemode/XEH_preStart.sqf b/addons/safemode/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/safemode/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/safemode/functions/fnc_lockSafety.sqf b/addons/safemode/functions/fnc_lockSafety.sqf index 4d4b89759a..2675068e94 100644 --- a/addons/safemode/functions/fnc_lockSafety.sqf +++ b/addons/safemode/functions/fnc_lockSafety.sqf @@ -38,7 +38,7 @@ if (_unit getVariable [QGVAR(actionID), -1] == -1) then { _unit setVariable [QGVAR(actionID), [ _unit, "DefaultAction", { if ( - [_this select 1] call EFUNC(common,canUseWeapon) + [_this select 1] call CBA_fnc_canUseWeapon && { if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then { if (inputAction "nextWeapon" > 0) exitWith { diff --git a/addons/safemode/script_component.hpp b/addons/safemode/script_component.hpp index 04f10ed105..8afc534fa2 100644 --- a/addons/safemode/script_component.hpp +++ b/addons/safemode/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT safemode #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SAFEMODE #define DEBUG_MODE_FULL #endif diff --git a/addons/safemode/stringtable.xml b/addons/safemode/stringtable.xml index 80097580cd..a6847c17c8 100644 --- a/addons/safemode/stringtable.xml +++ b/addons/safemode/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -30,7 +30,7 @@ Waffe gesichert Seguro puesto Zabezpieczono broń - Přepnout pojistku + Zbraň zajistěna Biztonsági kapcsoló helyretolása Поставить на предохранитель Sécurité mise @@ -42,7 +42,7 @@ Waffe entsichert Seguro quitado Odbezpieczono broń - Odstranit pojistku + Zbraň odjištěna Biztonságos mód megszüntetve Снят с предохранителя Sécurité enlevée diff --git a/addons/sandbag/CfgEventHandlers.hpp b/addons/sandbag/CfgEventHandlers.hpp index da53514f3b..54701ffb3e 100644 --- a/addons/sandbag/CfgEventHandlers.hpp +++ b/addons/sandbag/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/sandbag/CfgVehicles.hpp b/addons/sandbag/CfgVehicles.hpp index a2b255318e..494ff355e7 100644 --- a/addons/sandbag/CfgVehicles.hpp +++ b/addons/sandbag/CfgVehicles.hpp @@ -42,14 +42,15 @@ class CfgVehicles { }; };*/ - class thingX; - class ACE_SandbagObject: thingX { + class ThingX; + class ACE_SandbagObject: ThingX { author = ECSTRING(common,ACETeam); XEH_ENABLED; - scope = 1; + scope = 2; side = -1; model = PATHTOF(data\ace_sandbag_build.p3d); displayName = CSTRING(sandbag_displayName); + vehicleClass = "ACE_Logistics_Items"; typicalCargo[] = {}; armor = 12000; // Withstand 200 5.56 bullets before sandbag hull is cheese mapSize = 0.4; diff --git a/addons/sandbag/XEH_PREP.hpp b/addons/sandbag/XEH_PREP.hpp new file mode 100644 index 0000000000..399655a891 --- /dev/null +++ b/addons/sandbag/XEH_PREP.hpp @@ -0,0 +1,12 @@ + +PREP(canDeploy); +PREP(deploy); +PREP(deployCancel); +PREP(deployConfirm); +PREP(handleInteractMenuOpened); +PREP(handleKilled); +PREP(handlePlayerChanged); +PREP(handlePlayerInventoryChanged); +PREP(handleScrollWheel); +PREP(handleUnconscious); +PREP(pickup); diff --git a/addons/sandbag/XEH_preInit.sqf b/addons/sandbag/XEH_preInit.sqf index 444dca7ae0..a7feade1c3 100644 --- a/addons/sandbag/XEH_preInit.sqf +++ b/addons/sandbag/XEH_preInit.sqf @@ -2,16 +2,6 @@ ADDON = false; -PREP(canDeploy); -PREP(deploy); -PREP(deployCancel); -PREP(deployConfirm); -PREP(handleInteractMenuOpened); -PREP(handleKilled); -PREP(handlePlayerChanged); -PREP(handlePlayerInventoryChanged); -PREP(handleScrollWheel); -PREP(handleUnconscious); -PREP(pickup); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/sandbag/XEH_preStart.sqf b/addons/sandbag/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/sandbag/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/sandbag/data/bag_co.paa b/addons/sandbag/data/bag_co.paa index 436b8af955..f560a18278 100644 Binary files a/addons/sandbag/data/bag_co.paa and b/addons/sandbag/data/bag_co.paa differ diff --git a/addons/sandbag/functions/fnc_deploy.sqf b/addons/sandbag/functions/fnc_deploy.sqf index de5bd9458e..1a539929ff 100644 --- a/addons/sandbag/functions/fnc_deploy.sqf +++ b/addons/sandbag/functions/fnc_deploy.sqf @@ -18,7 +18,7 @@ params ["_unit"]; // prevent the placing unit from running -[_unit, "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Sandbag", true] call EFUNC(common,statusEffect_set); // create the sandbag private "_sandBag"; diff --git a/addons/sandbag/functions/fnc_deployCancel.sqf b/addons/sandbag/functions/fnc_deployCancel.sqf index 9186ddbf57..bb9d691fa9 100644 --- a/addons/sandbag/functions/fnc_deployCancel.sqf +++ b/addons/sandbag/functions/fnc_deployCancel.sqf @@ -18,7 +18,7 @@ params ["_unit"]; // enable running again -[_unit, "ACE_Sandbag", false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Sandbag", false] call EFUNC(common,statusEffect_set); // delete placement dummy deleteVehicle GVAR(sandBag); diff --git a/addons/sandbag/functions/fnc_deployConfirm.sqf b/addons/sandbag/functions/fnc_deployConfirm.sqf index 62848dd0cd..8c789fd124 100644 --- a/addons/sandbag/functions/fnc_deployConfirm.sqf +++ b/addons/sandbag/functions/fnc_deployConfirm.sqf @@ -18,7 +18,7 @@ params ["_unit"]; // enable running again -[_unit, "ACE_Sandbag", false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Sandbag", false] call EFUNC(common,statusEffect_set); // remove sandbag from inventory _unit removeItem "ACE_Sandbag_empty"; diff --git a/addons/sandbag/script_component.hpp b/addons/sandbag/script_component.hpp index 8737beef07..422e1b203e 100644 --- a/addons/sandbag/script_component.hpp +++ b/addons/sandbag/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT sandbag #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SANDBAG #define DEBUG_MODE_FULL #endif diff --git a/addons/sandbag/stringtable.xml b/addons/sandbag/stringtable.xml index c67173466c..70db715d77 100644 --- a/addons/sandbag/stringtable.xml +++ b/addons/sandbag/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/scopes/CfgEventHandlers.hpp b/addons/scopes/CfgEventHandlers.hpp index 5c23e0c462..becf395052 100644 --- a/addons/scopes/CfgEventHandlers.hpp +++ b/addons/scopes/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -9,11 +16,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH);); - }; - }; -}; diff --git a/addons/scopes/RscTitles.hpp b/addons/scopes/RscTitles.hpp index 3b83022dcb..4452c8456c 100644 --- a/addons/scopes/RscTitles.hpp +++ b/addons/scopes/RscTitles.hpp @@ -1,5 +1,6 @@ class RscText; +class RscPicture; class RscTitles { class ACE_Scopes_Zeroing { @@ -12,8 +13,6 @@ class RscTitles { fadein = 0; fadeout = 0; name = QGVAR(Zeroing); - class RscPicture; - class RscText; class controls { class ACE_Scopes_Zeroing_BG : RscPicture { idc = 11; @@ -69,13 +68,3 @@ class RscTitles { }; }; }; - -/* -class RscInGameUI { - class RscUnitInfo; - class RscWeaponZeroing : RscUnitInfo { - onLoad = QUOTE([ARR_4('onLoad',_this,'RscUnitInfo','IGUI')] call compile preprocessfilelinenumbers 'A3\ui_f\scripts\initDisplay.sqf'; uiNamespace setVariable [ARR_2('ACE_dlgWeaponZeroing', _this select 0)]; ); - //onLoad = "[""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable ['ACE_dlgWeaponZeroing', _this select 0];"; - }; -}; -*/ diff --git a/addons/scopes/XEH_PREP.hpp b/addons/scopes/XEH_PREP.hpp new file mode 100644 index 0000000000..908d8064f0 --- /dev/null +++ b/addons/scopes/XEH_PREP.hpp @@ -0,0 +1,9 @@ + +PREP(adjustScope); +PREP(adjustZero); +PREP(applyScopeAdjustment); +PREP(canAdjustZero); +PREP(firedEH); +PREP(getOptics); +PREP(inventoryCheck); +PREP(showZeroing); diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index 41e7d53e17..8f2adeb0b7 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -136,3 +136,8 @@ if (!hasInterface) exitWith {}; }, {false}, [201, [true, true, false]], true] call CBA_fnc_addKeybind; + + +// Register fire event handler +["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); +["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); diff --git a/addons/scopes/XEH_preInit.sqf b/addons/scopes/XEH_preInit.sqf index d45f50c1bb..e33c54337d 100644 --- a/addons/scopes/XEH_preInit.sqf +++ b/addons/scopes/XEH_preInit.sqf @@ -2,14 +2,7 @@ ADDON = false; -PREP(adjustScope); -PREP(adjustZero); -PREP(applyScopeAdjustment); -PREP(canAdjustZero); -PREP(firedEH); -PREP(getOptics); -PREP(inventoryCheck); -PREP(showZeroing); +#include "XEH_PREP.hpp" GVAR(fadeScript) = scriptNull; diff --git a/addons/scopes/XEH_preStart.sqf b/addons/scopes/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/scopes/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index 42e0f17818..50ee1a4f71 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -44,7 +44,8 @@ _maxVertical = getArray (_opticConfig >> "ACE_ScopeAdjust_Vertical"); _maxHorizontal = getArray (_opticConfig >> "ACE_ScopeAdjust_Horizontal"); if ((count _maxHorizontal < 2) || (count _maxVertical < 2)) exitWith {false}; -if ((_verticalIncrement == 0) && (_horizontalIncrement == 0)) exitWith {false}; +if ((_verticalIncrement == 0) && (_turretAndDirection in [ELEVATION_UP, ELEVATION_DOWN])) exitWith {false}; +if ((_horizontalIncrement == 0) && (_turretAndDirection in [WINDAGE_UP, WINDAGE_DOWN])) exitWith {false}; _zeroing = _adjustment select _weaponIndex; _zeroing params ["_elevation", "_windage", "_zero"]; diff --git a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf index fbd3e1b636..af2f018e11 100644 --- a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf +++ b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf @@ -32,16 +32,17 @@ if (isNil "_adjustment") then { }; _adjustmentDifference = (_adjustment select _weaponIndex) vectorDiff [_elevation, _windage, _zero]; +if (_adjustmentDifference isEqualTo [0,0,0]) exitWith {false}; // Don't coninue if no adjustment is made _adjustment set [_weaponIndex, [_elevation, _windage, _zero]]; [_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); -playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3); +playSound selectRandom ["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"]; // slightly rotate the player if looking through optic if (cameraView == "GUNNER") then { // Convert adjustmentDifference from mils to degrees - _adjustmentDifference = [_adjustmentDifference, {_this * 0.05625}] call EFUNC(common,map); + _adjustmentDifference = _adjustmentDifference apply {_x * 0.05625}; _adjustmentDifference params ["_elevationDifference", "_windageDifference"]; _pitchBankYaw = [_unit] call EFUNC(common,getPitchBankYaw); _pitchBankYaw params ["_pitch", "_bank", "_yaw"]; diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index bb9c37a1af..d28c0dee7e 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -1,15 +1,9 @@ /* * Author: KoffeinFlummi, esteldunedain - * Adjusts the flight path of the bullet according to the zeroing + * Adjusts the flight path of the bullet according to the zeroing. Called from the unified fired EH only for local and non-local players on foot. * * Argument: - * 0: unit - Object the event handler is assigned to - * 1: weapon - Fired weapon - * 2: muzzle - Muzzle that was used - * 3: mode - Current mode of the fired weapon - * 4: ammo - Ammo used - * 5: magazine - magazine name which was used - * 6: projectile - Object of the projectile that was shot + * None. Parameters inherited from EFUNC(common,firedEH) * * Return value: * None @@ -18,12 +12,11 @@ */ #include "script_component.hpp" +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); + private ["_adjustment", "_weaponIndex", "_zeroing", "_adjustment"]; -params ["_unit", "", "", "", "", "", "_projectile"]; - -if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; - _adjustment = _unit getVariable [QGVAR(Adjustment), []]; if (_adjustment isEqualTo []) exitWith {}; diff --git a/addons/scopes/script_component.hpp b/addons/scopes/script_component.hpp index 5cdb74207d..0266705af2 100644 --- a/addons/scopes/script_component.hpp +++ b/addons/scopes/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT scopes #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #define ELEVATION_UP 0 #define ELEVATION_DOWN 1 #define WINDAGE_LEFT 2 diff --git a/addons/scopes/stringtable.xml b/addons/scopes/stringtable.xml index 226df258bd..beca0433c7 100644 --- a/addons/scopes/stringtable.xml +++ b/addons/scopes/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -11,7 +11,7 @@ Kleine Korrektur nach oben Enyhe állítás fel Pequeno ajuste para cima - Korekce mírně nahoru + Korekce nahoru (mírně) Minor adjustment down @@ -23,7 +23,7 @@ Kleine Korrektur nach unten Enyhe állítás le Pequeno ajuste para baixo - Korekce mírně dolů + Korekce dolů (mírně) Minor adjustment right @@ -35,7 +35,7 @@ Kleine Korrektur nach rechts Enyhe állítás jobbra Pequeno ajuste para direita - Korekce mírně doprava + Korekce doprava (mírně) Minor adjustment left @@ -47,7 +47,7 @@ Kleine Korrektur nach links Enyhe állítás balra Pequeno ajuste para esquerda - Korekce mírně doleva + Korekce doleva (mírně) Major adjustment up @@ -110,4 +110,4 @@ Vynulovat korekci - + \ No newline at end of file diff --git a/addons/sitting/CfgEventHandlers.hpp b/addons/sitting/CfgEventHandlers.hpp index 3481fa1fb5..0d7f0a3f64 100644 --- a/addons/sitting/CfgEventHandlers.hpp +++ b/addons/sitting/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/sitting/XEH_PREP.hpp b/addons/sitting/XEH_PREP.hpp new file mode 100644 index 0000000000..cb7f51cfd5 --- /dev/null +++ b/addons/sitting/XEH_PREP.hpp @@ -0,0 +1,9 @@ + +PREP(addSitActions); +PREP(canSit); +PREP(canStand); +PREP(getRandomAnimation); +PREP(handleInterrupt); +PREP(moduleInit); +PREP(sit); +PREP(stand); diff --git a/addons/sitting/XEH_preInit.sqf b/addons/sitting/XEH_preInit.sqf index 15ffe281c8..ea21067b30 100644 --- a/addons/sitting/XEH_preInit.sqf +++ b/addons/sitting/XEH_preInit.sqf @@ -2,14 +2,7 @@ ADDON = false; -PREP(addSitActions); -PREP(canSit); -PREP(canStand); -PREP(getRandomAnimation); -PREP(handleInterrupt); -PREP(moduleInit); -PREP(sit); -PREP(stand); +#include "XEH_PREP.hpp" GVAR(initializedClasses) = []; diff --git a/addons/sitting/XEH_preStart.sqf b/addons/sitting/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/sitting/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/sitting/functions/fnc_getRandomAnimation.sqf b/addons/sitting/functions/fnc_getRandomAnimation.sqf index ed49b11e92..8dfe4b8cb3 100644 --- a/addons/sitting/functions/fnc_getRandomAnimation.sqf +++ b/addons/sitting/functions/fnc_getRandomAnimation.sqf @@ -15,8 +15,8 @@ */ #include "script_component.hpp" -// Animations Pool -private _animations = [ +// Select random animation from Animations Pool +selectRandom [ QGVAR(HubSittingChairA_idle1), QGVAR(HubSittingChairA_idle2), QGVAR(HubSittingChairA_idle3), @@ -41,7 +41,4 @@ private _animations = [ QGVAR(HubSittingChairUC_idle2), QGVAR(HubSittingChairUC_idle3), QGVAR(HubSittingChairUC_move1) -]; - -// Select random animation -(_animations select (floor (random (count _animations)))) +] diff --git a/addons/sitting/script_component.hpp b/addons/sitting/script_component.hpp index cbc8800cd2..40afbe8450 100644 --- a/addons/sitting/script_component.hpp +++ b/addons/sitting/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT sitting #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SITTING #define DEBUG_MODE_FULL #endif diff --git a/addons/sitting/stringtable.xml b/addons/sitting/stringtable.xml index 3dd6c3ef46..ef1366dff6 100644 --- a/addons/sitting/stringtable.xml +++ b/addons/sitting/stringtable.xml @@ -11,6 +11,7 @@ S'assoir Leülés Сесть + Siediti Stand Up @@ -22,6 +23,7 @@ Se lever Felállás Встать + Alzati Enable Sitting @@ -33,6 +35,7 @@ Permettre de s'assoir Ülés engedélyezése Разрешить сидение + Abilita seduta Sitting @@ -44,6 +47,7 @@ S'assoir Ülés Сидение + Sedersi This module allows you to disable the ability to sit on chairs. @@ -55,6 +59,7 @@ 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. Этот модуль позволяет вам запретить возможность садиться на стулья и туалеты. + Questo modulo ti permette di disabilitare la possibilità di sederti sulle sedie. - + \ No newline at end of file diff --git a/addons/slideshow/CfgEventHandlers.hpp b/addons/slideshow/CfgEventHandlers.hpp index b928bc2de6..be284a9d70 100644 --- a/addons/slideshow/CfgEventHandlers.hpp +++ b/addons/slideshow/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/slideshow/XEH_PREP.hpp b/addons/slideshow/XEH_PREP.hpp new file mode 100644 index 0000000000..ca31404b53 --- /dev/null +++ b/addons/slideshow/XEH_PREP.hpp @@ -0,0 +1,5 @@ + +PREP(addSlideActions); +PREP(autoTransition); +PREP(createSlideshow); +PREP(moduleInit); diff --git a/addons/slideshow/XEH_preInit.sqf b/addons/slideshow/XEH_preInit.sqf index 152c02ec77..8943a367f8 100644 --- a/addons/slideshow/XEH_preInit.sqf +++ b/addons/slideshow/XEH_preInit.sqf @@ -2,10 +2,7 @@ ADDON = false; -PREP(addSlideActions); -PREP(autoTransition); -PREP(createSlideshow); -PREP(moduleInit); +#include "XEH_PREP.hpp" GVAR(slideshows) = 0; diff --git a/addons/slideshow/XEH_preStart.sqf b/addons/slideshow/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/slideshow/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/slideshow/script_component.hpp b/addons/slideshow/script_component.hpp index 3acd23c0ee..cf4272325d 100644 --- a/addons/slideshow/script_component.hpp +++ b/addons/slideshow/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT slideshow #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SLIDESHOW #define DEBUG_MODE_FULL #endif diff --git a/addons/slideshow/stringtable.xml b/addons/slideshow/stringtable.xml index 599802c3c9..fce9c2d618 100644 --- a/addons/slideshow/stringtable.xml +++ b/addons/slideshow/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -11,6 +11,7 @@ Слайд-шоу Prezentace Presentación de diapositivas + Mostra Diapositive This module allows you to set up slide-shows on different objects. One module per image list. Only objects with hiddenSelection 0 are supported. @@ -21,6 +22,8 @@ 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. + Tento modul umožňuje nastavit prezentaci na různé objekty. Jeden modul na seznam s obrázky. Podporované jsou pouze objekty s hiddenSelection 0. + Questo modulo ti permette di creare una presentazione con diapositive su vari oggetti. Un modulo per lista immagini. Solo oggetti con hiddenSelection 0 sono supportati. Objects @@ -32,6 +35,7 @@ Объекты Objekty Objetos + Oggetti Object names (can also be synchronized objects) slide-show will be displayed on, separated by commas if multiple. Reference INFO for object support. @@ -42,6 +46,8 @@ 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. + Jména objektů (lze také použít synchronizované objekty) které se budou zobrazovat v prezentaci, oddělit čárkou pokud jich je více. Zkontrolujte POPIS abyste zjistili, zda je objekt podporován modulem. + Nomi di oggetti (possono anche essere oggetti sincronizzati) che verranno usati per la presentazione di diapositive, separato da virgole se più di uno. Fai riferimento ad INFO per gli oggetti supportati. Controllers @@ -52,6 +58,8 @@ Controles Контроллеры Controladores + Kontrolor + Controllori Controller object names, separated by commas if multiple. @@ -62,6 +70,7 @@ Nome dos objetos de controle, separado por vírgula se mais de um. Имена объектов-контроллеров, разделенные запятыми. Nombres de objeto de controlador, separados por comas. + Nomi di oggetti controllori, separati da virgole se multipli. Images @@ -73,6 +82,7 @@ Изображения Obrázky Imágenes + Immagini List of images that will be used for the slide-show, separated by commas, with full path correctly formatted (eg. images\image.paa). @@ -83,6 +93,8 @@ 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). + Seznam obrázků které budou použity v prezentaci, oddělené čárkami, s kompletní cestou ve správném formátu (např. image\image.paa). + Lista di immagini che verranno usate durante la presentazione, separati da virgole, con il formato completo del percorso (es. images\image.paa) Interaction Names @@ -91,8 +103,9 @@ Interakciós nevek Nomes de Interação Интерактивные имена - Názvy Interakcí + Názvy interakcí Nombres de interacción + Nomi Interazioni List of names that will be used for interaction entries, separated by commas, in order of images. @@ -102,6 +115,7 @@ 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. + Lista di nomi che verranno usati per per le interazioni, separati da virgole, in ordine per immagini. Slide Duration @@ -112,6 +126,7 @@ Длительность слайда Duración de diapositiva Doba trvání snímku + Durata Diapositiva Duration of each slide. Default: 0 (Automatic Transitions Disabled) @@ -121,6 +136,8 @@ 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) + Doba trvání každého snímku. Výchozí: 0 (Automatické posouvání je zakázáno) + Durata di ogni diapositiva. Default: 0 (Transizioni Automatiche Disabilitate) Slides @@ -131,6 +148,7 @@ Слайды Diapositivas Snímky + Diapositive \ No newline at end of file diff --git a/addons/smallarms/script_component.hpp b/addons/smallarms/script_component.hpp index 589e59433f..63d516cee5 100644 --- a/addons/smallarms/script_component.hpp +++ b/addons/smallarms/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT smallarms #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SMALLARMS #define DEBUG_MODE_FULL #endif diff --git a/addons/spectator/CfgEventHandlers.hpp b/addons/spectator/CfgEventHandlers.hpp index e75956f440..becf395052 100644 --- a/addons/spectator/CfgEventHandlers.hpp +++ b/addons/spectator/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/spectator/XEH_PREP.hpp b/addons/spectator/XEH_PREP.hpp new file mode 100644 index 0000000000..cc29fde611 --- /dev/null +++ b/addons/spectator/XEH_PREP.hpp @@ -0,0 +1,23 @@ + +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); diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf index a9737868a0..4b1f653223 100644 --- a/addons/spectator/XEH_postInit.sqf +++ b/addons/spectator/XEH_postInit.sqf @@ -9,5 +9,11 @@ GVAR(availableVisions) = [[-2,-1,0,1], [-2,-1], [-2,0,1], [-2]] select GVAR(restrictVisions); }] call EFUNC(common,addEventHandler); +// Create a radio channel for any spectators to text chat in +if (isServer) then { + GVAR(channel) = radioChannelCreate [[0.729,0.149,0.098,1],"Spectator","Spectator (%UNIT_NAME)",[]]; + publicVariable QGVAR(channel); +}; + // Should prevent unending spectator on mission end -addMissionEventHandler ["Ended",{ [false] call FUNC(setSpectator) }]; +addMissionEventHandler ["Ended",{ [QGVAR(EndMission)] call FUNC(interrupt) }]; diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 13f2ba1708..bdf0c72bd4 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -2,28 +2,10 @@ 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); +#include "XEH_PREP.hpp" + +// Reset the stored display +SETUVAR(GVAR(interface),displayNull); // Permanent variables GVAR(availableModes) = [0,1,2]; diff --git a/addons/spectator/XEH_preStart.sqf b/addons/spectator/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/spectator/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index ee71685fa2..a8a607d537 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -22,6 +22,7 @@ params ["_mode",["_args",[]]]; switch (toLower _mode) do { case "onload": { _args params ["_display"]; + SETUVAR(GVAR(interface),_display); // Always show interface and hide map upon opening [_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface); @@ -172,9 +173,12 @@ switch (toLower _mode) do { [QGVAR(zeus)] call FUNC(interrupt); ["zeus"] call FUNC(handleInterface); }; - if ((isServer || {serverCommandAvailable "#kick"}) && {_dik in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) exitWith { + if (_dik in (actionKeys "Chat")) exitWith { false }; + if (_dik in (actionKeys "PrevChannel" + actionKeys "NextChannel")) exitWith { + !(isServer || serverCommandAvailable "#kick") + }; // Handle held keys (prevent repeat calling) if (GVAR(heldKeys) param [_dik,false]) exitWith {}; @@ -451,13 +455,13 @@ switch (toLower _mode) do { // PFH to re-open display when menu closes [{ - if !(isNull (findDisplay 49)) exitWith {}; + if !(isNull (_this select 0)) 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; + },0,_dlg] call CBA_fnc_addPerFrameHandler; }; case "zeus": { openCuratorInterface; diff --git a/addons/spectator/functions/fnc_interrupt.sqf b/addons/spectator/functions/fnc_interrupt.sqf index 72bb3eaa32..0826949b30 100644 --- a/addons/spectator/functions/fnc_interrupt.sqf +++ b/addons/spectator/functions/fnc_interrupt.sqf @@ -29,16 +29,16 @@ if (_interrupt) then { }; if (GVAR(interrupts) isEqualTo []) then { - if (isNull (findDisplay 12249)) then { - createDialog QGVAR(interface); + if (isNull (GETUVAR(GVAR(interface),displayNull))) then { + (findDisplay 46) createDisplay QGVAR(interface); [] call FUNC(transitionCamera); }; } else { - if !(isNull (findDisplay 12249)) then { + if !(isNull (GETUVAR(GVAR(interface),displayNull))) then { while {dialog} do { closeDialog 0; }; - (findDisplay 12249) closeDisplay 0; + (GETUVAR(GVAR(interface),displayNull)) closeDisplay 0; }; }; diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index d8a0219110..ce9428cea4 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -24,7 +24,7 @@ params [["_set",true,[true]], ["_force",true,[true]]]; // Only clients can be spectators -if (!hasInterface) exitWith {}; +if !(hasInterface) exitWith {}; // Exit if no change if (_set isEqualTo GVAR(isSet)) exitWith {}; @@ -63,9 +63,17 @@ if (_set) then { GVAR(unitCamera) camCommit 0; [] call FUNC(transitionCamera); - // Close map and clear radio + // Cache current channel to switch back to on exit + GVAR(channelCache) = currentChannel; + + // Channel index starts count after the 5 default channels + GVAR(channel) radioChannelAdd [player]; + setCurrentChannel (5 + GVAR(channel)); + + // Close map and clear the chat openMap [false,false]; clearRadio; + enableRadio false; // Disable BI damage effects BIS_fnc_feedback_allowPP = false; @@ -76,12 +84,13 @@ if (_set) then { }; [{ + disableSerialization; // Create the display - (findDisplay 46) createDisplay QGVAR(interface); + _display = (findDisplay 46) createDisplay QGVAR(interface); // If not forced, make esc end spectator if (_this) then { - (findDisplay 12249) displayAddEventHandler ["KeyDown", { + _display displayAddEventHandler ["KeyDown", { if (_this select 1 == 1) then { [false] call ace_spectator_fnc_setSpectator; true @@ -103,7 +112,7 @@ if (_set) then { }; // Kill the display - (findDisplay 12249) closeDisplay 0; + (GETUVAR(GVAR(interface),displayNull)) closeDisplay 0; // Terminate camera GVAR(freeCamera) cameraEffect ["terminate", "back"]; @@ -111,7 +120,16 @@ if (_set) then { camDestroy GVAR(unitCamera); camDestroy GVAR(targetCamera); + // Remove from spectator chat + GVAR(channel) radioChannelRemove [player]; + + // Restore cached channel and delete cache + setCurrentChannel GVAR(channelCache); + GVAR(channelCache) = nil; + + // Clear any residual spectator chat clearRadio; + enableRadio true; // Return to player view player switchCamera "internal"; @@ -130,7 +148,6 @@ if (_set) then { //Kill these PFEH handlers now because the PFEH can run before the `onunload` event is handled GVAR(camHandler) = nil; GVAR(compHandler) = nil; - GVAR(iconHandler) = nil; GVAR(toolHandler) = nil; // Cleanup display variables diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf index 87b2faffa8..926ac008dc 100644 --- a/addons/spectator/functions/fnc_stageSpectator.sqf +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -66,3 +66,13 @@ if !(_set isEqualTo (GETVAR(_unit,GVAR(isStaged),false))) then { ["spectatorStaged",[_set]] call EFUNC(common,localEvent); }; + +//BandAid for #2677 - if player in unitList weird before being staged, weird things can happen +if ((player in GVAR(unitList)) || {ACE_player in GVAR(unitList)}) then { + [] call FUNC(updateUnits); //update list now + if (!(isNull (findDisplay 12249))) then {//If display is open now, close it and restart + ACE_LOGWARNING("Player in unitList, call ace_spectator_fnc_stageSpectator before ace_spectator_fnc_setSpectator"); + ["fixWeirdList", true] call FUNC(interrupt); + [{["fixWeirdList", false] call FUNC(interrupt);}, []] call EFUNC(common,execNextFrame); + }; +}; diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index 0f6eb3ffc7..254dfef131 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -61,13 +61,12 @@ if (_newMode == 0) then { // Free }; GVAR(camAgent) switchCamera "internal"; - clearRadio; } else { _camera = GVAR(unitCamera); // When null unit is given choose random if (isNull _newUnit) then { - _newUnit = GVAR(unitList) select floor(random(count GVAR(unitList))); + _newUnit = selectRandom GVAR(unitList); }; // Switch camera view to internal unit view (external uses the camera) @@ -87,11 +86,6 @@ if (_newMode == 0) then { // Free _camera cameraEffect ["internal", "back"]; }; - // Clear radio if group changed - if (group _newUnit != group GVAR(camUnit)) then { - clearRadio; - }; - GVAR(camUnit) = _newUnit; }; diff --git a/addons/spectator/script_component.hpp b/addons/spectator/script_component.hpp index de2ee22363..575765a01d 100644 --- a/addons/spectator/script_component.hpp +++ b/addons/spectator/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT spectator #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SPECTATOR #define DEBUG_MODE_FULL #endif diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index bca0e36c59..2db602f145 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -1,518 +1,633 @@ - + Spectator Settings + Zuschauer Einstellungen Ustawienia obserwatora Preferências de Espectador Настройки спектатора Nastavení pozorovatele Ajustes de espectador + Impostazioni Spettatore Configure how the spectator system will operate by default. + Konfiguriert den Zuschauermodus 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. Konfigurovat výchozí nastavení pozorovatele + Configura come il sistema spettatore si comporterà di default. Unit filter + Einheitenfilter Filtr jednostek Filtro de unidades Фильтр юнитов Filtr jednotek Filtro de unidad + Filtro Unità Method of filtering spectatable units. + Einheiten denen zugeschaut werden kann. 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 Metoda filtrování pozorovaných jednotek. + Metodo di filtraggio delle unità osservabili. No units + Keine Einheiten Brak jednostek Sem unidades Никто Žádné jednotky Ninguna + Nessuna unità Only players + Nur Spieler Tylko gracze Somente jogadores Только игроки Pouze hráči Solo jugadores + Solo giocatori Playable Units + Nur spielbare Einheiten Grywalne jednostki Unidades jogáveis Играбельные юниты Hratelné jednotky Unidades jugables + Unità giocabili All units + Alle Einheiten Wszystkie jednostki Todas unidades Все юниты Všechny jednotky Todas las unidades + Tutte le unità Side filter + Fraktionenfilter Filtr stron Filtro de lados Фильтр стороны Filtr stran Filtro de bando + Filtro Lato Method of filtering spectatable sides. + Fraktionen denen zugeschaut werden kann. 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 Metoda filtrování pozorovaných stran. + Metodo per filtrare i lati osservabili. Player side + Spielerseite Strona gracza Lado do jogador Сторона игрока Strana hráče Bando del jugador + Lato giocatore Friendly sides + Verbündete Strony sojusznicze Lados aliados Дружественные стороны Strana spojenců Bandos amigos + Lati alleati Hostile sides + Feinde Strony wrogie Lados hostis Враждебные стороны Strana nepřítele Bandos enemigos + Lati nemici All sides + Alle Fraktionen Wszystkie strony Todos os lados Все стороны Všechny strany Todos los bandos + Tutti i lati Camera modes + Kameramodus Tryby kamery Modos de camera Режимы камеры Módy kamery Modos de cámara + Modalità camera Camera modes that can be used. + Verwendbare Kameramodi Tryby kamery, jakie mogą być używane. Modos de camera que podem ser utilizados Режимы камеры, которые могут быть использованы Modos de la cámara que se pueden utilizar. Módy kamery které mohou být použity. + Modalità che la camera può utilizzare. All + Alle Wszystkie Todos Все Všechny Todos + Tutte Free only + Nur freie Kamera Tylko wolna Somente livre Только свободная Pouze volná Solo libre + Solo libera Internal only - Tylko wewnętrzna - Somente interna - Только внутренняя - Pouze vnitřní - Solo interna - + Erste Person //Bitte überprüfen! + Tylko wewnętrznaSomente internaТолько внутренняяPouze pohled z první osobySolo internaSolo interna External only - Tylko zewnętrzna - Somente externa - Только внешняя - Pouze vnější - Solo externa - + Dritte Person //Bitte überpfüfen! + Tylko zewnętrznaSomente externaТолько внешняяPouze pohled z třetí osobySolo externaSolo esterna Internal and external + Erste und dritte Person Wewnętrzna i zewnętrzna Interna e externa Внутренняя и внешняя - Vnitřní a vnější + Pohled z první a třetí osoby Interna y externa + Interna ed Esterna Vision modes + Sichtmodi Tryby wizji Modos de visão Режимы видения Modos de visión + Módy zobrazení + Modalità visuali Vision modes that can be used. + Sichtmodi die verwendet werden können. Tryby wizji, jakie mogą być używane. Modos de visão que podem ser utilizados Режимы видения, которые могут быть использованы Modos de visión que pueden ser utilizados. + Módy zobrazení které mohou být použity. + Modalità visuali che possono essere usate. Night vision + Nachtsicht Noktowizja Visão noturna Ночное видение Noktovize Visión nocturna + Visione Notturna Thermal imaging + Wärmebild Termowizja Visão térmica Тепловизионное Termovize Imagen térmica + Visione Termica Spectator Units + Zuschauereinheiten Jednostki obserwatora Unidades espectadoras Юниты Unidades espectador Jednotky pozorovatele + Unità Osservabili Spectator Controls + Zuschauersteuerung Sterowanie obserwatorem Controle do espectador Управление спектатором Controles de espectador - Ovládací prvky pozorovatele + Ovládání pozorovatele + Controlli Osservatore Free + Frei Wolna Livre Свободная Volná Libre + Libera Internal - Wewnętrzna - Interna - Внутренняя - Vnitřní - Interna - + Erste Person //Bitte überprüfen! + WewnętrznaInternaВнутренняяPohled z první osobyInternaInterna External - Zewnętrzna - Externa - Внешняя - Vnější - Externa - + Dritte Person //Bitte überprüfen! + ZewnętrznaExternaВнешняяPohled z třetí osobyExternaEsterna Normal + Normal Normalna Normal Нормальное Normální Normal + Normale Night + Nacht Noc Visão Norturna Ночное Noc Nocturna + Notturno Thermal + Wärme Termo Térmica Тепловизор Termál Térmica + Termico Free Camera + Freie Kamera Kamera swobodna Câmera livre Свободная камера Volná Kamera Cámara libre + Camera Libera Camera Forward + Kamera vor Kamera naprzód Câmera para frente Камера вперед - Kamera Vpřed + Vpřed (Kamera) Cámara delantera + Camera Avanti Camera Backward + Kamera zurück Kamera w tył Câmera para trás Камера назад - Kamera Zpět + Zpět (Kamera) Cámara trasera + Camera Indietro Camera Left + Kamera links Kamera w lewo Câmera para esquerda Камера влево - Kamera Doleva + Doleva (Kamera) Cámara izquierda + Camera Sinistra Camera Right + Kamera rechts Kamera w prawo Câmera para direita Камера вправо - Kamera Doprava + Doprava (Kamera) Cámara derecha + Camera Destra Camera Up + Kamera hoch Kamera w górę Câmera para cima Камера вверх - Kamera Nahoru + Nahoru (Kamera) Cámara arriba + Camera Su Camera Down + Kamera runter Kamera w dół Câmera para baixo Камера вниз - Kamera Dolů + Dolů (Kamera) Cámara abajo + Camera Giù Pan Camera + Kamera mitschwenken Panoramowanie Câmera panorâmica Панорамирование Cámara panorámica + Otáčet kameru + Camera Panoramica Dolly Camera + Kamerafahrt Płynna kamera Câmera dolly Рельсовая камера Cámara dolly + Posouvat kameru + Camera dolly Lock Camera to Target + Kamera Ziel verfolgen Zablokuj kamerę na celu Travar câmera em alvo Зафиксировать камеру на цели Zamknout kameru na Cíl Fijar cámara al objetivo + Blocca la camera su obbiettivo Speed Boost + Geschwindigkeitserhöhung Przyśpieszenie kamery Aumento de velocidade Ускорение камеры Aumento de velocidad Zrychlení kamery + Aumento Velocità Interface + Nuteroberfläche Interfejs Interface Интерфейс Rozhraní Interfaz + Interfaccia Toggle Interface + Nutzeroberfläche umschalten Przełącz interfejs Alternar interface Переключить интерфейс - Přepnout rozhraní + Zobrazit/skrýt rozhraní Conmutar + Apri Interfaccia Toggle Unit Icons + Einheitensymbole umschalten Przełącz ikony jednostek Alternar ícone de unidades Вкл./выкл. иконки юнитов - Přepnout ikony jednotek + Zobrazit/skrýt ikony jednotek Conmutar iconos de unidad + Apri Icone Unità Toggle Unit List + Einheitenliste umschalten Przełącz listę jednostek Alternar lista de unidades Вкл./выкл. список юнитов - Přepnout seznam jednotek + Zobrazit/skrýt seznam jednotek Conmutar lista de unidades + Apri Lista Unità Toggle Toolbar + Werkzeuge umschalten Przełącz pasek narzędzi Alternar barra de ferramentas Вкл./выкл. тулбар Conmutar barra de herramientas - Přepnout panel nátrojů + Zobrazit/skrýt spodní panel + Apri Barra degli Strumenti Toggle Compass + Kompass umschalten Przełącz kompas Alternar bússola Вкл./выкл. компас - Přepnout kompas + Zobrazit/skrýt kompas Conmutar brújula + Apri Bussola Toggle Map + Karte umschalten Przełącz mapę Alternar mapa Вкл./выкл. карту - Přepnout mapu + Zobrazit/skrýt mapu Conmutar map + Apri Mappa Toggle Help + Hilfe umschalten Przełącz pomoc Alternar ajuda Вкл./выкл. помощь - Přepnout nápovědu + Zobrazit/skrýt ovládání Conmutar ayuda + Apri Aiuti Camera Attributes + Kameraeigenschaften Atrybuty kamery Atributos de câmera Атрибуты камеры Atributos de cámara + Atributy kamery + Attributi Camera Next Camera + Nächste Kamera Następna kamera Próxima câmera Следующая камера Následující kamera Siguiente cámara + Prossima Camera Previous Camera + Vorherige Kamera Poprzednia kamera Câmera anterior Предыдущая камера Předchozí kamera Anterior cámara + Precedente Camera Next Unit + Nächste Einheit Następna jednostka Próxima unidade Следующий юнит Následující jednotka Siguiente unidad + Prossima Unità Previous Unit + Vorherige Einheit Poprzednia jednostka Unidade anterior Предыдущий юнит Předchozí jednotka Anterior unidad + Precedente Unità Next Vision Mode + Nächster Sichtmodus Następny tryb wizji Próximo modo de visão Следующий режим видения Siguiente modo de visión + Následující mód zobrazení + Prossima Modalità Visiva Previous Vision Mode + Vorheriger Sichtmodus Poprzedni tryb wizji Modo de visão anterior Предыдущий режим видения Anterior modo de visión + Předchozí mód zobrazení + Precedente Modalità Visiva Adjust Zoom + Vergrößerung einstellen Reguluj zoom Ajustar zoom Настроить зум Regulovat přiblížení Ajustar aumento + Aggiusta Zoom Adjust Speed + Geschwindigkeit einstellen Reguluj prędkość Ajuster velocidade Настроить скорость Regulovat rychlost Ajustar velocidad + Aggiusta Velocità Increment Zoom + Vergrößern Reguluj zoom (krok) Incrementar zoom Увеличить зум Incrementar aumento + Regulovat přiblížení (pomalu) + Aumenta Zoom Increment Speed + Geschwindkeit erhöhen Reguluj prędkość (krok) Incrementar velocidade Увеличить скорость Incrementar velocidad + Regulovat rychlost (pomalu) + Aumenta Velocità Reset Zoom + Vergrößerung zurücksetzen Resetuj zoom Redefinir zoom Сбросить зум Obnovit přiblížení Reiniciar aumento + Resetta Zoom Reset Speed + Geschwindigkeit zurücksetzen Resetuj prędkość Redefinir velocidade Сбросить скорость Obnovit rychlost Reiniciar velocidad + Resetta Velocità - + \ No newline at end of file diff --git a/addons/spottingscope/CfgEventHandlers.hpp b/addons/spottingscope/CfgEventHandlers.hpp index 81b3aef30e..13d369b097 100644 --- a/addons/spottingscope/CfgEventHandlers.hpp +++ b/addons/spottingscope/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/spottingscope/XEH_PREP.hpp b/addons/spottingscope/XEH_PREP.hpp new file mode 100644 index 0000000000..ebb99df96b --- /dev/null +++ b/addons/spottingscope/XEH_PREP.hpp @@ -0,0 +1,3 @@ + +PREP(pickup); +PREP(place); diff --git a/addons/spottingscope/XEH_preInit.sqf b/addons/spottingscope/XEH_preInit.sqf index 306884e595..a7feade1c3 100644 --- a/addons/spottingscope/XEH_preInit.sqf +++ b/addons/spottingscope/XEH_preInit.sqf @@ -2,7 +2,6 @@ ADDON = false; -PREP(pickup); -PREP(place); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/spottingscope/XEH_preStart.sqf b/addons/spottingscope/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/spottingscope/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/spottingscope/script_component.hpp b/addons/spottingscope/script_component.hpp index 11bd94a6e5..48f14b7398 100644 --- a/addons/spottingscope/script_component.hpp +++ b/addons/spottingscope/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT spottingscope #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SPOTTINGSCOPE #define DEBUG_MODE_FULL #endif diff --git a/addons/spottingscope/stringtable.xml b/addons/spottingscope/stringtable.xml index e20f0635ea..a562e31c8c 100644 --- a/addons/spottingscope/stringtable.xml +++ b/addons/spottingscope/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -8,7 +8,7 @@ Teleskop Telescopio Téléscope de visée - Zaměřovací Dalekohled + Zaměřovací dalekohled Spotting Scope Megfigyelő távcső Luneta de observador @@ -20,7 +20,7 @@ Zabierz teleskop Coger telescopio Prendre téléscope de visée - Zvednout Zaměřovací dalekohled + Zvednout zaměřovací dalekohled Raccogli spottingscope Mefgigy. távcső felvétele Pegar luneta de observador @@ -32,7 +32,7 @@ Ustaw teleskop Colocar telescopio Placer téléscope de visée - Položit Zaměřovací dalekohled + Položit zaměřovací dalekohled Posiziona spottingscope Megfigy. távcső elhelyezése Colocar luneta de observador diff --git a/addons/switchunits/CfgEventHandlers.hpp b/addons/switchunits/CfgEventHandlers.hpp index 44b6e8e6ff..5da5fd0dc2 100644 --- a/addons/switchunits/CfgEventHandlers.hpp +++ b/addons/switchunits/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/switchunits/CfgVehicles.hpp b/addons/switchunits/CfgVehicles.hpp index 7951a6cd59..f0549cb00e 100644 --- a/addons/switchunits/CfgVehicles.hpp +++ b/addons/switchunits/CfgVehicles.hpp @@ -1,53 +1,53 @@ class CfgVehicles { - class ACE_Module; - class ACE_ModuleSwitchUnits: ACE_Module { - author = ECSTRING(common,ACETeam); - category = "ACE"; - displayName = CSTRING(Module_DisplayName); - function = FUNC(module); - scope = 2; - isGlobal = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_SwitchUnits_ca.paa)); - class Arguments { - class SwitchToWest { - displayName = CSTRING(SwitchToWest_DisplayName); - description = CSTRING(SwitchToWest_Description); - typeName = "BOOL"; - defaultValue = 0; - }; - class SwitchToEast { - displayName = CSTRING(SwitchToEast_DisplayName); - description = CSTRING(SwitchToEast_Description); - typeName = "BOOL"; - defaultValue = 0; - }; - class SwitchToIndependent { - displayName = CSTRING(SwitchToIndependent_DisplayName); - description = CSTRING(SwitchToIndependent_Description); - typeName = "BOOL"; - defaultValue = 0; - }; - class SwitchToCivilian { - displayName = CSTRING(SwitchToCivilian_DisplayName); - description = CSTRING(SwitchToCivilian_Description); - typeName = "BOOL"; - defaultValue = 0; - }; - class EnableSafeZone { - displayName = CSTRING(EnableSafeZone_DisplayName); - description = CSTRING(EnableSafeZone_Description); - typeName = "BOOL"; - defaultValue = 1; - }; - class SafeZoneRadius { - displayName = CSTRING(SafeZoneRadius_DisplayName); - description = CSTRING(SafeZoneRadius_Description); - typeName = "NUMBER"; - defaultValue = 100; - }; + class ACE_Module; + class ACE_ModuleSwitchUnits: ACE_Module { + author = ECSTRING(common,ACETeam); + category = "ACE"; + displayName = CSTRING(Module_DisplayName); + function = FUNC(module); + scope = 2; + isGlobal = 1; + icon = QUOTE(PATHTOF(UI\Icon_Module_SwitchUnits_ca.paa)); + class Arguments { + class SwitchToWest { + displayName = CSTRING(SwitchToWest_DisplayName); + description = CSTRING(SwitchToWest_Description); + typeName = "BOOL"; + defaultValue = 0; + }; + class SwitchToEast { + displayName = CSTRING(SwitchToEast_DisplayName); + description = CSTRING(SwitchToEast_Description); + typeName = "BOOL"; + defaultValue = 0; + }; + class SwitchToIndependent { + displayName = CSTRING(SwitchToIndependent_DisplayName); + description = CSTRING(SwitchToIndependent_Description); + typeName = "BOOL"; + defaultValue = 0; + }; + class SwitchToCivilian { + displayName = CSTRING(SwitchToCivilian_DisplayName); + description = CSTRING(SwitchToCivilian_Description); + typeName = "BOOL"; + defaultValue = 0; + }; + class EnableSafeZone { + displayName = CSTRING(EnableSafeZone_DisplayName); + description = CSTRING(EnableSafeZone_Description); + typeName = "BOOL"; + defaultValue = 1; + }; + class SafeZoneRadius { + displayName = CSTRING(SafeZoneRadius_DisplayName); + description = CSTRING(SafeZoneRadius_Description); + typeName = "NUMBER"; + defaultValue = 100; + }; + }; + class ModuleDescription { + description = CSTRING(Module_Description); + }; }; - class ModuleDescription { - description = CSTRING(Module_Description); - }; - }; }; diff --git a/addons/switchunits/XEH_PREP.hpp b/addons/switchunits/XEH_PREP.hpp new file mode 100644 index 0000000000..d9151223c0 --- /dev/null +++ b/addons/switchunits/XEH_PREP.hpp @@ -0,0 +1,11 @@ + +PREP(addMapFunction); +PREP(handleMapClick); +PREP(initPlayer); +PREP(isValidAi); +PREP(markAiOnMap); +PREP(module); +PREP(nearestPlayers); +PREP(startSwitchUnits); +PREP(switchBack); +PREP(switchUnit); diff --git a/addons/switchunits/XEH_preInit.sqf b/addons/switchunits/XEH_preInit.sqf index c120608357..a7feade1c3 100644 --- a/addons/switchunits/XEH_preInit.sqf +++ b/addons/switchunits/XEH_preInit.sqf @@ -2,15 +2,6 @@ ADDON = false; -PREP(addMapFunction); -PREP(handleMapClick); -PREP(initPlayer); -PREP(isValidAi); -PREP(markAiOnMap); -PREP(module); -PREP(nearestPlayers); -PREP(startSwitchUnits); -PREP(switchBack); -PREP(switchUnit); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/switchunits/XEH_preStart.sqf b/addons/switchunits/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/switchunits/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/switchunits/config.cpp b/addons/switchunits/config.cpp index 3b1d11f460..22a4924709 100644 --- a/addons/switchunits/config.cpp +++ b/addons/switchunits/config.cpp @@ -1,15 +1,15 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"bux578"}; - authorUrl = "https://github.com/bux578/"; - VERSION_CONFIG; - }; + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"bux578"}; + authorUrl = "https://github.com/bux578/"; + VERSION_CONFIG; + }; }; #include "CfgEventHandlers.hpp" diff --git a/addons/switchunits/functions/fnc_handleMapClick.sqf b/addons/switchunits/functions/fnc_handleMapClick.sqf index 03a94f81af..b0984631d7 100644 --- a/addons/switchunits/functions/fnc_handleMapClick.sqf +++ b/addons/switchunits/functions/fnc_handleMapClick.sqf @@ -18,12 +18,10 @@ */ #include "script_component.hpp" -private ["_sideNearest"]; - params ["_faction", "_pos"]; _faction params ["", "_sides"]; -_sideNearest = []; +private _sideNearest = []; { if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then { diff --git a/addons/switchunits/functions/fnc_initPlayer.sqf b/addons/switchunits/functions/fnc_initPlayer.sqf index 80388a9d2b..7b0c8f2603 100644 --- a/addons/switchunits/functions/fnc_initPlayer.sqf +++ b/addons/switchunits/functions/fnc_initPlayer.sqf @@ -21,7 +21,7 @@ params ["_playerUnit", "_sides"]; if (vehicle _playerUnit == _playerUnit) then { [_sides] call FUNC(markAiOnMap); - _playerUnit setVariable [QGVAR(IsPlayerUnit), true]; + _playerUnit setVariable [QGVAR(IsPlayerUnit), true, true]; _playerUnit allowDamage false; GVAR(OriginalUnit) = _playerUnit; @@ -39,7 +39,7 @@ if (vehicle _playerUnit == _playerUnit) then { _playerUnit linkItem "ItemMap"; removeUniform _playerUnit; - [_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus); + [_playerUnit, "forceWalk", "ACE_SwitchUnits", true] call EFUNC(common,statusEffect_set); [_playerUnit, _sides] call FUNC(addMapFunction); }; diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index db43c58f43..d29e75b6a4 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -37,18 +37,17 @@ GVAR(AllMarkerNames) = []; // create markers { if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then { - private ["_markerName", "_marker", "_markerColor"]; + + private _markerName = str _x; - _markerName = str _x; - - _marker = createMarkerLocal [_markerName, position _x]; + private _marker = createMarkerLocal [_markerName, position _x]; _markerName setMarkerTypeLocal "mil_triangle"; _markerName setMarkerShapeLocal "ICON"; _markerName setMarkerSizeLocal [0.5, 0.7]; _markerName setMarkerDirLocal getDir _x; // commy's one liner magic - _markerColor = format ["Color%1", side group _x]; + private _markerColor = format ["Color%1", side group _x]; if ((_x getVariable [QGVAR(IsPlayerControlled), false])) then { _markerName setMarkerColorLocal "ColorOrange"; diff --git a/addons/switchunits/functions/fnc_module.sqf b/addons/switchunits/functions/fnc_module.sqf index 3b8cea4037..9da63a9510 100644 --- a/addons/switchunits/functions/fnc_module.sqf +++ b/addons/switchunits/functions/fnc_module.sqf @@ -35,4 +35,4 @@ GVAR(Module) = true; [QGVAR(EnableSwitchUnits), true, false, true] call EFUNC(common,setSetting); -ACE_LOGINFO("Switch Unit Module Initialized."); +ACE_LOGINFO("SwitchUnits Module Initialized."); diff --git a/addons/switchunits/functions/fnc_nearestPlayers.sqf b/addons/switchunits/functions/fnc_nearestPlayers.sqf index 64e347d7da..f20d5fcf02 100644 --- a/addons/switchunits/functions/fnc_nearestPlayers.sqf +++ b/addons/switchunits/functions/fnc_nearestPlayers.sqf @@ -16,11 +16,9 @@ */ #include "script_component.hpp" -private ["_nearestPlayers"]; - params ["_position", "_radius"]; -_nearestPlayers = []; +private _nearestPlayers = []; { if ([_x] call EFUNC(common,isPlayer) && {alive _x}) then { diff --git a/addons/switchunits/functions/fnc_startSwitchUnits.sqf b/addons/switchunits/functions/fnc_startSwitchUnits.sqf index 481b04d2cd..8d4707f040 100644 --- a/addons/switchunits/functions/fnc_startSwitchUnits.sqf +++ b/addons/switchunits/functions/fnc_startSwitchUnits.sqf @@ -19,8 +19,7 @@ params ["_player"]; if (GVAR(EnableSwitchUnits)) then { - private "_sides"; - _sides = []; + private _sides = []; if(GVAR(SwitchToWest)) then {_sides pushBack west;}; if(GVAR(SwitchToEast)) then {_sides pushBack east;}; diff --git a/addons/switchunits/functions/fnc_switchBack.sqf b/addons/switchunits/functions/fnc_switchBack.sqf index 5aab2c9aee..4c3d05ae54 100644 --- a/addons/switchunits/functions/fnc_switchBack.sqf +++ b/addons/switchunits/functions/fnc_switchBack.sqf @@ -26,11 +26,11 @@ params ["_originalPlayerUnit"]; if (local _originalPlayerUnit) exitWith { selectPlayer _originalPlayerUnit; - deleteVehicle _currentUnit; - private "_layer"; - _layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer; - _layer cuttext ["","plain"]; + // deleteVehicle _currentUnit; + + // private _layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer; + // _layer cuttext ["","plain"]; [_pfhId] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index 49c3e97e42..a26b2d474a 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -15,19 +15,17 @@ */ #include "script_component.hpp" -private ["_nearestEnemyPlayers", "_allNearestPlayers", "_oldUnit", "_leave"]; - params ["_unit"]; // don't switch to original player units if (!([_unit] call FUNC(isValidAi))) exitWith {}; // exit var -_leave = false; +private _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); + private _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers); + private _nearestEnemyPlayers = _allNearestPlayers select {((side GVAR(OriginalGroup)) getFriend side _x < 0.6) && !(_x getVariable [QGVAR(IsPlayerControlled), false])}; if (count _nearestEnemyPlayers > 0) exitWith { _leave = true; @@ -42,20 +40,28 @@ if (_leave) exitWith { // should switch locality // This doesn't work anymore, because one's now able to switch to units from a different side //[_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); +[ + [_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); [{ - private ["_respawnEhId", "_oldOwner"]; params ["_args", "_pfhId"]; _args params ["_unit", "_oldUnit"]; + [localize LSTRING(TryingToSwitch)] call EFUNC(common,displayTextStructured); + if (local _unit) exitWith { _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; _oldUnit setVariable [QGVAR(PlayerControlledName), "", true]; - _respawnEhId = _unit getVariable [QGVAR(RespawnEhId), -1]; - if (_respawnEhId != -1) then { - _oldUnit removeEventHandler ["Respawn", _respawnEhId]; + private _killedEhId = _unit getVariable [QGVAR(KilledEhId), -1]; + if (_killedEhId != -1) then { + _oldUnit removeEventHandler ["Killed", _killedEhId]; }; selectPlayer _unit; @@ -63,15 +69,22 @@ if (_leave) exitWith { _unit setVariable [QGVAR(IsPlayerControlled), true, true]; _unit setVariable [QGVAR(PlayerControlledName), GVAR(OriginalName), true]; - _respawnEhId = _unit addEventHandler ["Respawn", { + + _killedEhId = _unit addEventHandler ["Killed", { [GVAR(OriginalUnit), _this select 0] call FUNC(switchBack); }]; - _unit setVariable [QGVAR(RespawnEhId), _respawnEhId, true]; + _unit setVariable [QGVAR(KilledEhId), _killedEhId, true]; + // set owner back to original owner - _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1]; + private _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1]; if (_oldOwner > -1) then { - [[_oldUnit, _oldOwner], QUOTE({(_this select 0) setOwner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); + [ + [_oldUnit, _oldOwner], + QUOTE({ + (_this select 0) setOwner (_this select 1) + }), 1 + ] call EFUNC(common,execRemoteFnc); }; [localize LSTRING(SwitchedUnit)] call EFUNC(common,displayTextStructured); diff --git a/addons/switchunits/functions/script_component.hpp b/addons/switchunits/functions/script_component.hpp index df5c7a0d96..d03116f2f8 100644 --- a/addons/switchunits/functions/script_component.hpp +++ b/addons/switchunits/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\switchunits\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\switchunits\script_component.hpp" diff --git a/addons/switchunits/script_component.hpp b/addons/switchunits/script_component.hpp index 5955e1220f..938d34d9a8 100644 --- a/addons/switchunits/script_component.hpp +++ b/addons/switchunits/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT switchunits #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SWITCHUNITS #define DEBUG_MODE_FULL #endif diff --git a/addons/switchunits/stringtable.xml b/addons/switchunits/stringtable.xml index d38175b1da..11127a57be 100644 --- a/addons/switchunits/stringtable.xml +++ b/addons/switchunits/stringtable.xml @@ -13,6 +13,13 @@ Cambia unità Trocado de unidade + + Trying to switch + Versuche zu Wechseln + Snažím se přehodit + Próba zmiany + Sto provando a cambiare + This unit is too close to the enemy. Diese Einheit ist zu nah am Feind. @@ -35,6 +42,7 @@ Système de changement d'unité Egységváltó-rendszer Переключение между юнитами + Sistema Cambio Unità Switch to West? @@ -46,6 +54,7 @@ Changer en OUEST? Átváltás BLUFOR-ra? На синих? + Cambia per BLUFOR? Allow switching to west units? @@ -57,6 +66,7 @@ Permettre le changement en unité OUEST? Nyugat-fakciós egységekre való váltás engedélyezése? Разрешить переключаться на синих юнитов? + Consenti passaggio ad unità BLUFOR? Switch to East? @@ -68,6 +78,7 @@ Changer en EST? Átváltás OPFOR-ra? На красных? + Cambia per OPFOR? Allow switching to east units? @@ -79,6 +90,7 @@ Permettre le changement en unité EST? Kelet-fakciós egységekre való váltás engedélyezése? Разрешить переключаться на красных юнитов? + Consenti passaggio ad unità OPFOR? Switch to Independent? @@ -90,6 +102,7 @@ Changer en INDE? Átváltás INDFOR-ra? На независимых? + Cambia per INDFOR? Allow switching to independent units? @@ -101,6 +114,7 @@ Permettre le changement en unité INDE? Független egységekre való váltás engedélyezése? Разрешить переключаться на независимых юнитов? + Consenti passaggio ad unità INDFOR? Switch to Civilian? @@ -112,6 +126,7 @@ Changer en CIV? Átváltás civilre? На гражданских? + Cambia per Civili? Allow switching to civilian units? @@ -123,6 +138,7 @@ Permettre le changement en unité CIV? Civil egységekre való váltás engedélyezése? Разрешить переключаться на гражданских юнитов? + Consenti passaggio ad unità civili? Enable Safe Zone? @@ -134,6 +150,7 @@ Activer la zone sécurisée? Biztonságos zóna engedélyezése? Безопасная зона + Abilita Zona Sicura? Enable a safe zone around enemy units? Players can't switch to units inside of the safe zone. @@ -145,6 +162,7 @@ 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. Включить безопасную зону вокруг вражеских юнитов? Игроки не могут переключаться на юнитов, находящихся в безопасной зоне. + Abilita una zona sicura attorno ad unità nemiche? I giocatori non possono cambiare ad unità dentro la zona sicura. Safe Zone Radius @@ -156,6 +174,7 @@ Rayon de la zone sécurisée Biztonságos zóna hatóköre Радиус безопасной зоны + Raggio Zona Sicura The safe zone around players from a different team. Default: 200 @@ -167,14 +186,17 @@ 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 + La zona sicura attorno ai giocatori di un team diverso. Default: 200 Module allows you to switch side during the game. + Dieses Modul gestattet, die Fraktion während des Spiels zu wechseln 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 + Questo modulo ti permette di cambiare lato durante la partita. diff --git a/addons/tacticalladder/CfgEventHandlers.hpp b/addons/tacticalladder/CfgEventHandlers.hpp index f9ceb35aa5..ed44329687 100644 --- a/addons/tacticalladder/CfgEventHandlers.hpp +++ b/addons/tacticalladder/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/tacticalladder/CfgVehicles.hpp b/addons/tacticalladder/CfgVehicles.hpp index 1457c4ddee..496ed6fd73 100644 --- a/addons/tacticalladder/CfgVehicles.hpp +++ b/addons/tacticalladder/CfgVehicles.hpp @@ -68,7 +68,7 @@ class CfgVehicles { class ACE_MainActions { selection = "roadway"; distance = 5; - condition = "true"; + condition = QUOTE(_target call FUNC(isLadderEmpty)); class ACE_PickUp { selection = ""; diff --git a/addons/tacticalladder/XEH_PREP.hpp b/addons/tacticalladder/XEH_PREP.hpp new file mode 100644 index 0000000000..691e318a02 --- /dev/null +++ b/addons/tacticalladder/XEH_PREP.hpp @@ -0,0 +1,12 @@ + +PREP(cancelTLdeploy); +PREP(confirmTLdeploy); +PREP(deployTL); +PREP(handleKilled); +PREP(handleInteractMenuOpened); +PREP(handlePlayerChanged); +PREP(handleScrollWheel); +PREP(handleUnconscious); +PREP(isLadderEmpty); +PREP(pickupTL); +PREP(positionTL); diff --git a/addons/tacticalladder/XEH_preInit.sqf b/addons/tacticalladder/XEH_preInit.sqf index cb1d3a8cf3..a7feade1c3 100644 --- a/addons/tacticalladder/XEH_preInit.sqf +++ b/addons/tacticalladder/XEH_preInit.sqf @@ -2,15 +2,6 @@ ADDON = false; -PREP(cancelTLdeploy); -PREP(confirmTLdeploy); -PREP(deployTL); -PREP(handleKilled); -PREP(handleInteractMenuOpened); -PREP(handlePlayerChanged); -PREP(handleScrollWheel); -PREP(handleUnconscious); -PREP(pickupTL); -PREP(positionTL); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/tacticalladder/XEH_preStart.sqf b/addons/tacticalladder/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/tacticalladder/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf index c134df31d1..940b2b612a 100644 --- a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf @@ -21,7 +21,7 @@ params ["_unit", "_ladder"]; // enable running again -[_unit, "ACE_Ladder", false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Ladder", false] call EFUNC(common,statusEffect_set); detach _ladder; diff --git a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf index 0094e460dc..9d5783b327 100644 --- a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf @@ -19,7 +19,7 @@ params ["_unit", "_ladder"]; // enable running again -[_unit, "ACE_Ladder", false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Ladder", false] call EFUNC(common,statusEffect_set); private ["_pos1", "_pos2"]; diff --git a/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf b/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf index 0b64d89610..c22141ca24 100644 --- a/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf +++ b/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf @@ -40,9 +40,9 @@ if (GETMVAR(ACE_Modifier,0) == 0) then { }; }; } else { - // Tilting - GVAR(currentAngle) = 0 max (GVAR(currentAngle) + _scroll) min 30; - GVAR(ladder) animate ["rotate", GVAR(currentAngle)]; + // Tilting (disabled due to sinking, interaction point offset and unsuitable animation) + //GVAR(currentAngle) = 0 max (GVAR(currentAngle) + _scroll) min 30; + //GVAR(ladder) animate ["rotate", GVAR(currentAngle)]; }; true diff --git a/addons/tacticalladder/functions/fnc_isLadderEmpty.sqf b/addons/tacticalladder/functions/fnc_isLadderEmpty.sqf new file mode 100644 index 0000000000..8267faf3c4 --- /dev/null +++ b/addons/tacticalladder/functions/fnc_isLadderEmpty.sqf @@ -0,0 +1,31 @@ +/* + * Author: Jonpas + * Checks if Tactical Ladder is empty (no one climbing it). + * + * Arguments: + * 0: Ladder + * + * Return Value: + * Can Be Picked Up + * + * Example: + * [ladder] call ace_tacticalladder_fnc_isLadderEmpty; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_ladder"]; + +private _unitsNearLadder = nearestObjects [_ladder, ["CAManBase"], 4]; +TRACE_1("Near Ladder",_unitsNearLadder); + +private _ladderEmpty = true; +{ + if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _x >> "ACE_isLadder") == 1) exitWith { + _ladderEmpty = false; + TRACE_1("On Ladder",_x); + }; +} forEach _unitsNearLadder; + +_ladderEmpty diff --git a/addons/tacticalladder/functions/fnc_positionTL.sqf b/addons/tacticalladder/functions/fnc_positionTL.sqf index 1e7f0db209..94e28dea33 100644 --- a/addons/tacticalladder/functions/fnc_positionTL.sqf +++ b/addons/tacticalladder/functions/fnc_positionTL.sqf @@ -21,7 +21,7 @@ params ["_unit", "_ladder"]; // prevent the placing unit from running -[_unit, "ACE_Ladder", true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Ladder", true] call EFUNC(common,statusEffect_set); { _ladder animate [_x, 0]; @@ -42,7 +42,8 @@ GVAR(currentStep) = 3; GVAR(currentAngle) = 0; // add mouse buttons and hints -[localize LSTRING(Deploy), localize LSTRING(Drop), localize LSTRING(Adjust)] call EFUNC(interaction,showMouseHint); +//private _adjustText = format ["%1, +%2", localize LSTRING(Adjust), localize LSTRING(AdjustTilt)]; // Tilting disabled due to sinking, interaction point offset and unsuitable animation +[localize LSTRING(Deploy), localize LSTRING(Drop), /*_adjustText*/ localize LSTRING(Adjust)] call EFUNC(interaction,showMouseHint); _unit setVariable [QGVAR(Deploy), [ _unit, "DefaultAction", diff --git a/addons/tacticalladder/script_component.hpp b/addons/tacticalladder/script_component.hpp index 9905216ae7..1341795f37 100644 --- a/addons/tacticalladder/script_component.hpp +++ b/addons/tacticalladder/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT tacticalladder #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_TACTICALLADDER #define DEBUG_MODE_FULL #endif diff --git a/addons/tacticalladder/stringtable.xml b/addons/tacticalladder/stringtable.xml index 602be09855..a8264384fd 100644 --- a/addons/tacticalladder/stringtable.xml +++ b/addons/tacticalladder/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -38,12 +38,21 @@ Derrubar escada - Extend, +Ctrl tilt - Ausfahren, +Strg kippen - Rozłóż, +Ctrl nachyl - Extender, +Ctrl tilt - Разложить, +Ctrl наклонить - Prodloužit, +Ctrl naklonit + Extend + Ausfahren + Rozłóż + Extender + Разложить + Prodloužit + Estendi, +Ctrl ruota + + + Ctrl tilt + Strg kippen + Ctrl nachyl + Ctrl tilt + Ctrl наклонить + Ctrl naklonit Position ladder @@ -70,4 +79,4 @@ Pegar escada - \ No newline at end of file + diff --git a/addons/tagging/$PBOPREFIX$ b/addons/tagging/$PBOPREFIX$ new file mode 100644 index 0000000000..d841d5d209 --- /dev/null +++ b/addons/tagging/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\tagging \ No newline at end of file diff --git a/addons/tagging/CfgEventHandlers.hpp b/addons/tagging/CfgEventHandlers.hpp new file mode 100644 index 0000000000..becf395052 --- /dev/null +++ b/addons/tagging/CfgEventHandlers.hpp @@ -0,0 +1,18 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +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/tagging/CfgVehicles.hpp b/addons/tagging/CfgVehicles.hpp new file mode 100644 index 0000000000..602ee41d33 --- /dev/null +++ b/addons/tagging/CfgVehicles.hpp @@ -0,0 +1,101 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class ACE_tagWallBlack { + displayName = CSTRING(tagWallBlack); + condition = QUOTE(('ACE_SpraypaintBlack' in items ACE_player) && {[] call FUNC(checkTaggable)}); + statement = QUOTE([ARR_2(ACE_player,'black')] call FUNC(tagWall)); + showDisabled = 0; + priority = 3; + icon = QUOTE(PATHTOF(UI\icons\iconTaggingBlack.paa)); + }; + class ACE_tagWallRed: ACE_tagWallBlack { + displayName = CSTRING(tagWallRed); + condition = QUOTE(('ACE_SpraypaintRed' in items ACE_player) && {[] call FUNC(checkTaggable)}); + statement = QUOTE([ARR_2(ACE_player,'red')] call FUNC(tagWall)); + icon = QUOTE(PATHTOF(UI\icons\iconTaggingRed.paa)); + }; + class ACE_tagWallGreen: ACE_tagWallBlack { + displayName = CSTRING(tagWallGreen); + condition = QUOTE(('ACE_SpraypaintGreen' in items ACE_player) && {[] call FUNC(checkTaggable)}); + statement = QUOTE([ARR_2(ACE_player,'green')] call FUNC(tagWall)); + icon = QUOTE(PATHTOF(UI\icons\iconTaggingGreen.paa)); + }; + class ACE_tagWallBlue: ACE_tagWallBlack { + displayName = CSTRING(tagWallBlue); + condition = QUOTE(('ACE_SpraypaintBlue' in items ACE_player) && {[] call FUNC(checkTaggable)}); + statement = QUOTE([ARR_2(ACE_player,'blue')] call FUNC(tagWall)); + icon = QUOTE(PATHTOF(UI\icons\iconTaggingBlue.paa)); + }; + /*class ACE_tagGroundBlack { + displayName = CSTRING(tagGroundBlack); + condition = QUOTE('ACE_SpraypaintBlack' in items ACE_player); + statement = QUOTE([ARR_2(ACE_player, 'black')] call FUNC(tagGround)); + showDisabled = 0; + priority = 3; + icon = QUOTE(PATHTOF(UI\icons\iconTaggingBlack.paa)); + }; + class ACE_tagGroundRed: ACE_tagGroundBlack { + displayName = CSTRING(tagGroundRed); + condition = QUOTE('ACE_SpraypaintRed' in items ACE_player); + statement = QUOTE([ARR_2(ACE_player, 'red')] call FUNC(tagGround)); + icon = QUOTE(PATHTOF(UI\icons\iconTaggingRed.paa)); + }; + class ACE_tagGroundGreen: ACE_tagGroundBlack { + displayName = CSTRING(tagGroundGreen); + condition = QUOTE('ACE_SpraypaintGreen' in items ACE_player); + statement = QUOTE([ARR_2(ACE_player, 'green')] call FUNC(tagGround)); + icon = QUOTE(PATHTOF(UI\icons\iconTaggingGreen.paa)); + }; + class ACE_tagGroundBlue: ACE_tagGroundBlack { + displayName = CSTRING(tagGroundBlue); + condition = QUOTE('ACE_SpraypaintBlue' in items ACE_player); + statement = QUOTE([ARR_2(ACE_player, 'blue')] call FUNC(tagGround)); + icon = QUOTE(PATHTOF(UI\icons\iconTaggingBlue.paa)); + };*/ + }; + }; + }; + + class Item_Base_F; + class ACE_Item_SpraypaintBlack: Item_Base_F { + author = "jokoho48"; + scope = 2; + scopeCurator = 2; + displayName = CSTRING(spraypaintBlack); + vehicleClass = "Items"; + class TransportItems { + MACRO_ADDITEM(ACE_SpraypaintBlack,1); + }; + }; + class ACE_Item_SpraypaintRed: ACE_Item_SpraypaintBlack { + displayName = CSTRING(spraypaintRed); + class TransportItems { + MACRO_ADDITEM(ACE_SpraypaintRed,1); + }; + }; + class ACE_Item_SpraypaintGreen: ACE_Item_SpraypaintBlack { + displayName = CSTRING(spraypaintGreen); + class TransportItems { + MACRO_ADDITEM(ACE_SpraypaintGreen,1); + }; + }; + class ACE_Item_SpraypaintBlue: ACE_Item_SpraypaintBlack { + displayName = CSTRING(spraypaintBlue); + class TransportItems { + MACRO_ADDITEM(ACE_SpraypaintBlue,1); + }; + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_SpraypaintBlack,5); + MACRO_ADDITEM(ACE_SpraypaintRed,5); + MACRO_ADDITEM(ACE_SpraypaintBlue,5); + MACRO_ADDITEM(ACE_SpraypaintGreen,5); + }; + }; +}; \ No newline at end of file diff --git a/addons/tagging/CfgWeapons.hpp b/addons/tagging/CfgWeapons.hpp new file mode 100644 index 0000000000..a805a75679 --- /dev/null +++ b/addons/tagging/CfgWeapons.hpp @@ -0,0 +1,33 @@ +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_SpraypaintBlack : ACE_ItemCore { + author = "jokoho48"; + displayname = CSTRING(spraypaintBlack); + descriptionShort = CSTRING(descSpraypaint); + picture = QUOTE(PATHTOF(UI\items\itemSpraypaintBlack.paa)); + model = QUOTE(PATHTOF(data\SprayCan.p3d)); + scope = 2; + hiddenSelections[] = {"camo"}; + hiddenSelectionsTextures[] = {QUOTE(PATHTOF(data\spraycanBlack_co.paa))}; + class ItemInfo: InventoryItem_Base_F { + mass = 10; + }; + }; + class ACE_SpraypaintRed : ACE_SpraypaintBlack { + displayname = CSTRING(spraypaintRed); + picture = QUOTE(PATHTOF(UI\items\itemSpraypaintRed.paa)); + hiddenSelectionsTextures[] = {QUOTE(PATHTOF(data\spraycanRed_co.paa))}; + }; + class ACE_SpraypaintGreen : ACE_SpraypaintBlack { + displayname = CSTRING(spraypaintGreen); + picture = QUOTE(PATHTOF(UI\items\itemSpraypaintGreen.paa)); + hiddenSelectionsTextures[] = {QUOTE(PATHTOF(data\spraycanGreen_co.paa))}; + }; + class ACE_SpraypaintBlue : ACE_SpraypaintBlack { + displayname = CSTRING(spraypaintBlue); + picture = QUOTE(PATHTOF(UI\items\itemSpraypaintBlue.paa)); + hiddenSelectionsTextures[] = {QUOTE(PATHTOF(data\spraycanBlue_co.paa))}; + }; +}; diff --git a/addons/tagging/README.md b/addons/tagging/README.md new file mode 100644 index 0000000000..1e29e16b6f --- /dev/null +++ b/addons/tagging/README.md @@ -0,0 +1,11 @@ +ace_tagging +=============== + +Adds a can of spray paint which allows you to tag buildings, walls and other static objects. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- []() \ No newline at end of file diff --git a/addons/tagging/UI/icons/iconTaggingBlack.paa b/addons/tagging/UI/icons/iconTaggingBlack.paa new file mode 100644 index 0000000000..fcc29807bb Binary files /dev/null and b/addons/tagging/UI/icons/iconTaggingBlack.paa differ diff --git a/addons/tagging/UI/icons/iconTaggingBlue.paa b/addons/tagging/UI/icons/iconTaggingBlue.paa new file mode 100644 index 0000000000..eb60a8b1a8 Binary files /dev/null and b/addons/tagging/UI/icons/iconTaggingBlue.paa differ diff --git a/addons/tagging/UI/icons/iconTaggingGreen.paa b/addons/tagging/UI/icons/iconTaggingGreen.paa new file mode 100644 index 0000000000..3c92b87375 Binary files /dev/null and b/addons/tagging/UI/icons/iconTaggingGreen.paa differ diff --git a/addons/tagging/UI/icons/iconTaggingRed.paa b/addons/tagging/UI/icons/iconTaggingRed.paa new file mode 100644 index 0000000000..cfed5fdb1f Binary files /dev/null and b/addons/tagging/UI/icons/iconTaggingRed.paa differ diff --git a/addons/tagging/UI/items/itemSpraypaintBlack.paa b/addons/tagging/UI/items/itemSpraypaintBlack.paa new file mode 100644 index 0000000000..b4df79a4f5 Binary files /dev/null and b/addons/tagging/UI/items/itemSpraypaintBlack.paa differ diff --git a/addons/tagging/UI/items/itemSpraypaintBlue.paa b/addons/tagging/UI/items/itemSpraypaintBlue.paa new file mode 100644 index 0000000000..c3fc18a74d Binary files /dev/null and b/addons/tagging/UI/items/itemSpraypaintBlue.paa differ diff --git a/addons/tagging/UI/items/itemSpraypaintGreen.paa b/addons/tagging/UI/items/itemSpraypaintGreen.paa new file mode 100644 index 0000000000..781b59880c Binary files /dev/null and b/addons/tagging/UI/items/itemSpraypaintGreen.paa differ diff --git a/addons/tagging/UI/items/itemSpraypaintRed.paa b/addons/tagging/UI/items/itemSpraypaintRed.paa new file mode 100644 index 0000000000..670bc3d8b3 Binary files /dev/null and b/addons/tagging/UI/items/itemSpraypaintRed.paa differ diff --git a/addons/tagging/UI/tags/black/0.paa b/addons/tagging/UI/tags/black/0.paa new file mode 100644 index 0000000000..eaf80ac9e6 Binary files /dev/null and b/addons/tagging/UI/tags/black/0.paa differ diff --git a/addons/tagging/UI/tags/black/1.paa b/addons/tagging/UI/tags/black/1.paa new file mode 100644 index 0000000000..41a7d633ea Binary files /dev/null and b/addons/tagging/UI/tags/black/1.paa differ diff --git a/addons/tagging/UI/tags/black/2.paa b/addons/tagging/UI/tags/black/2.paa new file mode 100644 index 0000000000..743410005c Binary files /dev/null and b/addons/tagging/UI/tags/black/2.paa differ diff --git a/addons/tagging/UI/tags/blue/0.paa b/addons/tagging/UI/tags/blue/0.paa new file mode 100644 index 0000000000..fcc9b28ec9 Binary files /dev/null and b/addons/tagging/UI/tags/blue/0.paa differ diff --git a/addons/tagging/UI/tags/blue/1.paa b/addons/tagging/UI/tags/blue/1.paa new file mode 100644 index 0000000000..78122eb7f1 Binary files /dev/null and b/addons/tagging/UI/tags/blue/1.paa differ diff --git a/addons/tagging/UI/tags/blue/2.paa b/addons/tagging/UI/tags/blue/2.paa new file mode 100644 index 0000000000..fb7b8c3d20 Binary files /dev/null and b/addons/tagging/UI/tags/blue/2.paa differ diff --git a/addons/tagging/UI/tags/green/0.paa b/addons/tagging/UI/tags/green/0.paa new file mode 100644 index 0000000000..19d89d6954 Binary files /dev/null and b/addons/tagging/UI/tags/green/0.paa differ diff --git a/addons/tagging/UI/tags/green/1.paa b/addons/tagging/UI/tags/green/1.paa new file mode 100644 index 0000000000..1f55002d28 Binary files /dev/null and b/addons/tagging/UI/tags/green/1.paa differ diff --git a/addons/tagging/UI/tags/green/2.paa b/addons/tagging/UI/tags/green/2.paa new file mode 100644 index 0000000000..79804cdfde Binary files /dev/null and b/addons/tagging/UI/tags/green/2.paa differ diff --git a/addons/tagging/UI/tags/red/0.paa b/addons/tagging/UI/tags/red/0.paa new file mode 100644 index 0000000000..540348b90c Binary files /dev/null and b/addons/tagging/UI/tags/red/0.paa differ diff --git a/addons/tagging/UI/tags/red/1.paa b/addons/tagging/UI/tags/red/1.paa new file mode 100644 index 0000000000..767cc1003e Binary files /dev/null and b/addons/tagging/UI/tags/red/1.paa differ diff --git a/addons/tagging/UI/tags/red/2.paa b/addons/tagging/UI/tags/red/2.paa new file mode 100644 index 0000000000..c2b7189133 Binary files /dev/null and b/addons/tagging/UI/tags/red/2.paa differ diff --git a/addons/tagging/XEH_PREP.hpp b/addons/tagging/XEH_PREP.hpp new file mode 100644 index 0000000000..eb29d5a9e3 --- /dev/null +++ b/addons/tagging/XEH_PREP.hpp @@ -0,0 +1,7 @@ + +PREP(checkTaggable); +PREP(createTag); +PREP(tagDirection); +PREP(tagGround); +PREP(tagWall); +PREP(tagTestingThread); diff --git a/addons/tagging/XEH_postInit.sqf b/addons/tagging/XEH_postInit.sqf new file mode 100644 index 0000000000..31fd73d913 --- /dev/null +++ b/addons/tagging/XEH_postInit.sqf @@ -0,0 +1,47 @@ +// by esteldunedain +#include "script_component.hpp" + + +// Cache for static objects +GVAR(cacheStaticModels) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; +GVAR(cacheStaticModels) setText QGVAR(cacheStaticModels); + +// Consider static everything vehicle that inherit from Static +// This include houses (which we don't need), but also walls, that we do +private _cfgBase = configFile >> "CfgVehicles"; +private _countOptions = count _cfgBase; +for "_index" from 0 to (_countOptions - 1) do { + private _cfgClass = _cfgBase select _index; + if (isClass _cfgClass) then { + if ((configName _cfgClass) isKindOf "Static") then { + private _model = getText (_cfgClass >> "model"); + if (_model != "") then { + private _array = _model splitString "\"; + GVAR(cacheStaticModels) setVariable [toLower (_array select ((count _array) - 2)), _cfgClass]; + }; + }; + }; +}; + +// Also consider static all object inheriting from bridges +_cfgBase = configFile >> "CfgNonAIVehicles"; +_countOptions = count _cfgBase; +for "_index" from 0 to (_countOptions - 1) do { + private _cfgClass = _cfgBase select _index; + if (isClass _cfgClass) then { + if ((configName _cfgClass) isKindOf ["Bridge_base_F", _cfgBase]) then { + private _model = getText (_cfgClass >> "model"); + if (_model != "") then { + private _array = _model splitString "\"; + GVAR(cacheStaticModels) setVariable [toLower (_array select ((count _array) - 2)), _cfgClass]; + }; + }; + }; +}; + +if (!isServer) exitWith {}; + +GVAR(testingThread) = false; +GVAR(tagsToTest) = []; + +["createTag", DFUNC(createTag)] call EFUNC(common,addEventHandler); diff --git a/addons/apl/XEH_preInit.sqf b/addons/tagging/XEH_preInit.sqf similarity index 71% rename from addons/apl/XEH_preInit.sqf rename to addons/tagging/XEH_preInit.sqf index 6899f59bd9..a7feade1c3 100644 --- a/addons/apl/XEH_preInit.sqf +++ b/addons/tagging/XEH_preInit.sqf @@ -2,4 +2,6 @@ ADDON = false; +#include "XEH_PREP.hpp" + ADDON = true; diff --git a/addons/tagging/XEH_preStart.sqf b/addons/tagging/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/tagging/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/tagging/config.cpp b/addons/tagging/config.cpp new file mode 100644 index 0000000000..dcd1fb845d --- /dev/null +++ b/addons/tagging/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"ACE_Item_SpraypaintBlack", "ACE_Item_SpraypaintRed", "ACE_Item_SpraypaintGreen", "ACE_Item_SpraypaintBlue"}; + weapons[] = {"ACE_SpraypaintBlack", "ACE_SpraypaintRed", "ACE_SpraypaintGreen", "ACE_SpraypaintBlue"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"BaerMitUmlaut","esteldunedain"}; + authorUrl = "https://github.com/BaerMitUmlaut"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/tagging/data/SprayCan.p3d b/addons/tagging/data/SprayCan.p3d new file mode 100644 index 0000000000..54410046a9 Binary files /dev/null and b/addons/tagging/data/SprayCan.p3d differ diff --git a/addons/tagging/data/model.cfg b/addons/tagging/data/model.cfg new file mode 100644 index 0000000000..dda2be3d82 --- /dev/null +++ b/addons/tagging/data/model.cfg @@ -0,0 +1,20 @@ +class CfgSkeletons { + class Default { + isDiscrete = 1; + skeletonInherit = ""; + skeletonBones[] = {}; + }; +}; + +class CfgModels { + class Default { + sectionsInherit=""; + sections[] = {""}; + skeletonName = ""; + }; + class SprayCan { + sectionsInherit = ""; + sections[] = {"camo"}; + skeletonName = ""; + }; +}; \ No newline at end of file diff --git a/addons/tagging/data/spraycan.rvmat b/addons/tagging/data/spraycan.rvmat new file mode 100644 index 0000000000..18c91a1bf2 --- /dev/null +++ b/addons/tagging/data/spraycan.rvmat @@ -0,0 +1,82 @@ +class StageTI { + texture = "a3\data_f\default_glass_ti_ca.paa"; +}; +ambient[] = {1,1,1,1}; +diffuse[] = {1,1,1,1}; +forcedDiffuse[] = {0,0,0,0}; +emmisive[] = {0,0,0,1}; +specular[] = {0.3,0.3,0.3,1}; +specularPower = 50; +PixelShaderID = "Super"; +VertexShaderID = "Super"; +class Stage1 { + texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,NOHQ)"; + 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,32,128,1)fresnel(0.85,0.36)"; + 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_interier_car_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/tagging/data/spraycanBlack_co.paa b/addons/tagging/data/spraycanBlack_co.paa new file mode 100644 index 0000000000..ff512a3ae1 Binary files /dev/null and b/addons/tagging/data/spraycanBlack_co.paa differ diff --git a/addons/tagging/data/spraycanBlue_co.paa b/addons/tagging/data/spraycanBlue_co.paa new file mode 100644 index 0000000000..e2013be084 Binary files /dev/null and b/addons/tagging/data/spraycanBlue_co.paa differ diff --git a/addons/tagging/data/spraycanGreen_co.paa b/addons/tagging/data/spraycanGreen_co.paa new file mode 100644 index 0000000000..8143f5a385 Binary files /dev/null and b/addons/tagging/data/spraycanGreen_co.paa differ diff --git a/addons/tagging/data/spraycanRed_co.paa b/addons/tagging/data/spraycanRed_co.paa new file mode 100644 index 0000000000..b7d499b50f Binary files /dev/null and b/addons/tagging/data/spraycanRed_co.paa differ diff --git a/addons/tagging/functions/fnc_checkTaggable.sqf b/addons/tagging/functions/fnc_checkTaggable.sqf new file mode 100644 index 0000000000..4c8f0c750a --- /dev/null +++ b/addons/tagging/functions/fnc_checkTaggable.sqf @@ -0,0 +1,56 @@ +/* + * Author: BaerMitUmlaut and esteldunedain + * Checks if there is a taggable surface within 2.5m in front of the player. + * + * Arguments: + * None + * + * Return Value: + * Is wall taggable + * + * Example: + * [] call ace_tagging_fnc_checkTaggable + * + * Public: No + */ + +#include "script_component.hpp" + +[[], { + private _startPosASL = eyePos ACE_player; + private _cameraPosASL = AGLToASL positionCameraToWorld [0, 0, 0]; + private _cameraDir = (AGLToASL positionCameraToWorld [0, 0, 1]) vectorDiff _cameraPosASL; + private _endPosASL = _startPosASL vectorAdd (_cameraDir vectorMultiply 2.5); + + private _intersections = lineIntersectsSurfaces [_startPosASL, _endPosASL, ACE_player, objNull, true, 1, "FIRE", "GEOM"]; + + // If there's no intersections + if (_intersections isEqualTo []) exitWith {false}; + + (_intersections select 0) params ["", "", "", "_object"]; + + // Exit if trying to tag a non static object + TRACE_1("Obj:",_intersections); + + // Exit if trying to tag a non static object + if ((!isNull _object) && { + // If the class is alright, do not exit + if (_object isKindOf "Static") exitWith {false}; + + // If the class is not categorized correctly search the cache + private _array = str(_object) splitString " "; + private _str = toLower (_array select 1); + TRACE_1("Object:",_str); + private _objClass = GVAR(cacheStaticModels) getVariable _str; + // If the class in not on the cache, exit + if (isNil "_objClass") exitWith { + false + }; + true + }) exitWith { + TRACE_1("Pointed object is non static",_object); + false + }; + + true +}, missionNamespace, QGVAR(checkTaggableCache), 0.5] call EFUNC(common,cachedCall); diff --git a/addons/tagging/functions/fnc_createTag.sqf b/addons/tagging/functions/fnc_createTag.sqf new file mode 100644 index 0000000000..fdb2cd08b0 --- /dev/null +++ b/addons/tagging/functions/fnc_createTag.sqf @@ -0,0 +1,71 @@ +/* + * Author: BaerMitUmlaut and esteldunedain + * Creates a tag and handle its destruction. Only execute on the server. + * + * Arguments: + * 0: Position ASL + * 1: Vector dir and up + * 2: Colour of the tag (valid colours are black, red, green and blue) + * 3: Object it should be tied too + * + * Return Value: + * None + * + * Example: + * [positionASL, vectorDirAndUp, "black", object] call ace_tagging_fnc_createTag + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_tagPosASL", "_vectorDirAndUp", "_color", "_object"]; +TRACE_4("createTag:", _tagPosASL, _vectorDirAndUp, _color, _object); + +if !((toLower _color) in ["black", "red", "green", "blue"]) exitWith { + ACE_LOGERROR_1("%1 is not a valid tag colour.", _color); +}; + +private _tag = "UserTexture1m_F" createVehicle [0,0,0]; +_tag setObjectTextureGlobal [0, '\z\ace\addons\tagging\UI\tags\' + _color + '\' + str (floor (random 3)) + '.paa']; +_tag setPosASL _tagPosASL; +_tag setVectorDirAndUp _vectorDirAndUp; + +if (isNull _object) exitWith {}; + +// If the tag is applied to an object, handle its destruction +_object setVariable [QGVAR(testVar), true]; +if (_object getVariable [QGVAR(testVar), false]) then { + // The object supports variables and hence HandleDamage too + // Use the cheaper alternative for handling destruction: HandleDamage + + // If the object already has tags attached, just add the new one to the list + private _attachedTags = _object getVariable QGVAR(attachedTags); + if !(isNil "_attachedTags ") exitWith { + _attachedTags pushBack _tag; + }; + + _attachedTags = [_tag]; + _object setVariable [QGVAR(attachedTags), _attachedTags]; + + // If it's the first tag attached to that object, add a handledamage event handler + _object addEventHandler ["HandleDamage", { + params ["_object", "_selection", "_damage"]; + if (_selection == "" && _damage >= 1) then { + { + deleteVehicle _x; + } foreach (_object getVariable [QGVAR(attachedTags), []]); + _object setVariable [QGVAR(attachedTags), []]; + }; + }]; +}; + +// Periodic test the tag: +// - For object that don't support handledamage +// - For object that do, to support doors opening/closing, etc +GVAR(tagsToTest) pushBack [_tag, _tagPosASL, _vectorDirAndUp]; + +// Run the test +if (!GVAR(testingThread)) then { + call FUNC(tagTestingThread); +}; diff --git a/addons/tagging/functions/fnc_tagDirection.sqf b/addons/tagging/functions/fnc_tagDirection.sqf new file mode 100644 index 0000000000..2c03d97fd0 --- /dev/null +++ b/addons/tagging/functions/fnc_tagDirection.sqf @@ -0,0 +1,107 @@ +/* + * Author: BaerMitUmlaut and esteldunedain + * If possible, create a tag on the first surface between Start and End positions + * + * Arguments: + * 0: Unit + * 1: Start position ASL + * 2: End position ASL + * 3: The colour of the tag (valid colours are black, red, green and blue) + * + * Return Value: + * Sucess + * + * Example: + * [startPosASL, directiom "blue"] call ace_tagging_fnc_tagDirection + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit", "_startPosASL", "_endPosASL", "_color"]; + +// Check for intersections below the unit +private _intersections = lineIntersectsSurfaces [_startPosASL, _endPosASL, _unit, objNull, true, 1, "GEOM", "FIRE"]; + +// If there's no intersections +if (_intersections isEqualTo []) exitWith { + TRACE_3("No intersections",_intersections); + false +}; + +(_intersections select 0) params ["_touchingPoint", "_surfaceNormal", "", "_object"]; +TRACE_3("",_touchingPoint, _surfaceNormal, _object); + +// Exit if trying to tag a non static object +if ((!isNull _object) && { + // If the class is alright, do not exit + if (_object isKindOf "Static") exitWith {false}; + + // If the class is not categorized correctly search the cache + private _array = str(_object) splitString " "; + private _str = toLower (_array select 1); + TRACE_1("Object:",_str); + private _objClass = GVAR(cacheStaticModels) getVariable _str; + // If the class in not on the cache, exit + if (isNil "_objClass") exitWith { + false + }; + true +}) exitWith { + TRACE_1("Pointed object is non static",_object); + false +}; + + +// If the surface normal points away, flip it. This happens in weird places like the Stratis Pier +if (_surfaceNormal vectorDotProduct (_endPosASL vectorDiff _startPosASL) > 0) then { + _surfaceNormal = _surfaceNormal vectorMultiply -1; +}; + +// Check if its a valid surface: big enough, reasonably plane +private _v1 = vectorNormalized (_surfaceNormal vectorMultiply -1); +private _v2 = vectorNormalized (_v1 vectorCrossProduct (_endPosASL vectorDiff _startPosASL)); +private _v3 = _v2 vectorCrossProduct _v1; + +TRACE_3("Reference:", _v1, _v2, _v3); + +_fnc_isOk = { + params ["_rx", "_ry"]; + private _startPosASL2 = _touchingPoint vectorAdd (_v2 vectorMultiply _rx) vectorAdd (_v3 vectorMultiply _ry) vectorAdd (_v1 vectorMultiply (-0.06)); + private _endPosASL2 = _startPosASL2 vectorAdd (_v1 vectorMultiply (0.12)); + private _intersections = lineIntersectsSurfaces [_startPosASL2, _endPosASL2, _unit, objNull, true, 1, "GEOM", "FIRE"]; + // If there's no intersections + if (_intersections isEqualTo []) exitWith {false;}; + + if !(((_intersections select 0) select 3) isEqualTo _object) exitWith {false;}; + + true +}; + +#define TAG_SIZE 0.6 + +if ( !([ 0.5*TAG_SIZE, 0.5*TAG_SIZE] call _fnc_isOk) || + {!([ 0.5*TAG_SIZE,-0.5*TAG_SIZE] call _fnc_isOk) || + {!([-0.5*TAG_SIZE, 0.5*TAG_SIZE] call _fnc_isOk) || + {!([-0.5*TAG_SIZE,-0.5*TAG_SIZE] call _fnc_isOk)}}}) exitWith { + TRACE_3("Unsuitable location:",_touchingPoint); + false +}; + +private _vectorDirAndUp = [_surfaceNormal vectorMultiply -1, _v3]; + +// Everything ok, make the unit create the tag +_unit playActionNow "PutDown"; + +[{ + params ["", "", "", "", "_unit"]; + TRACE_2("Unit:",_unit,_this); + + playSound3D [QUOTE(PATHTO_R(sounds\spray.ogg)), _unit, false, (eyePos _unit), 10, 1, 15]; + + // Tell the server to create the tag and handle its destruction + ["createTag", _this] call EFUNC(common,serverEvent); +}, [_touchingPoint vectorAdd (_surfaceNormal vectorMultiply 0.06), _vectorDirAndUp, _color, _object, _unit], 0.6] call EFUNC(common,waitAndExecute); + +true diff --git a/addons/tagging/functions/fnc_tagGround.sqf b/addons/tagging/functions/fnc_tagGround.sqf new file mode 100644 index 0000000000..fa8d1795bf --- /dev/null +++ b/addons/tagging/functions/fnc_tagGround.sqf @@ -0,0 +1,25 @@ +/* + * Author: BaerMitUmlaut and esteldunedain + * Creates a tag on the ground beneath the unit + * + * Arguments: + * 0: Unit + * 1: The colour of the tag (valid colours are black, red, green and blue) + * + * Return Value: + * None + * + * Example: + * [player, "blue"] call ace_tagging_fnc_tagGround + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit", "_color"]; + +private _startPosASL = getPosASL _unit; +private _endPosASL = _startPosASL vectorAdd [0, 0, -2] vectorAdd eyeDirection _unit; + +[_unit, _startPosASL, _endPosASL, _color] call FUNC(tagDirection); diff --git a/addons/tagging/functions/fnc_tagTestingThread.sqf b/addons/tagging/functions/fnc_tagTestingThread.sqf new file mode 100644 index 0000000000..18d14e2e4f --- /dev/null +++ b/addons/tagging/functions/fnc_tagTestingThread.sqf @@ -0,0 +1,46 @@ +/* + * Author: esteldunedain + * Checks if tags are still leaning on an object periodically. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_tagging_fnc_tagTestingThread + * + * Public: No + */ + +#include "script_component.hpp" + +_fnc_isLeaning = { + params ["_tag", "_tagPosASL", "_vectorDirAndUp"]; + + _vectorDirAndUp params ["_v1", "_v2"]; + + private _endPosASL = _tagPosASL vectorAdd (_v1 vectorMultiply 0.08); + + // Check for intersections below the unit + private _intersections = lineIntersectsSurfaces [_tagPosASL, _endPosASL, _tag, objNull, true, 1, "GEOM", "FIRE"]; + + // If there's no intersections + if (_intersections isEqualTo []) exitWith { + TRACE_1("No intersections, deleting:",_tag); + deleteVehicle _tag; + false + }; + true +}; +GVAR(tagsToTest) = [GVAR(tagsToTest), _fnc_isLeaning] call EFUNC(common,filter); + +// If there's no more tag +if (GVAR(tagsToTest) isEqualTo []) exitWith { + GVAR(testingThread) = false; +}; + +// Schedule for execution again after 5 seconds +[DFUNC(tagTestingThread), [], 5] call EFUNC(common,waitAndExecute); +GVAR(testingThread) = true; diff --git a/addons/tagging/functions/fnc_tagWall.sqf b/addons/tagging/functions/fnc_tagWall.sqf new file mode 100644 index 0000000000..9b6485f4e8 --- /dev/null +++ b/addons/tagging/functions/fnc_tagWall.sqf @@ -0,0 +1,27 @@ +/* + * Author: BaerMitUmlaut and esteldunedain + * Creates a tag on a wall that is on the closest surface within 2m on front of the unit. + * + * Arguments: + * 0: Unit + * 1: The colour of the tag (valid colours are black, red, green and blue) + * + * Return Value: + * None + * + * Example: + * [player, "blue"] call ace_tagging_fnc_tagWall + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit", "_color"]; + +private _startPosASL = eyePos _unit; +private _cameraPosASL = AGLToASL positionCameraToWorld [0, 0, 0]; +private _cameraDir = (AGLToASL positionCameraToWorld [0, 0, 1]) vectorDiff _cameraPosASL; +private _endPosASL = _startPosASL vectorAdd (_cameraDir vectorMultiply 2.5); + +[_unit, _startPosASL, _endPosASL, _color] call FUNC(tagDirection); diff --git a/addons/tagging/functions/script_component.hpp b/addons/tagging/functions/script_component.hpp new file mode 100644 index 0000000000..bc860f2283 --- /dev/null +++ b/addons/tagging/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\tagging\script_component.hpp" \ No newline at end of file diff --git a/addons/tagging/script_component.hpp b/addons/tagging/script_component.hpp new file mode 100644 index 0000000000..4217989fde --- /dev/null +++ b/addons/tagging/script_component.hpp @@ -0,0 +1,15 @@ +#define COMPONENT tagging +#include "\z\ace\addons\main\script_mod.hpp" + +#define DEBUG_MODE_FULL +#define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_BLANK + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_BLANK + #define DEBUG_SETTINGS DEBUG_SETTINGS_BLANK +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/tagging/sounds/spray.ogg b/addons/tagging/sounds/spray.ogg new file mode 100644 index 0000000000..127dc9db75 Binary files /dev/null and b/addons/tagging/sounds/spray.ogg differ diff --git a/addons/tagging/stringtable.xml b/addons/tagging/stringtable.xml new file mode 100644 index 0000000000..158e2429ba --- /dev/null +++ b/addons/tagging/stringtable.xml @@ -0,0 +1,57 @@ + + + + + Tag black + Schwarz markieren + + + Tag red + Rot markieren + + + Tag green + Grün markieren + + + Tag blue + Blau markieren + + + Tag ground black + Boden schwarz markieren + + + Tag ground red + Boden rot markieren + + + Tag ground green + Boden grün markieren + + + Tag ground blue + Boden blau markieren + + + Black spray paint + Schwarze Sprühfarbe + + + Red spray paint + Rote Sprühfarbe + + + Green spray paint + Grüne Sprühfarbe + + + Blue spray paint + Blaue Sprühfarbe + + + A can of spray paint for tagging walls. + Eine Farbsprühdose um Wände zu markieren. + + + diff --git a/addons/testmissions/script_component.hpp b/addons/testmissions/script_component.hpp index d1674fb35c..718356494d 100644 --- a/addons/testmissions/script_component.hpp +++ b/addons/testmissions/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT testmissions #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_TESTMISSIONS #define DEBUG_MODE_FULL #endif diff --git a/addons/thermals/script_component.hpp b/addons/thermals/script_component.hpp index 97d7630b50..bd829f035e 100644 --- a/addons/thermals/script_component.hpp +++ b/addons/thermals/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT thermals #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_THERMALS #define DEBUG_MODE_FULL #endif diff --git a/addons/trenches/$PBOPREFIX$ b/addons/trenches/$PBOPREFIX$ new file mode 100644 index 0000000000..dab2e4cdda --- /dev/null +++ b/addons/trenches/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\trenches \ No newline at end of file diff --git a/addons/trenches/CfgEventHandlers.hpp b/addons/trenches/CfgEventHandlers.hpp new file mode 100644 index 0000000000..6db97e9c9d --- /dev/null +++ b/addons/trenches/CfgEventHandlers.hpp @@ -0,0 +1,26 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +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 CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/trenches/CfgVehicles.hpp b/addons/trenches/CfgVehicles.hpp new file mode 100644 index 0000000000..81880a4265 --- /dev/null +++ b/addons/trenches/CfgVehicles.hpp @@ -0,0 +1,64 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(digEnvelopeSmall) { + displayName = CSTRING(DigEnvelopeSmall); + condition = QUOTE([ARR_2(_this select 0,'ace_trenches_trenchSmall')] call FUNC(canDigTrench)); + //wait a frame to handle "Do When releasing action menu key" option + statement = QUOTE([ARR_2({_this call FUNC(placeTrench)},[ARR_2(_this select 0,'ace_trenches_trenchSmall')])] call EFUNC(common,execNextFrame)); + exceptions[] = {}; + showDisabled = 0; + priority = 4; + //icon = PATHTOF(UI\icon_sandbag_ca.paa); + }; + class GVAR(digEnvelopeBig) { + displayName = CSTRING(DigEnvelopeBig); + condition = QUOTE([ARR_2(_this select 0,'ace_trenches_trenchBig')] call FUNC(canDigTrench)); + //wait a frame to handle "Do When releasing action menu key" option + statement = QUOTE([ARR_2({_this call FUNC(placeTrench)},[ARR_2(_this select 0,'ace_trenches_trenchBig')])] call EFUNC(common,execNextFrame)); + exceptions[] = {}; + showDisabled = 0; + priority = 4; + //icon = PATHTOF(UI\icon_sandbag_ca.paa); + }; + }; + }; + }; + + class BagFence_base_F; + class ACE_envelope_small: BagFence_base_F { + author = ECSTRING(common,ACETeam); + displayName = CSTRING(EnvelopeSmallName); + descriptionShort = CSTRING(EnevlopeSmallDescription); + model = QUOTE(PATHTOEF(apl,ace_envelope_small4.p3d)); + scope = 2; + }; + class ACE_envelope_big: BagFence_base_F { + author = ECSTRING(common,ACETeam); + displayName = CSTRING(EnvelopeBigName); + descriptionShort = CSTRING(EnevlopeBigDescription); + model = QUOTE(PATHTOEF(apl,ace_envelope_big4.p3d)); + scope = 2; + }; + + + class ACE_envelope_small_NoGeo: ACE_envelope_small { + scope = 1; + //@todo: replace by a no geo model + model = QUOTE(PATHTOEF(apl,ace_envelope_small4_nogeo.p3d)); + }; + class ACE_envelope_big_NoGeo: ACE_envelope_big { + scope = 1; + //@todo: replace by a no geo model + model = QUOTE(PATHTOEF(apl,ace_envelope_big4_nogeo.p3d)); + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_EntrenchingTool,50); + }; + }; +}; diff --git a/addons/trenches/CfgWeapons.hpp b/addons/trenches/CfgWeapons.hpp new file mode 100644 index 0000000000..5b20e9e4c1 --- /dev/null +++ b/addons/trenches/CfgWeapons.hpp @@ -0,0 +1,16 @@ +class CfgWeapons { + class InventoryItem_Base_F; + class ACE_ItemCore; + + class ACE_EntrenchingTool: ACE_ItemCore { + author = ECSTRING(common,ACETeam); + displayName = CSTRING(EntrenchingToolName); + descriptionShort = CSTRING(EntrenchingToolDescription); + model = QUOTE(PATHTOEF(apl,ace_entrchtool.p3d)); + picture = QUOTE(PATHTOF(ui\w_entrchtool_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 10; + }; + }; +}; diff --git a/addons/trenches/README.md b/addons/trenches/README.md new file mode 100644 index 0000000000..7ebfbe238b --- /dev/null +++ b/addons/trenches/README.md @@ -0,0 +1,12 @@ +ace_trenches +================= + +Adds item 'ACE_entrenchingtool' +Adds 2 trenches; Envelope - Small & Envelop - Big + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Grey](https://github.com/Grey-Soldierman) diff --git a/addons/trenches/UI/w_entrchtool_ca.paa b/addons/trenches/UI/w_entrchtool_ca.paa new file mode 100644 index 0000000000..dceb288dc0 Binary files /dev/null and b/addons/trenches/UI/w_entrchtool_ca.paa differ diff --git a/addons/trenches/XEH_PREP.hpp b/addons/trenches/XEH_PREP.hpp new file mode 100644 index 0000000000..a9050b83bd --- /dev/null +++ b/addons/trenches/XEH_PREP.hpp @@ -0,0 +1,11 @@ + +PREP(canDigTrench); +PREP(handleInteractMenuOpened); +PREP(handleKilled); +PREP(handlePlayerChanged); +PREP(handlePlayerInventoryChanged); +PREP(handleScrollWheel); +PREP(handleUnconscious); +PREP(placeCancel); +PREP(placeConfirm); +PREP(placeTrench); diff --git a/addons/trenches/XEH_postInit.sqf b/addons/trenches/XEH_postInit.sqf new file mode 100644 index 0000000000..d0e8775f05 --- /dev/null +++ b/addons/trenches/XEH_postInit.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" + +if (isServer) then { + // Cancel dig on hard disconnection. Function is identical to killed + addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleKilled)}]; +}; + +if (!hasInterface) exitWith {}; + +GVAR(trenchId) = 0; +GVAR(trench) = objNull; +GVAR(digPFH) = -1; +GVAR(digDirection) = 0; + +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); + +// Cancel dig sandbag if interact menu opened +["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); + +// Cancel dig 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/trenches/XEH_preInit.sqf b/addons/trenches/XEH_preInit.sqf new file mode 100644 index 0000000000..8b172b2b9e --- /dev/null +++ b/addons/trenches/XEH_preInit.sqf @@ -0,0 +1,13 @@ +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +// Trench types +// Name of the object, name of th dummy no geo object, dx, dy +GVAR(trenchSmall) = ["ACE_envelope_small", "ACE_envelope_small_NoGeo", 2, 3, 0.35]; +GVAR(trenchBig) = ["ACE_envelope_big", "ACE_envelope_big_NoGeo", 6, 1.1, 0.20]; +GVAR(trenchType) = GVAR(trenchSmall); + +ADDON = true; diff --git a/addons/trenches/XEH_preStart.sqf b/addons/trenches/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/trenches/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/trenches/config.cpp b/addons/trenches/config.cpp new file mode 100644 index 0000000000..e2f2b5b4fe --- /dev/null +++ b/addons/trenches/config.cpp @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"ACE_envelope_small","ACE_envelope_big"}; + weapons[] = {"ACE_EntrenchingTool"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"Grey", "esteldunedain"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/trenches/functions/fnc_canDigTrench.sqf b/addons/trenches/functions/fnc_canDigTrench.sqf new file mode 100644 index 0000000000..9dc5e29017 --- /dev/null +++ b/addons/trenches/functions/fnc_canDigTrench.sqf @@ -0,0 +1,34 @@ +/* + * Author: Ruthberg, commy2, esteldunedain + * Checks if a unit can dig a trench + * + * Arguments: + * 0: Unit + * 1: Trench type + * + * Return Value: + * Can dig + * + * Example: + * [ACE_player] call ace_trenches_fnc_canDigTrench + * + * Public: No + */ +#include "script_component.hpp" + +#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"] + +params ["_unit","_trenchTypeName"]; + +if !("ACE_EntrenchingTool" in items _unit) exitWith {false}; + +// Can't dig trench if above ground level +if ((getPosATL _unit) select 2 > 0.05) exitWith {false}; + +private ["_surfaceClass", "_surfaceType"]; + +_surfaceClass = (surfaceType getPosASL _unit) select [1]; +_surfaceType = getText (configFile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron"); +TRACE_1("",_surfaceType); + +!(_surfaceType in SURFACE_BLACKLIST) diff --git a/addons/trenches/functions/fnc_handleInteractMenuOpened.sqf b/addons/trenches/functions/fnc_handleInteractMenuOpened.sqf new file mode 100644 index 0000000000..91d6b0140b --- /dev/null +++ b/addons/trenches/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(isPlacing), false]) then { + [_unit] call FUNC(placeCancel); +}; diff --git a/addons/trenches/functions/fnc_handleKilled.sqf b/addons/trenches/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..e9f0353cb1 --- /dev/null +++ b/addons/trenches/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(isPlacing), false]) then { + [_unit] call FUNC(placeCancel); +}; diff --git a/addons/trenches/functions/fnc_handlePlayerChanged.sqf b/addons/trenches/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..684ccc22ce --- /dev/null +++ b/addons/trenches/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(isPlacing), false]) then { + [_newPlayer] call FUNC(placeCancel); +}; + +if (_oldPlayer getVariable [QGVAR(isPlacing), false]) then { + [_oldPlayer] call FUNC(placeCancel); +}; diff --git a/addons/trenches/functions/fnc_handlePlayerInventoryChanged.sqf b/addons/trenches/functions/fnc_handlePlayerInventoryChanged.sqf new file mode 100644 index 0000000000..cbae02d07a --- /dev/null +++ b/addons/trenches/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(isPlacing), false]) then { + if !("ACE_EntrenchingTool" in items _unit) then { + [_unit] call FUNC(placeCancel); + }; +}; diff --git a/addons/trenches/functions/fnc_handleScrollWheel.sqf b/addons/trenches/functions/fnc_handleScrollWheel.sqf new file mode 100644 index 0000000000..783463dd25 --- /dev/null +++ b/addons/trenches/functions/fnc_handleScrollWheel.sqf @@ -0,0 +1,24 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg + * Handles sandbag rotation + * + * Arguments: + * 0: scroll amount + * + * Return Value: + * handled + * + * Example: + * [1.2] call ace_sandbag_fnc_handleScrollWheel + * + * Public: No + */ +#include "script_component.hpp" + +params ["_scroll"]; + +if (GETMVAR(ACE_Modifier,0) == 0 || GVAR(digPFH) == -1) exitWith { false }; + +GVAR(digDirection) = GVAR(digDirection) + (_scroll * 5); + +true diff --git a/addons/trenches/functions/fnc_handleUnconscious.sqf b/addons/trenches/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..e4fc2814b2 --- /dev/null +++ b/addons/trenches/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(isPlacing), false]) then { + [_unit] call FUNC(placeCancel); +}; diff --git a/addons/trenches/functions/fnc_placeCancel.sqf b/addons/trenches/functions/fnc_placeCancel.sqf new file mode 100644 index 0000000000..a48d6e3f5b --- /dev/null +++ b/addons/trenches/functions/fnc_placeCancel.sqf @@ -0,0 +1,36 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support + * Cancels trench dig + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [ACE_player] call ace_sandbag_fnc_placeCancel + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +// enable running again +[_unit, "forceWalk", "ACE_Trenches", false] call EFUNC(common,statusEffect_set); + +// delete placement dummy +deleteVehicle GVAR(trench); + +// remove digment pfh +[GVAR(digPFH)] call CBA_fnc_removePerFrameHandler; +GVAR(digPFH) = -1; + +// remove mouse button actions +call EFUNC(interaction,hideMouseHint); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Dig), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); + +_unit setVariable [QGVAR(isPlacing), false, true]; diff --git a/addons/trenches/functions/fnc_placeConfirm.sqf b/addons/trenches/functions/fnc_placeConfirm.sqf new file mode 100644 index 0000000000..797499a63f --- /dev/null +++ b/addons/trenches/functions/fnc_placeConfirm.sqf @@ -0,0 +1,115 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support and esteldunedain + * Confirms trench dig + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [ACE_player] call ace_trenches_fnc_placeConfirm + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +// enable running again +[_unit, "forceWalk", "ACE_Trenches", false] call EFUNC(common,statusEffect_set); + +// remove dig pfh +[GVAR(digPFH)] call CBA_fnc_removePerFrameHandler; +GVAR(digPFH) = -1; + +// remove mouse button actions +call EFUNC(interaction,hideMouseHint); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Dig), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); + +_unit setVariable [QGVAR(isPlacing), false, true]; + +// Delete placement dummy and create real trench +params ["_unit"]; +if (isNull GVAR(trench)) exitWith {}; + +deleteVehicle GVAR(trench); +private _trench = createVehicle [GVAR(trenchType) select 0, [0, 0, 0], [], 0, "NONE"]; + +GVAR(trenchType) params ["", "", "_dx", "_dy", "_offset"]; +private _basePos = GVAR(trenchPos); +private _angle = (GVAR(digDirection) + getDir _unit); + +// _v1 forward from the player, _v2 to the right, _v3 points away from the ground +private _v3 = surfaceNormal _basePos; +private _v2 = [sin _angle, +cos _angle, 0] vectorCrossProduct _v3; +private _v1 = _v3 vectorCrossProduct _v2; + +// Stick the trench to the ground +_basePos set [2, getTerrainHeightASL _basePos]; +private _minzoffset = 0; +private ["_ix","_iy"]; +for [{_ix = -_dx/2},{_ix <= _dx/2},{_ix = _ix + _dx/3}] do { + for [{_iy = -_dy/2},{_iy <= _dy/2},{_iy = _iy + _dy/3}] do { + private _pos = _basePos vectorAdd (_v2 vectorMultiply _ix) + vectorAdd (_v1 vectorMultiply _iy); + _minzoffset = _minzoffset min ((getTerrainHeightASL _pos) - (_pos select 2)); + #ifdef DEBUG_MODE_FULL + _pos set [2, getTerrainHeightASL _pos]; + _pos2 = +_pos; + _pos2 set [2, getTerrainHeightASL _pos + 1]; + drawLine3D [ASLtoAGL _pos, ASLtoAGL _pos2, [1,1,0,1]]; + #endif + }; +}; +_basePos set [2, (_basePos select 2) + _minzoffset + _offset]; +private _vecDirAndUp = [_v1, _v3]; + +GVAR(trench) = objNull; + +// Mark the unit as digging +private _trenchId = GVAR(trenchId); +_unit setVariable [QGVAR(isDiggingId), _trenchId, true]; +GVAR(trenchId) = GVAR(trenchId) + 1; + +// Create progress bar +private _fnc_onFinish = { + (_this select 0) params ["_unit"]; + _unit setVariable [QGVAR(isDiggingId), -1, true]; +}; +private _fnc_onFailure = { + (_this select 0) params ["_unit"]; + _unit setVariable [QGVAR(isDiggingId), -1, true]; +}; +[12.5, [_unit], _fnc_onFinish, _fnc_onFailure, localize LSTRING(DiggingTrench)] call EFUNC(common,progressBar); + +// Schedule progressive raising of the trench +private _fnc_setPlacing = { + params ["_unit", "_trench", "_trenchId", "_pos", "_vecDirAndUp"]; + + // If the progress bar was cancelled, cancel elevation + // We use an uid to avoid any chance of an older trench being raised when a new one is built + if (_unit getVariable [QGVAR(isDiggingId), -1] != _trenchId) exitWith {}; + + _trench setPosASL _pos; + _trench setVectorDirAndUp _vecDirAndUp; +}; + +// For loops are for wimps +[_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 1.0], _vecDirAndUp] call _fnc_setPlacing; +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.9], _vecDirAndUp], 3.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.8], _vecDirAndUp], 4.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.7], _vecDirAndUp], 5.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.6], _vecDirAndUp], 6.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.5], _vecDirAndUp], 7.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.4], _vecDirAndUp], 8.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.3], _vecDirAndUp], 9.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.2], _vecDirAndUp],10.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.1], _vecDirAndUp],11.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.0], _vecDirAndUp],12.0] call EFUNC(common,waitAndExecute); + +// Play animation +[_unit, "AinvPknlMstpSnonWnonDnon_medic4"] call EFUNC(common,doAnimation); diff --git a/addons/trenches/functions/fnc_placeTrench.sqf b/addons/trenches/functions/fnc_placeTrench.sqf new file mode 100644 index 0000000000..21c4d92bb9 --- /dev/null +++ b/addons/trenches/functions/fnc_placeTrench.sqf @@ -0,0 +1,104 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support, esteldunedain + * Starts the place process for trench. + * + * Arguments: + * 0: unit + * 1: Trench type + * + * Return Value: + * None + * + * Example: + * [ACE_player] call ace_trenches_fnc_placeTrench + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit","_trenchTypeName"]; + +GVAR(trenchType) = missionNamespace getVariable _trenchTypeName; + +TRACE_2("",_trenchTypeName,GVAR(trenchType)); +// prevent the placing unit from running +[_unit, "forceWalk", "ACE_Trenches", true] call EFUNC(common,statusEffect_set); + +// create the trench +private "_trench"; +_trench = createVehicle [GVAR(trenchType) select 1, [0, 0, 0], [], 0, "NONE"]; + +GVAR(trench) = _trench; + +// prevent collisions with trench +["enableSimulationGlobal", [_trench, false]] call EFUNC(common,serverEvent); + +GVAR(digDirection) = 0; + +// pfh that runs while the dig is in progress +GVAR(digPFH) = [{ + (_this select 0) params ["_unit", "_trench"]; + GVAR(trenchType) params ["", "", "_dx", "_dy", "_offset"]; + + // Cancel if the helper object is gone + if (isNull _trench) exitWith { + [_unit] call FUNC(placeCancel); + }; + + // Cancel if the place is no longer suitable + if !([_unit, GVAR(trenchType)] call FUNC(canDigTrench)) exitWith { + [_unit] call FUNC(placeCancel); + }; + + // Update trench position + GVAR(trenchType) params ["", "", "_dx", "_dy", "_offset"]; + private _basePos = eyePos _unit vectorAdd ([sin getDir _unit, +cos getDir _unit, 0] vectorMultiply 1.0); + + private _angle = (GVAR(digDirection) + getDir _unit); + + // _v1 forward from the player, _v2 to the right, _v3 points away from the ground + private _v3 = surfaceNormal _basePos; + private _v2 = [sin _angle, +cos _angle, 0] vectorCrossProduct _v3; + private _v1 = _v3 vectorCrossProduct _v2; + + // Stick the trench to the ground + _basePos set [2, getTerrainHeightASL _basePos]; + private _minzoffset = 0; + private ["_ix","_iy"]; + for [{_ix = -_dx/2},{_ix <= _dx/2},{_ix = _ix + _dx/3}] do { + for [{_iy = -_dy/2},{_iy <= _dy/2},{_iy = _iy + _dy/3}] do { + private _pos = _basePos vectorAdd (_v2 vectorMultiply _ix) + vectorAdd (_v1 vectorMultiply _iy); + _minzoffset = _minzoffset min ((getTerrainHeightASL _pos) - (_pos select 2)); + #ifdef DEBUG_MODE_FULL + _pos set [2, getTerrainHeightASL _pos]; + _pos2 = +_pos; + _pos2 set [2, getTerrainHeightASL _pos + 1]; + drawLine3D [ASLtoAGL _pos, ASLtoAGL _pos2, [1,1,0,1]]; + #endif + }; + }; + _basePos set [2, (_basePos select 2) + _minzoffset + _offset]; + TRACE_2("",_minzoffset,_offset); + _trench setPosASL _basePos; + _trench setVectorDirAndUp [_v1, _v3]; + GVAR(trenchPos) = _basePos; + +}, 0, [_unit, _trench]] call CBA_fnc_addPerFrameHandler; + +// add mouse button action and hint +[localize LSTRING(ConfirmDig), localize LSTRING(CancelDig), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); + +_unit setVariable [QGVAR(Dig), [ + _unit, "DefaultAction", + {GVAR(digPFH) != -1}, + {[_this select 0] call FUNC(placeConfirm)} +] call EFUNC(common,addActionEventHandler)]; + +_unit setVariable [QGVAR(Cancel), [ + _unit, "zoomtemp", + {GVAR(digPFH) != -1}, + {[_this select 0] call FUNC(placeCancel)} +] call EFUNC(common,addActionEventHandler)]; + +_unit setVariable [QGVAR(isPlacing), true, true]; diff --git a/addons/trenches/functions/script_component.hpp b/addons/trenches/functions/script_component.hpp new file mode 100644 index 0000000000..3747e01219 --- /dev/null +++ b/addons/trenches/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\trenches\script_component.hpp" \ No newline at end of file diff --git a/addons/trenches/script_component.hpp b/addons/trenches/script_component.hpp new file mode 100644 index 0000000000..3bb65ab0a6 --- /dev/null +++ b/addons/trenches/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT trenches +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_TRENCHES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_TRENCHES + #define DEBUG_SETTINGS DEBUG_SETTINGS_TRENCHES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/trenches/stringtable.xml b/addons/trenches/stringtable.xml new file mode 100644 index 0000000000..d435607ddd --- /dev/null +++ b/addons/trenches/stringtable.xml @@ -0,0 +1,77 @@ + + + + + Entrenching Tool + Schanzzeug + Saperka + Pala + + + Entrenching Tool + Saperka, używana do budowy wnęk + Mit Schanzzeug können Erdwälle oder Gräben ausgehoben werden. + Pala + + + Envelope - Small + Rund - Klein + Wnęka - mała + Fascia - Piccola + + + Small Personal Trench + Kleiner Schützengraben + Mała jednoosobowa wnęka + Piccola Trincea Personale + + + Dig Small Trench + Grabe kleinen Schützengraben + Kop małą wnękę + Scava Trincea Piccola + + + Envelope - Big + Rund - Groß + Wnęka - duża + Fascia - Grande + + + Large Personal Trench + Großer Schützengraben + Duża jednoosobowa wnęka + Grande Trincea Personale + + + Dig Big Trench + Grabe großen Schützengraben + Kop dużą wnękę + Scava Trincea Grande + + + Confirm Dig + Graben bestätigen + Potwierdź kopanie + Conferma Scava + + + Cancel Dig + Graben abbrechen + Anuluj kopanie + Cancella Scava + + + +Ctrl rotate + +Strg drehen + +Ctrl obrót + +Ctrl ruota + + + Digging Trench + Grabe Schützengraben + Kopanie okopu + Sto Scavando la Trincea + + + \ No newline at end of file diff --git a/addons/tripod/CfgEventHandlers.hpp b/addons/tripod/CfgEventHandlers.hpp index ed59062ad5..6e31dde2cb 100644 --- a/addons/tripod/CfgEventHandlers.hpp +++ b/addons/tripod/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); diff --git a/addons/tripod/CfgVehicles.hpp b/addons/tripod/CfgVehicles.hpp index 60486b8afb..de16d6867a 100644 --- a/addons/tripod/CfgVehicles.hpp +++ b/addons/tripod/CfgVehicles.hpp @@ -32,8 +32,8 @@ class CfgVehicles { }; }; - class thingX; - class ACE_TripodObject: thingX { + class ThingX; + class ACE_TripodObject: ThingX { XEH_ENABLED; EGVAR(dragging,canDrag) = 1; EGVAR(dragging,dragPosition[]) = {0,1,0}; diff --git a/addons/tripod/XEH_PREP.hpp b/addons/tripod/XEH_PREP.hpp new file mode 100644 index 0000000000..76b4f2bf1c --- /dev/null +++ b/addons/tripod/XEH_PREP.hpp @@ -0,0 +1,9 @@ + +PREP(adjust); +PREP(handleInteractMenuOpened); +PREP(handleKilled); +PREP(handlePlayerChanged); +PREP(handleScrollWheel); +PREP(handleUnconscious); +PREP(pickup); +PREP(place); diff --git a/addons/tripod/XEH_preInit.sqf b/addons/tripod/XEH_preInit.sqf index 1699258b47..a7feade1c3 100644 --- a/addons/tripod/XEH_preInit.sqf +++ b/addons/tripod/XEH_preInit.sqf @@ -2,13 +2,6 @@ ADDON = false; -PREP(adjust); -PREP(handleInteractMenuOpened); -PREP(handleKilled); -PREP(handlePlayerChanged); -PREP(handleScrollWheel); -PREP(handleUnconscious); -PREP(pickup); -PREP(place); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/tripod/XEH_preStart.sqf b/addons/tripod/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/tripod/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/tripod/script_component.hpp b/addons/tripod/script_component.hpp index b160a14742..95d11d3a65 100644 --- a/addons/tripod/script_component.hpp +++ b/addons/tripod/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT tripod #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_TRIPOD #define DEBUG_MODE_FULL #endif diff --git a/addons/tripod/stringtable.xml b/addons/tripod/stringtable.xml index 16dd89a1f9..28573351fd 100644 --- a/addons/tripod/stringtable.xml +++ b/addons/tripod/stringtable.xml @@ -35,6 +35,7 @@ Prendre le kit SSWT SSWT készlet felvétele Подобрать снайперский штатив + Prendi Kit SSWT Adjust SSWT Kit @@ -46,6 +47,7 @@ Régler le kit SSWT SSWT készlet állítása Выровнять снайперский штатив + Aggiusta Kit SSWT Done @@ -57,6 +59,7 @@ Terminé Kész Готово + Fatto adjust @@ -68,6 +71,7 @@ régler szabályzás подстройка + aggiusta - + \ No newline at end of file diff --git a/addons/ui/script_component.hpp b/addons/ui/script_component.hpp index a0fa713f9f..2c669b78e5 100644 --- a/addons/ui/script_component.hpp +++ b/addons/ui/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT ui #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_UI #define DEBUG_MODE_FULL #endif diff --git a/addons/vector/CfgEventHandlers.hpp b/addons/vector/CfgEventHandlers.hpp index 0cd959a047..becf395052 100644 --- a/addons/vector/CfgEventHandlers.hpp +++ b/addons/vector/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/vector/RscInGameUI.hpp b/addons/vector/RscInGameUI.hpp index 9be7f1ea1c..704dd4838c 100644 --- a/addons/vector/RscInGameUI.hpp +++ b/addons/vector/RscInGameUI.hpp @@ -11,8 +11,8 @@ class RscControlsGroup { class RscInGameUI { class RscUnitInfo; class ACE_RscOptics_vector: RscUnitInfo { - onLoad = "[""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable ['ACE_dlgVector', _this select 0];"; - onUnload = "[""onUnload"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; + onLoad = "[""onLoad"",_this,""RscUnitInfo"",'IGUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable ['ACE_dlgVector', _this select 0];"; + onUnload = "[""onUnload"",_this,""RscUnitInfo"",'IGUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"; idd = 300; controls[] = {"CA_Distance","CA_Heading","CA_OpticsPitch","CA_Elev","CA_OpticsZoom","CA_VisionMode","ACE_ScriptedDisplayControlsGroup"}; diff --git a/addons/vector/XEH_PREP.hpp b/addons/vector/XEH_PREP.hpp new file mode 100644 index 0000000000..f03d99ed83 --- /dev/null +++ b/addons/vector/XEH_PREP.hpp @@ -0,0 +1,31 @@ + +PREP(clearDisplay); +PREP(convertToTexturesDegree); +PREP(convertToTexturesDistance); +PREP(convertToTexturesFOS); +PREP(dataTransfer); +PREP(showCenter); +PREP(showP1); +PREP(onKeyDown); +PREP(onKeyHold); +PREP(onKeyUp); +PREP(getDirection); +PREP(getDistance); +PREP(getHeightDistance); +PREP(getRelativeAzimuthDistance); +PREP(getRelativeDistance); +PREP(getRelativeHeightLength); +PREP(getFallOfShot); +PREP(showAzimuth); +PREP(showAzimuthInclination); +PREP(showHeightDistance); +PREP(showDistance); +PREP(showRelativeAzimuthDistance); +PREP(showRelativeDistance); +PREP(showRelativeHeightLength); +PREP(showFallOfShot); +PREP(showText); +PREP(nextMode); +PREP(adjustBrightness); +PREP(showReticle); +PREP(illuminate); diff --git a/addons/vector/XEH_preInit.sqf b/addons/vector/XEH_preInit.sqf index f170198a15..a7feade1c3 100644 --- a/addons/vector/XEH_preInit.sqf +++ b/addons/vector/XEH_preInit.sqf @@ -2,35 +2,6 @@ ADDON = false; -PREP(clearDisplay); -PREP(convertToTexturesDegree); -PREP(convertToTexturesDistance); -PREP(convertToTexturesFOS); -PREP(dataTransfer); -PREP(showCenter); -PREP(showP1); -PREP(onKeyDown); -PREP(onKeyHold); -PREP(onKeyUp); -PREP(getDirection); -PREP(getDistance); -PREP(getHeightDistance); -PREP(getRelativeAzimuthDistance); -PREP(getRelativeDistance); -PREP(getRelativeHeightLength); -PREP(getFallOfShot); -PREP(showAzimuth); -PREP(showAzimuthInclination); -PREP(showHeightDistance); -PREP(showDistance); -PREP(showRelativeAzimuthDistance); -PREP(showRelativeDistance); -PREP(showRelativeHeightLength); -PREP(showFallOfShot); -PREP(showText); -PREP(nextMode); -PREP(adjustBrightness); -PREP(showReticle); -PREP(illuminate); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/vector/XEH_preStart.sqf b/addons/vector/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/vector/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/vector/script_component.hpp b/addons/vector/script_component.hpp index 9814c95eb2..3a84d60fc4 100644 --- a/addons/vector/script_component.hpp +++ b/addons/vector/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT vector #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_VECTOR #define DEBUG_MODE_FULL #endif diff --git a/addons/vector/stringtable.xml b/addons/vector/stringtable.xml index 80135294d4..9d1936304e 100644 --- a/addons/vector/stringtable.xml +++ b/addons/vector/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/vehiclelock/CfgEventHandlers.hpp b/addons/vehiclelock/CfgEventHandlers.hpp index 6fbbd5c243..705415e65d 100644 --- a/addons/vehiclelock/CfgEventHandlers.hpp +++ b/addons/vehiclelock/CfgEventHandlers.hpp @@ -1,13 +1,22 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + 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_InventoryOpened_EventHandlers { class CAManBase { class ADDON { @@ -15,6 +24,7 @@ class Extended_InventoryOpened_EventHandlers { }; }; }; + class Extended_InitPost_EventHandlers { class Car { class ADDON { diff --git a/addons/vehiclelock/CfgWeapons.hpp b/addons/vehiclelock/CfgWeapons.hpp index ee000e218e..0895988737 100644 --- a/addons/vehiclelock/CfgWeapons.hpp +++ b/addons/vehiclelock/CfgWeapons.hpp @@ -3,6 +3,7 @@ class CfgWeapons { class ACE_ItemCore; class ACE_key_master: ACE_ItemCore { + scopeArsenal = 0; author = ECSTRING(common,ACETeam); displayName = "Vehicle Key: Master"; descriptionShort = CSTRING(Item_Master_Description); diff --git a/addons/vehiclelock/XEH_PREP.hpp b/addons/vehiclelock/XEH_PREP.hpp new file mode 100644 index 0000000000..791936b36a --- /dev/null +++ b/addons/vehiclelock/XEH_PREP.hpp @@ -0,0 +1,11 @@ + +PREP(addKeyForVehicle); +PREP(getVehicleSideKey); +PREP(handleVehicleInitPost); +PREP(hasKeyForVehicle); +PREP(lockpick); +PREP(moduleInit); +PREP(moduleSync); +PREP(onOpenInventory); +PREP(serverSetupCustomKeyEH); +PREP(setVehicleLockEH); diff --git a/addons/vehiclelock/XEH_preInit.sqf b/addons/vehiclelock/XEH_preInit.sqf index 18a7062c24..a7feade1c3 100644 --- a/addons/vehiclelock/XEH_preInit.sqf +++ b/addons/vehiclelock/XEH_preInit.sqf @@ -2,15 +2,6 @@ ADDON = false; -PREP(addKeyForVehicle); -PREP(getVehicleSideKey); -PREP(handleVehicleInitPost); -PREP(hasKeyForVehicle); -PREP(lockpick); -PREP(moduleInit); -PREP(moduleSync); -PREP(onOpenInventory); -PREP(serverSetupCustomKeyEH); -PREP(setVehicleLockEH); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/vehiclelock/XEH_preStart.sqf b/addons/vehiclelock/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/vehiclelock/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf index 5db2cbebe0..17682c72de 100644 --- a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf +++ b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf @@ -35,8 +35,13 @@ if (GVAR(LockVehicleInventory) && //if setting not enabled playSound "ACE_Sound_Click"; //don't open the vehicles inventory _handeled = true; - //Just opens a dummy groundContainer (so the player can still see their own inventory) - ACE_player action ["Gear", objNull]; + + // As of 1.54 the action needs to be delayed a frame to work, which used not to be the case + [{ + TRACE_1("delaying a frame", ace_player); + //Just opens a dummy groundContainer (so the player can still see their own inventory) + ACE_player action ["Gear", objNull]; + }, []] call EFUNC(common,execNextFrame); }; _handeled diff --git a/addons/vehiclelock/script_component.hpp b/addons/vehiclelock/script_component.hpp index 43d49a8028..23b0ea9795 100644 --- a/addons/vehiclelock/script_component.hpp +++ b/addons/vehiclelock/script_component.hpp @@ -1,8 +1,10 @@ #define COMPONENT vehiclelock +#include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL - -#include "\z\ace\addons\main\script_mod.hpp" +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_VEHICLELOCK #define DEBUG_MODE_FULL diff --git a/addons/vehiclelock/stringtable.xml b/addons/vehiclelock/stringtable.xml index e1d08762cd..5ed439efeb 100644 --- a/addons/vehiclelock/stringtable.xml +++ b/addons/vehiclelock/stringtable.xml @@ -38,7 +38,7 @@ Usar mixa no Veículo - Picking Lock.... + Picking Lock... Schloss knacken... Forzando cerradura... Crochetage... @@ -46,7 +46,7 @@ Páčim vozidlo... Zár feltörése... Взламываем замок... - Scassino il veicolo.... + Scassino il veicolo... Usando Mixa... @@ -63,7 +63,7 @@ A Master Key will open any lock, no matter what! - Ein Generalschlüssel der jedes Schloss öffnet... + Ein Generalschlüssel der jedes Schloss öffnet. Una llave maestra abrirá cualquier cierre, no importa cual! Un passe-partout qui ouvrira n'importe quelle serrure. Uniwersalny klucz, który otworzy każdy zamek. @@ -75,7 +75,7 @@ A lockpick set that can pick the locks of most vehicles. - Ein Dietrich der die meisten Fahrzeugschlösser knacken kann... + Ein Dietrich der die meisten Fahrzeugschlösser knacken kann. Un set de ganzúas que puede abrir las cerraduras de la mayoría vehículos. Un crochet qui ouvrira la plupart des véhicules. Zestaw wytrychów, dzięki któremu można otworzyć zamki w większości pojazdów. @@ -87,7 +87,7 @@ A key that should open most WEST vehicles. - Ein Schlüssel der die meisten westlichen Fahrzeuge öffnen sollte... + Ein Schlüssel der die meisten westlichen Fahrzeuge öffnen sollte. Una llave que abrirá la mayoría de vehículos occidentales. Une clé qui ouvrira la plupart des véhicules OUEST. Klucz, który powinien otworzyć większość pojazdów ZACHODU. @@ -99,7 +99,7 @@ A key that should open most EAST vehicle. - Ein Schlüssel der die meisten östlichen Fahrzeuge öffnen sollte... + Ein Schlüssel der die meisten östlichen Fahrzeuge öffnen sollte. Una llave que abrirá la mayoría de vehículos orientales. Une clé qui ouvrira la plupart des véhicules EST. Klucz, który powinien otworzyć większość pojazdów WSCHODU. @@ -111,7 +111,7 @@ A key that should open most INDEP vehicle. - Ein Schlüssel der die meisten Fahrzeuge der Aufständischen öffnen sollte... + Ein Schlüssel der die meisten Fahrzeuge der Aufständischen öffnen sollte. Una llave que abrirá la mayoría de vehículos independientes. Une clé qui ouvrira la plupart des véhicules INDEP. Klucz, który powinien otworzyć większość pojazdów INDFOR. @@ -123,7 +123,7 @@ A key that should open most CIV vehicle. - Ein Schlüssel der die meisten zivilen Fahrzeuge öffnen sollte... + Ein Schlüssel der die meisten zivilen Fahrzeuge öffnen sollte. Una llave que abrirá la mayoría de vehículos civiles. Une clé qui ouvrira la plupart des véhicules CIV. Klucz, który powinien otworzyć większość pojazdów CYWILNYCH. @@ -143,6 +143,7 @@ Paramétrage du sytème de verrouillage Jármű-zár beállítás Запирание транспорта + Impostazioni Blocco Veicolo Lock Vehicle Inventory @@ -154,6 +155,7 @@ Verrouiller l'inventaire du véhicule Jármű rakodótér zárás Закрывать инвентарь транспорта + Blocca Inventario Veicolo Locks the inventory of locked vehicles @@ -165,6 +167,7 @@ Verrouille l'inventaire de véhicule fermés à clé Bezárja a zárt járművek rakterét is Закрывать инвентарь транспорта, если транспорт закрыт + Blocca l'inventario di un veicolo bloccato Vehicle Starting Lock State @@ -176,6 +179,7 @@ Etat du verrouillage du véhicule au démarrage Jármű kezdő zár-állapot Начальное состояние замков + Stato Iniziale del Blocco per Veicoli Set lock state for all vehicles (removes ambiguous lock states) @@ -187,6 +191,7 @@ 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) Устанавливает начальное состояние замков всех транспортных средств (устраняет неоднозначные состояния) + Imposta lo stato di blocco per tutti i veicoli (rimuove stati di blocco ambigui) As Is @@ -198,6 +203,7 @@ Pas de changement Úgy-ahogy Как есть + Com'è Locked @@ -209,6 +215,7 @@ Verrouillé Zárva Закрыт + Bloccato Unlocked @@ -220,6 +227,7 @@ Déverrouillé Nyitva Открыт + Sbloccato Default Lockpick Strength @@ -231,6 +239,7 @@ Force de crochetage par défaut Alapértelmezett zártörő-erősség Сила отмычки по-умолчанию + Durabilità Default del Grimaldello Default Time to lockpick (in seconds). Default: 10 @@ -242,6 +251,7 @@ Temps par défaut pour le crochetage Alapértelmezett idő a zárfeltöréshez (másodpercben). Alapértelmezett: 10 Время для взлома замка отмычкой (в секундах). По-умолчанию: 10 + Tempo Default richiesto per forzare serrature (in secondi). Default: 10 Settings for lockpick strength and initial vehicle lock state. Removes ambiguous lock states.<br />Source: vehiclelock.pbo @@ -253,6 +263,7 @@ 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 + Impostazioni per resistenza iniziale delle serrature e stato di blocco dei veicoli. Rimuove stati di blocco ambigui. <br/>Fonte: vehiclelock.pbo Vehicle Key Assign @@ -264,6 +275,7 @@ Assignation des clés de véhicule Járműkulcs-osztás Назначение ключей от транспорта + Assegna Chiavi Veicoli 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 @@ -275,6 +287,7 @@ 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 + Sincronizza con veicoli e giocatori. Distribuirà chiavi ai giocatori per ogni veicolo sincronizzato. Valido solo per oggetti presenti ad inizio missione. <br/>Fonte vehiclelock.pbo - + \ No newline at end of file diff --git a/addons/vehicles/CfgEventHandlers.hpp b/addons/vehicles/CfgEventHandlers.hpp index 2725e526bc..fb16727899 100644 --- a/addons/vehicles/CfgEventHandlers.hpp +++ b/addons/vehicles/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/vehicles/XEH_PREP.hpp b/addons/vehicles/XEH_PREP.hpp new file mode 100644 index 0000000000..ec2e27a94e --- /dev/null +++ b/addons/vehicles/XEH_PREP.hpp @@ -0,0 +1,3 @@ + +PREP(speedLimiter); +PREP(startEngine); diff --git a/addons/vehicles/XEH_preInit.sqf b/addons/vehicles/XEH_preInit.sqf index 7070aab075..a7feade1c3 100644 --- a/addons/vehicles/XEH_preInit.sqf +++ b/addons/vehicles/XEH_preInit.sqf @@ -2,7 +2,6 @@ ADDON = false; -PREP(speedLimiter); -PREP(startEngine); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/vehicles/XEH_preStart.sqf b/addons/vehicles/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/vehicles/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/vehicles/functions/fnc_speedLimiter.sqf b/addons/vehicles/functions/fnc_speedLimiter.sqf index 5f5d8a2914..2d445be3c8 100644 --- a/addons/vehicles/functions/fnc_speedLimiter.sqf +++ b/addons/vehicles/functions/fnc_speedLimiter.sqf @@ -16,8 +16,6 @@ */ #include "script_component.hpp" -private "_maxSpeed"; - params ["_driver", "_vehicle"]; if (GVAR(isSpeedLimiter)) exitWith { @@ -30,7 +28,7 @@ if (GVAR(isSpeedLimiter)) exitWith { playSound "ACE_Sound_Click"; GVAR(isSpeedLimiter) = true; -_maxSpeed = speed _vehicle max 10; +private _maxSpeed = speed _vehicle max 10; [{ params ["_args", "_idPFH"]; @@ -51,8 +49,7 @@ _maxSpeed = speed _vehicle max 10; [_idPFH] call CBA_fnc_removePerFrameHandler; }; - private "_speed"; - _speed = speed _vehicle; + private _speed = speed _vehicle; if (_speed > _maxSpeed) then { _vehicle setVelocity ((velocity _vehicle) vectorMultiply ((_maxSpeed / _speed) - 0.00001)); // fix 1.42-hotfix PhysX libraries applying force in previous direction when turning diff --git a/addons/vehicles/script_component.hpp b/addons/vehicles/script_component.hpp index af3015ab73..1f1b678acf 100644 --- a/addons/vehicles/script_component.hpp +++ b/addons/vehicles/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT vehicles #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_VEHICLES #define DEBUG_MODE_FULL #endif diff --git a/addons/vehicles/stringtable.xml b/addons/vehicles/stringtable.xml index a912701b27..dcf2348175 100644 --- a/addons/vehicles/stringtable.xml +++ b/addons/vehicles/stringtable.xml @@ -6,7 +6,7 @@ Begrenzer an Limitador de velocidad activado Ogranicznik prędkości włączony - Omezovač rychlosti zapnout + Omezovač rychlosti zapnut Limiteur de vitesse Activé Ограничение скорости включено Sebességkorlátozó bekapcsolva @@ -18,7 +18,7 @@ Begrenzer aus Limitador de velocidad desactivado Ogranicznik prędkości wyłączony - Omezovač rychlosti vypnout + Omezovač rychlosti vypnut Limiteur de vitesse Désactivé Ограничение скорости выключено Sebességkorlátozó kikapcsolva @@ -38,4 +38,4 @@ Limitatore di Velocità - + \ No newline at end of file diff --git a/addons/viewdistance/CfgEventHandlers.hpp b/addons/viewdistance/CfgEventHandlers.hpp index 423993f757..789cfeb05c 100644 --- a/addons/viewdistance/CfgEventHandlers.hpp +++ b/addons/viewdistance/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/viewdistance/XEH_PREP.hpp b/addons/viewdistance/XEH_PREP.hpp new file mode 100644 index 0000000000..fea5de5a4f --- /dev/null +++ b/addons/viewdistance/XEH_PREP.hpp @@ -0,0 +1,7 @@ + +PREP(adaptViewDistance); +PREP(changeViewDistance); +PREP(initModule); +PREP(returnObjectCoeff); +PREP(returnValue); +PREP(setFovBasedOvdPFH); diff --git a/addons/viewdistance/XEH_preInit.sqf b/addons/viewdistance/XEH_preInit.sqf index 8237a97cb9..a7feade1c3 100644 --- a/addons/viewdistance/XEH_preInit.sqf +++ b/addons/viewdistance/XEH_preInit.sqf @@ -2,11 +2,6 @@ ADDON = false; -PREP(adaptViewDistance); -PREP(changeViewDistance); -PREP(initModule); -PREP(returnObjectCoeff); -PREP(returnValue); -PREP(setFovBasedOvdPFH); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/viewdistance/XEH_preStart.sqf b/addons/viewdistance/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/viewdistance/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/viewdistance/functions/fnc_changeViewDistance.sqf b/addons/viewdistance/functions/fnc_changeViewDistance.sqf index 1e887e9538..28bba29b67 100644 --- a/addons/viewdistance/functions/fnc_changeViewDistance.sqf +++ b/addons/viewdistance/functions/fnc_changeViewDistance.sqf @@ -3,7 +3,7 @@ * Sets the player's current view distance according to allowed values. * * Arguments: - * 0: View Distance setting INDEX + * 0: View Distance setting INDEX * 1: Show Prompt * * Return Value: diff --git a/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf b/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf index e9838a0c8d..90c70b810c 100644 --- a/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf +++ b/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf @@ -3,10 +3,10 @@ * Returns the object view distance coefficient according to the given index * * Arguments: - * 0: Object View Distance setting Index + * 0: Object View Distance setting Index * * Return Value: - * Object View Distance + * Object View Distance * * Example: * [2] call ace_viewdistance_fnc_returnObjectCoeff; diff --git a/addons/viewdistance/functions/fnc_returnValue.sqf b/addons/viewdistance/functions/fnc_returnValue.sqf index 2e4263fa08..7224292fa4 100644 --- a/addons/viewdistance/functions/fnc_returnValue.sqf +++ b/addons/viewdistance/functions/fnc_returnValue.sqf @@ -3,10 +3,10 @@ * Returns the view distance value according to the given index. * * Arguments: - * 0: View Distance Index + * 0: View Distance Index * * Return Value: - * View Distance + * View Distance * * Example: * [2] call ace_viewdistance_fnc_returnViewDistanceValue diff --git a/addons/viewdistance/script_component.hpp b/addons/viewdistance/script_component.hpp index 53c4d76390..dfd04bbf9d 100644 --- a/addons/viewdistance/script_component.hpp +++ b/addons/viewdistance/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT viewdistance #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_VIEWDISTANCE #define DEBUG_MODE_FULL #endif diff --git a/addons/viewdistance/stringtable.xml b/addons/viewdistance/stringtable.xml index 673f09783d..b8261a369a 100644 --- a/addons/viewdistance/stringtable.xml +++ b/addons/viewdistance/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -11,6 +11,7 @@ Limiteur de distance de vue Látótáv-korlátozó Ограничитель дальности видимости + Limitatore Distanza Visiva Allows limiting maximum view distance that can be set by players. @@ -22,6 +23,7 @@ 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. Позволяет ограничить максимальную дальность видимости, которая может быть установлена игроками. + Consente di limitare la distanza visiva massima che può essere impostata dai giocatori. Enable ACE viewdistance @@ -33,6 +35,7 @@ Activer la distance de vue ACE ACE látótávolság engedélyezése Ограничить дальность видимости + Abilita distanza visiva ACE Enables ACE viewdistance @@ -44,6 +47,7 @@ Activer la distance de vue ACE Engedélyezi az ACE látótávolságot Включает ограничитель дальности видимости ACE + Abilita distanza visiva ACE View Distance Limit @@ -55,6 +59,7 @@ Limite de distance de vue Látótáv-korlát Дальность видимости + Limite Distanza Visiva Sets the limit for how high clients can raise their view distance (up to 10000) @@ -66,6 +71,7 @@ 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) + Imposta il limite massimo a cui i client possono alzare la propria distanza visiva (massimo 10000) Limit for client's view distance set here and can overridden by module @@ -77,6 +83,7 @@ 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 Предел дальности видимости клиентов устанавливается здесь и может быть переопределен модулем + Limite per la distanza visiva del client impostato qui e può essere scavalcato dal modulo Client View Distance (On Foot) @@ -88,6 +95,7 @@ Distance de vue (à pied) Kliens látótáv (gyalog) Дальность видимости (Пешком) + Distanza Visiva Client (a Piedi) Changes in game view distance when the player is on foot. @@ -99,6 +107,7 @@ 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. Изменяет дальность видимости в игре, когда игрок перемещается пешком. + Cambia la distanza visiva in gioco quando il giocatore è a piedi. Client View Distance (Land Vehicle) @@ -110,6 +119,7 @@ Distance de vue (à pied) Kliens látótáv (szárazföldi jármű) Дальность видимости (В наземном трансп.) + Distanza Visiva Client (Veicolo Terrestre) Changes in game view distance when the player is in a land vehicle. @@ -121,6 +131,7 @@ 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. Изменяет дальность видимости в игре, когда игрок перемещается в наземном транспорте. + Cambia la distanza visiva in gioco quando il giocatore è in un veicolo terrestre. Client View Distance (Air Vehicle) @@ -132,6 +143,7 @@ Distance de vue (véhicule aérien) Kliens látótáv (légi jármű) Дальность видимости (В воздушном трансп.) + Distanza Visiva Client (Veicoli d'Aria) Changes in game view distance when the player is in an air vehicle. @@ -143,6 +155,7 @@ 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. Изменяет дальность видимости в игре, когда игрок перемещается в воздушном транспорте. + Cambia la distanza visiva in gioco quando il giocatore è in un mezzo aereo. Dynamic Object View Distance @@ -154,6 +167,7 @@ Distance de vue pour les objet dynamique Dinamikus objektum-látótáv Динамич. дальность отрисовки объектов + Distanza Visiva Oggetti Dinamica Sets the object view distance as a coefficient of the view distance or based on field of view. FoV Based's lowest and highest value is the value which is set when enabling the option. @@ -165,6 +179,7 @@ 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. Устанавливает дальность отрисовки объектов как коэффициент от общей дальности видимости. + Imposta la distanza visiva degli oggetti come un coefficiente basato sulla distanza visiva oppure basato sul campo visivo. Off @@ -176,6 +191,7 @@ Eteint Kikapcsolva Выкл. + Disabilitato Very Low @@ -187,6 +203,7 @@ Très bas Minimális Очень низкая + Molto Basso Low @@ -198,6 +215,7 @@ Bas Alacsony Низкая + Basso Medium @@ -209,6 +227,7 @@ Moyen Közepes Средняя + Medio High @@ -220,6 +239,7 @@ Haut Magas Высокая + Alto Very High @@ -231,11 +251,16 @@ Très haut Maximális Очень высокая + Molto Alto FoV Based + Sichtfeld basierend Зависит от зума Baseado em FoV + Založeno na FoV + Oparty na FoV + Basato su Campo Visivo (FoV) View Distance: @@ -247,6 +272,7 @@ Distance de vue Látótávolság: Дальность видимости: + Distanza Visiva: Object View Distance is @@ -258,6 +284,7 @@ La distance d'affichage des objets est: Az objektum-látótávolság: Дальность видимости объектов: + Distanza Visiva Oggetti è That option is invalid! The limit is @@ -269,6 +296,7 @@ Cette option est non valide! La limite est Ez a beállítás érvénytelen! A maximum mennyiség Настройка не верна! Текущий предел + Questa opzione è invalida! Il limite è Video Settings @@ -280,6 +308,7 @@ Paramètres vidéo Videobeállítások Видео настройки + Impostazioni Video - \ No newline at end of file + diff --git a/addons/weaponselect/CfgEventHandlers.hpp b/addons/weaponselect/CfgEventHandlers.hpp index fd928fde2a..becf395052 100644 --- a/addons/weaponselect/CfgEventHandlers.hpp +++ b/addons/weaponselect/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -10,11 +16,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class GVAR(throwGrenade) { - clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(throwGrenade)}); - }; - }; -}; diff --git a/addons/weaponselect/XEH_PREP.hpp b/addons/weaponselect/XEH_PREP.hpp new file mode 100644 index 0000000000..0847c40861 --- /dev/null +++ b/addons/weaponselect/XEH_PREP.hpp @@ -0,0 +1,10 @@ + +PREP(displayGrenadeTypeAndNumber); +PREP(fireSmokeLauncher); +PREP(playChangeFiremodeSound); +PREP(putWeaponAway); +PREP(selectNextGrenade); +PREP(selectWeaponMode); +PREP(selectWeaponMuzzle); +PREP(selectWeaponVehicle); +PREP(throwGrenade); diff --git a/addons/weaponselect/XEH_postInit.sqf b/addons/weaponselect/XEH_postInit.sqf index 491a86f39d..2e03982fec 100644 --- a/addons/weaponselect/XEH_postInit.sqf +++ b/addons/weaponselect/XEH_postInit.sqf @@ -8,7 +8,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false}; // Statement [ACE_player, handgunWeapon ACE_player] call FUNC(selectWeaponMode); @@ -21,7 +21,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false}; // Statement [ACE_player, primaryWeapon ACE_player] call FUNC(selectWeaponMode); @@ -34,7 +34,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false}; // Statement [ACE_player, primaryWeapon ACE_player] call FUNC(selectWeaponMuzzle); @@ -47,7 +47,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false}; // Statement [ACE_player, secondaryWeapon ACE_player] call FUNC(selectWeaponMode); @@ -60,7 +60,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false}; // Statement [ACE_player, binocular ACE_player] call FUNC(selectWeaponMode); @@ -73,7 +73,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false}; // Statement [ACE_player, 1] call FUNC(selectNextGrenade); @@ -86,7 +86,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false}; // Statement [ACE_player, 2] call FUNC(selectNextGrenade); @@ -99,14 +99,13 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false}; // Statement if ((currentWeapon ACE_player) != "") then { [ACE_player] call FUNC(putWeaponAway); } else { - private ["_weapon"]; - _weapon = switch (true) do { + private _weapon = switch (true) do { case ((primaryWeapon ACE_player) != ""): {primaryWeapon ACE_player}; case ((handgunWeapon ACE_player) != ""): {handgunWeapon ACE_player}; case ((secondaryWeapon ACE_player) != ""): {secondaryWeapon ACE_player}; @@ -196,3 +195,7 @@ if (!hasInterface) exitWith {}; }, {false}, [10, [false, false, false]], false] call CBA_fnc_addKeybind; //9 Key + + +// Register fire event handler +["firedPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); diff --git a/addons/weaponselect/XEH_preInit.sqf b/addons/weaponselect/XEH_preInit.sqf index fe40d33523..b457e10cad 100644 --- a/addons/weaponselect/XEH_preInit.sqf +++ b/addons/weaponselect/XEH_preInit.sqf @@ -2,31 +2,21 @@ ADDON = false; -PREP(displayGrenadeTypeAndNumber); -PREP(fireSmokeLauncher); -PREP(playChangeFiremodeSound); -PREP(putWeaponAway); -PREP(selectNextGrenade); -PREP(selectWeaponMode); -PREP(selectWeaponMuzzle); -PREP(selectWeaponVehicle); -PREP(throwGrenade); +#include "XEH_PREP.hpp" // collect frag and other grenades separately GVAR(GrenadesAll) = []; GVAR(GrenadesFrag) = []; GVAR(GrenadesNonFrag) = []; -private ["_magazines", "_ammo", "_explosive"]; - { - _magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines"); + private _magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines"); GVAR(GrenadesAll) append _magazines; { - _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); - _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive"); + private _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); + private _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive"); ([GVAR(GrenadesFrag), GVAR(GrenadesNonFrag)] select (_explosive == 0)) pushBack _x; false diff --git a/addons/weaponselect/XEH_preStart.sqf b/addons/weaponselect/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/weaponselect/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf index 4ab09a105f..ef9397ba57 100644 --- a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf +++ b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf @@ -20,12 +20,10 @@ if !(GVAR(DisplayText)) exitWith {}; params ["_magazine", "_numberofGrenades"]; -private ["_color", "_name", "_text", "_picture"]; +private _color = [[1, 0, 0], [1, 1, 1]] select (_numberofGrenades > 0); +private _name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort"); -_color = [[1, 0, 0], [1, 1, 1]] select (_numberofGrenades > 0); -_name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort"); - -_text = [format ["%1 x%2", _name, _numberofGrenades], _color] call EFUNC(common,stringToColoredText); -_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); +private _text = [format ["%1 x%2", _name, _numberofGrenades], _color] call EFUNC(common,stringToColoredText); +private _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); ["displayTextPicture", [_text, _picture]] call EFUNC(common,localEvent); diff --git a/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf b/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf index 71ef89ecf6..bb877ea3cd 100644 --- a/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf +++ b/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf @@ -17,11 +17,8 @@ params ["_vehicle"]; -private ["_turret", "_weapons"]; - -_turret = [_vehicle] call EFUNC(common,getTurretCommander); - -_weapons = _vehicle weaponsTurret _turret; +private _turret = _vehicle call EFUNC(common,getTurretCommander); +private _weapons = _vehicle weaponsTurret _turret; if ( count _weapons > 1 @@ -32,8 +29,8 @@ if ( // avoid infinite loop if !("SmokeLauncher" in _weapons) exitWith {}; - private "_index"; - _index = 0; + private _index = 0; + while { _vehicle currentWeaponTurret _turret != "SmokeLauncher" } do { @@ -44,8 +41,7 @@ if ( } else { // fire away! - private "_logic"; - _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"]; + private _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"]; _logic action ["useWeapon", _vehicle, commander _vehicle, 0]; diff --git a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf index 28ef5d21e5..a7c3f13936 100644 --- a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf +++ b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf @@ -18,14 +18,12 @@ params ["_unit", "_weapon"]; -private ["_sound", "_position"]; - -_sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound"); +private _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound"); if (_sound isEqualTo []) exitWith {}; // get position where to play the sound (position of the weapon) -_position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand")); +private _position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand")); _sound params ["_filename", ["_volume", 1], ["_soundPitch", 1], ["_distance", 0]]; diff --git a/addons/weaponselect/functions/fnc_putWeaponAway.sqf b/addons/weaponselect/functions/fnc_putWeaponAway.sqf index fd1e463a4d..d2747bf23f 100644 --- a/addons/weaponselect/functions/fnc_putWeaponAway.sqf +++ b/addons/weaponselect/functions/fnc_putWeaponAway.sqf @@ -17,6 +17,6 @@ params ["_unit"]; -[_unit] call EFUNC(common,fixLoweredRifleAnimation); +_unit call EFUNC(common,fixLoweredRifleAnimation); _unit action ["SwitchWeapon", _unit, _unit, 99]; diff --git a/addons/weaponselect/functions/fnc_selectNextGrenade.sqf b/addons/weaponselect/functions/fnc_selectNextGrenade.sqf index d4a00b5718..f4b48a1b1e 100644 --- a/addons/weaponselect/functions/fnc_selectNextGrenade.sqf +++ b/addons/weaponselect/functions/fnc_selectNextGrenade.sqf @@ -18,10 +18,8 @@ params ["_unit", ["_type", 0]]; -private ["_currentGrenade", "_magazines", "_grenades", "_nextGrenadeIndex", "_nextGrenade", "_uniformGrenades", "_vestGrenades", "_backpackGrenades"]; - // get currently selected grenade -_currentGrenade = currentThrowable _unit; +private _currentGrenade = currentThrowable _unit; // get correct array format if no grenade is selected if (_currentGrenade isEqualTo []) then { @@ -31,9 +29,9 @@ if (_currentGrenade isEqualTo []) then { _currentGrenade = _currentGrenade select 0; // get available magazines for that unit -_magazines = magazines _unit; +private _magazines = magazines _unit; -_grenades = []; +private _grenades = []; { if (_x in _magazines) then { @@ -46,22 +44,22 @@ _grenades = []; if (_grenades isEqualTo []) exitWith {false}; // get next grenade muzzle -_nextGrenadeIndex = (_grenades find _currentGrenade) + 1; +private _nextGrenadeIndex = (_grenades find _currentGrenade) + 1; // roll over if the last grenade was selected if (_nextGrenadeIndex >= count _grenades) then { _nextGrenadeIndex = 0; }; -_nextGrenade = _grenades select _nextGrenadeIndex; +private _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); +private _uniformGrenades = uniformItems _unit select {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}; +private _vestGrenades = vestItems _unit select {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}; +private _backpackGrenades = backpackItems _unit select {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}; // remove all grenades except those we are switching to --> this breaks the selector {_unit removeItemFromUniform _x; false} count _uniformGrenades; diff --git a/addons/weaponselect/functions/fnc_selectWeaponMode.sqf b/addons/weaponselect/functions/fnc_selectWeaponMode.sqf index 815b8d28cf..80784778de 100644 --- a/addons/weaponselect/functions/fnc_selectWeaponMode.sqf +++ b/addons/weaponselect/functions/fnc_selectWeaponMode.sqf @@ -29,20 +29,18 @@ if (_weapon in (_unit getVariable [QEGVAR(safemode,safedWeapons), []])) exitWith [_unit, _weapon, _weapon] call EFUNC(safemode,unlockSafety); }; -private ["_muzzles", "_modes"]; +private _muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles); +private _modes = [_weapon] call EFUNC(common,getWeaponModes); -_muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles); -_modes = [_weapon] call EFUNC(common,getWeaponModes); +private _index = (_modes find currentWeaponMode _unit) + 1; -private ["_index", "_muzzle", "_mode"]; - -_index = (_modes find currentWeaponMode _unit) + 1; if (_index > count _modes - 1) then {_index = 0}; -_muzzle = _muzzles select 0; -_mode = _modes select _index; +private _muzzle = _muzzles select 0; +private _mode = _modes select _index; _index = 0; + while { _index < 100 && {currentMuzzle _unit != _muzzle || {currentWeaponMode _unit != _mode}} } do { diff --git a/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf b/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf index 71c9cfc7b4..973d34f7c8 100644 --- a/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf +++ b/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf @@ -20,8 +20,7 @@ params ["_unit", "_weapon"]; if (_weapon == "") exitWith {}; -private "_muzzles"; -_muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles); +private _muzzles = _weapon call EFUNC(common,getWeaponMuzzles); if (currentWeapon _unit != _weapon) exitWith { if (count _muzzles > 1) then { @@ -35,12 +34,11 @@ if (currentWeapon _unit != _weapon) exitWith { }; }; -private ["_index", "_muzzle"]; +private _index = (_muzzles find currentMuzzle _unit) + 1; -_index = (_muzzles find currentMuzzle _unit) + 1; if (_index > count _muzzles - 1) then {_index = 1}; -_muzzle = _muzzles select _index; +private _muzzle = _muzzles select _index; _index = 0; while { diff --git a/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf b/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf index 9695079da5..7435dd30d8 100644 --- a/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf +++ b/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf @@ -19,39 +19,36 @@ params ["_unit", "_vehicle", "_index"]; -private "_turret"; -_turret = [_unit] call EFUNC(common,getTurretIndex); +private _turret = _unit call EFUNC(common,getTurretIndex); if (_turret isEqualTo [] && {_unit == driver _vehicle}) then { - private ["_weapons", "_weapon"]; + private _weapons = weapons _vehicle; - _weapons = weapons _vehicle; if (_index > count _weapons - 1) exitWith {}; - _weapon = _weapons select _index; + private _weapon = _weapons select _index; _index = 0; + while { _index < 100 && {currentWeapon _vehicle != _weapon} } do { _unit action ["SwitchWeapon", _vehicle, _unit, _index]; _index = _index + 1; }; - } else { - private ["_weapons", "_weapon"]; + private _weapons = _vehicle weaponsTurret _turret; - _weapons = _vehicle weaponsTurret _turret; if (_index > count _weapons - 1) exitWith {}; - _weapon = _weapons select _index; + private _weapon = _weapons select _index; _index = 0; + while { _index < 100 && {_vehicle currentWeaponTurret _turret != _weapon} } do { _unit action ["SwitchWeapon", _vehicle, _unit, _index]; _index = _index + 1; }; - }; diff --git a/addons/weaponselect/functions/fnc_throwGrenade.sqf b/addons/weaponselect/functions/fnc_throwGrenade.sqf index 2cdc8e63dc..3f55e02f51 100644 --- a/addons/weaponselect/functions/fnc_throwGrenade.sqf +++ b/addons/weaponselect/functions/fnc_throwGrenade.sqf @@ -1,15 +1,9 @@ /* * Author: commy2 - * Display Grenade information on grenade throw. + * Display Grenade information on grenade throw. Called from the unified fired EH only for the local player. * * Arguments: - * 0: unit - Object the event handler is assigned to - * 1: weapon - Fired weapon - * 2: muzzle - Muzzle that was used - * 3: mode - Current mode of the fired weapon - * 4: ammo - Ammo used - * 5: magazine - magazine name which was used - * 6: projectile - Object of the projectile that was shot + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -21,12 +15,12 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon", "", "", "", "_magazine"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); if (_weapon != "Throw") exitWith {}; -private "_count"; -_count = {_x == _magazine} count magazines _unit; +private _count = {_x == _magazine} count magazines _unit; [_magazine, _count] call FUNC(displayGrenadeTypeAndNumber); diff --git a/addons/weaponselect/script_component.hpp b/addons/weaponselect/script_component.hpp index eec47cc4b1..7ab95f9887 100644 --- a/addons/weaponselect/script_component.hpp +++ b/addons/weaponselect/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT weaponselect #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_WEAPONSELECT #define DEBUG_MODE_FULL #endif diff --git a/addons/weaponselect/stringtable.xml b/addons/weaponselect/stringtable.xml index c9a8e43f60..4a273a6cf3 100644 --- a/addons/weaponselect/stringtable.xml +++ b/addons/weaponselect/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/weather/CfgEventhandlers.hpp b/addons/weather/CfgEventhandlers.hpp index 842ad8e7bf..74dfaab913 100644 --- a/addons/weather/CfgEventhandlers.hpp +++ b/addons/weather/CfgEventhandlers.hpp @@ -1,8 +1,16 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; + class Extended_PostInit_EventHandlers { class ADDON { serverInit = QUOTE(call COMPILE_FILE(XEH_PostServerInit)); diff --git a/addons/weather/CfgVehicles.hpp b/addons/weather/CfgVehicles.hpp index f37a62449a..f98a1e50f5 100644 --- a/addons/weather/CfgVehicles.hpp +++ b/addons/weather/CfgVehicles.hpp @@ -53,4 +53,4 @@ class CfgVehicles { description = CSTRING(Module_Description); }; }; -}; \ No newline at end of file +}; diff --git a/addons/weather/CfgWorlds.hpp b/addons/weather/CfgWorlds.hpp index 1391468fd9..dd0a616272 100644 --- a/addons/weather/CfgWorlds.hpp +++ b/addons/weather/CfgWorlds.hpp @@ -48,4 +48,4 @@ class CfgWorlds { {0.08, 0.38, 0.06, 0.04, 0.19, 0.03, 0.02, 0.02}, // November {0.06, 0.37, 0.05, 0.03, 0.18, 0.04, 0.02, 0.02}};// December }; -}; \ No newline at end of file +}; diff --git a/addons/weather/RscTitles.hpp b/addons/weather/RscTitles.hpp index aedebdabfc..d89c8d0671 100644 --- a/addons/weather/RscTitles.hpp +++ b/addons/weather/RscTitles.hpp @@ -1,17 +1,13 @@ -class RscTitles -{ - class RscWindIntuitive - { +class RscTitles { + class RscWindIntuitive { idd=-1; onLoad="with uiNameSpace do { RscWindIntuitive = _this select 0 };"; movingEnable=0; duration=60; fadeIn="false"; fadeOut="false"; - class controls - { - class RscWindIntuitive - { + class controls { + class RscWindIntuitive { idc=132948; type=0; style=48; @@ -28,4 +24,4 @@ class RscTitles }; }; }; -}; \ No newline at end of file +}; diff --git a/addons/weather/UI/wind0.paa b/addons/weather/UI/wind0.paa deleted file mode 100644 index c049caf47e..0000000000 Binary files a/addons/weather/UI/wind0.paa and /dev/null differ diff --git a/addons/weather/UI/wind1.paa b/addons/weather/UI/wind1.paa deleted file mode 100644 index 47d996fe67..0000000000 Binary files a/addons/weather/UI/wind1.paa and /dev/null differ diff --git a/addons/weather/UI/wind10.paa b/addons/weather/UI/wind10.paa deleted file mode 100644 index a9bcd49c1b..0000000000 Binary files a/addons/weather/UI/wind10.paa and /dev/null differ diff --git a/addons/weather/UI/wind11.paa b/addons/weather/UI/wind11.paa deleted file mode 100644 index 469cdedada..0000000000 Binary files a/addons/weather/UI/wind11.paa and /dev/null differ diff --git a/addons/weather/UI/wind2.paa b/addons/weather/UI/wind2.paa deleted file mode 100644 index 585944af45..0000000000 Binary files a/addons/weather/UI/wind2.paa and /dev/null differ diff --git a/addons/weather/UI/wind3.paa b/addons/weather/UI/wind3.paa deleted file mode 100644 index 16b823a9f3..0000000000 Binary files a/addons/weather/UI/wind3.paa and /dev/null differ diff --git a/addons/weather/UI/wind4.paa b/addons/weather/UI/wind4.paa deleted file mode 100644 index a5bd119889..0000000000 Binary files a/addons/weather/UI/wind4.paa and /dev/null differ diff --git a/addons/weather/UI/wind5.paa b/addons/weather/UI/wind5.paa deleted file mode 100644 index 43398e2960..0000000000 Binary files a/addons/weather/UI/wind5.paa and /dev/null differ diff --git a/addons/weather/UI/wind6.paa b/addons/weather/UI/wind6.paa deleted file mode 100644 index 3bd9a9c676..0000000000 Binary files a/addons/weather/UI/wind6.paa and /dev/null differ diff --git a/addons/weather/UI/wind7.paa b/addons/weather/UI/wind7.paa deleted file mode 100644 index a7bb1d5942..0000000000 Binary files a/addons/weather/UI/wind7.paa and /dev/null differ diff --git a/addons/weather/UI/wind8.paa b/addons/weather/UI/wind8.paa deleted file mode 100644 index e51ad530c5..0000000000 Binary files a/addons/weather/UI/wind8.paa and /dev/null differ diff --git a/addons/weather/UI/wind9.paa b/addons/weather/UI/wind9.paa deleted file mode 100644 index 016ca49f7c..0000000000 Binary files a/addons/weather/UI/wind9.paa and /dev/null differ diff --git a/addons/weather/UI/wind_arrow_ca.paa b/addons/weather/UI/wind_arrow_ca.paa new file mode 100644 index 0000000000..7554936ba1 Binary files /dev/null and b/addons/weather/UI/wind_arrow_ca.paa differ diff --git a/addons/weather/UI/wind_dot_ca.paa b/addons/weather/UI/wind_dot_ca.paa new file mode 100644 index 0000000000..8286ffab2d Binary files /dev/null and b/addons/weather/UI/wind_dot_ca.paa differ diff --git a/addons/weather/UI/wind12.paa b/addons/weather/UI/wind_noneCircle_ca.paa similarity index 100% rename from addons/weather/UI/wind12.paa rename to addons/weather/UI/wind_noneCircle_ca.paa diff --git a/addons/weather/XEH_PREP.hpp b/addons/weather/XEH_PREP.hpp new file mode 100644 index 0000000000..b13b938892 --- /dev/null +++ b/addons/weather/XEH_PREP.hpp @@ -0,0 +1,23 @@ + +PREP(calculateAirDensity); +PREP(calculateBarometricPressure); +PREP(calculateDensityAltitude); +PREP(calculateDewPoint); +PREP(calculateHeatIndex); +PREP(calculateRoughnessLength); +PREP(calculateSpeedOfSound); +PREP(calculateTemperatureAtHeight); +PREP(calculateWetBulb); +PREP(calculateWindChill); +PREP(calculateWindSpeed); +PREP(displayWindInfo); +PREP(getMapData); +PREP(getWind); +PREP(initModuleSettings); +PREP(initWind); +PREP(serverController); +PREP(updateAceWeather); +PREP(updateHumidity); +PREP(updateRain); +PREP(updateTemperature); +PREP(updateWind); diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index c6f779358f..a19e000332 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -14,6 +14,7 @@ GVAR(ACE_rain) = rain; "ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = ACE_time; }; "ACE_MISC_PARAMS" addPublicVariableEventHandler { if (!isServer) then { + TRACE_1("MISC PARAMS PVEH",ACE_MISC_PARAMS); if (GVAR(syncMisc)) then { 30 setLightnings (ACE_MISC_PARAMS select 0); 30 setRainbow (ACE_MISC_PARAMS select 1); @@ -27,10 +28,11 @@ GVAR(ACE_rain) = rain; }; }; +GVAR(WindInfo) = false; ["ACE3 Common", QGVAR(WindInfoKey), localize LSTRING(WindInfoKey), { // Conditions: canInteract - if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Statement [] call FUNC(displayWindInfo); @@ -40,12 +42,40 @@ GVAR(ACE_rain) = rain; simulWeatherSync; -[FUNC(updateTemperature), 20, []] call CBA_fnc_addPerFrameHandler; -[FUNC(updateHumidity), 20, []] call CBA_fnc_addPerFrameHandler; -[FUNC(updateWind), 1, []] call CBA_fnc_addPerFrameHandler; -[FUNC(updateRain), 2, []] call CBA_fnc_addPerFrameHandler; -[{ + + + +["SettingsInitialized",{ + TRACE_1("SettingsInitialized",GVAR(syncRain)); + + //Create a 0 sec delay PFEH to update rain every frame: if (GVAR(syncRain)) then { - 0 setRain GVAR(ACE_rain); + [{ + 0 setRain GVAR(ACE_rain); + }, 0, []] call CBA_fnc_addPerFrameHandler; }; -}, 0, []] call CBA_fnc_addPerFrameHandler; \ No newline at end of file + + //Create a 1 sec delay PFEH to update wind/rain/temp/humidity: + + //If we don't sync rain, set next time to infinity + GVAR(nextUpdateRain) = if (GVAR(syncRain)) then {0} else {1e99}; + GVAR(nextUpdateTempAndHumidity) = 0; + [{ + BEGIN_COUNTER(weatherPFEH); + + [] call FUNC(updateWind); //Every 1 second + + if (ACE_time >= GVAR(nextUpdateRain)) then { + [] call FUNC(updateRain); //Every 2 seconds + GVAR(nextUpdateRain) = 2 + ACE_time; + }; + if (ACE_time >= GVAR(nextUpdateTempAndHumidity)) then { + [] call FUNC(updateTemperature); //Every 20 seconds + [] call FUNC(updateHumidity); //Every 20 seconds + GVAR(nextUpdateTempAndHumidity) = 20 + ACE_time; + }; + + END_COUNTER(weatherPFEH); + }, 1, []] call CBA_fnc_addPerFrameHandler; + +}] call EFUNC(common,addEventHandler); diff --git a/addons/weather/XEH_postServerInit.sqf b/addons/weather/XEH_postServerInit.sqf index aa733afa5d..f7b830b11d 100644 --- a/addons/weather/XEH_postServerInit.sqf +++ b/addons/weather/XEH_postServerInit.sqf @@ -9,4 +9,10 @@ GVAR(rain_current_range) = -1+(random 2); // Wind call FUNC(initWind); -[FUNC(serverController), GVAR(serverUpdateInterval)] call CBA_fnc_addPerFrameHandler; +["SettingsInitialized", { + TRACE_2("SettingsInitialized",GVAR(enableServerController),GVAR(serverUpdateInterval)); + + if (GVAR(enableServerController)) then { + [FUNC(serverController), GVAR(serverUpdateInterval)] call CBA_fnc_addPerFrameHandler; + }; +}] call EFUNC(common,addEventHandler); diff --git a/addons/weather/XEH_preInit.sqf b/addons/weather/XEH_preInit.sqf index eb5291334a..f0161c7173 100644 --- a/addons/weather/XEH_preInit.sqf +++ b/addons/weather/XEH_preInit.sqf @@ -3,28 +3,7 @@ ADDON = false; -PREP(calculateAirDensity); -PREP(calculateBarometricPressure); -PREP(calculateDensityAltitude); -PREP(calculateDewPoint); -PREP(calculateHeatIndex); -PREP(calculateRoughnessLength); -PREP(calculateSpeedOfSound); -PREP(calculateTemperatureAtHeight); -PREP(calculateWetBulb); -PREP(calculateWindChill); -PREP(calculateWindSpeed); -PREP(displayWindInfo); -PREP(getMapData); -PREP(getWind); -PREP(initModuleSettings); -PREP(initWind); -PREP(serverController); -PREP(updateAceWeather); -PREP(updateHumidity); -PREP(updateRain); -PREP(updateTemperature); -PREP(updateWind); +#include "XEH_PREP.hpp" // Make sure this data is read before client/server postInit call FUNC(getMapData); diff --git a/addons/weather/XEH_preStart.sqf b/addons/weather/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/weather/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/weather/functions/fnc_calculateAirDensity.sqf b/addons/weather/functions/fnc_calculateAirDensity.sqf index f3de65f99d..bda8410ddd 100644 --- a/addons/weather/functions/fnc_calculateAirDensity.sqf +++ b/addons/weather/functions/fnc_calculateAirDensity.sqf @@ -1,18 +1,19 @@ /* * Author: Ruthberg - * * Calculates the air density * * Arguments: - * 0: temperature - degrees celcius + * 0: temperature - degrees celsius * 1: pressure - hPa * 2: relativeHumidity - value between 0.0 and 1.0 * * Return Value: * density of air - kg * m^(-3) * - * Return value: - * None + * Example: + * [0, 1020, 0.5] call ace_weather_fnc_calculateAirDensity + * + * Public: No */ #include "script_component.hpp" @@ -21,11 +22,10 @@ params ["_temperature", "_pressure", "_relativeHumidity"]; _pressure = _pressure * 100; // hPa to Pa if (_relativeHumidity > 0) then { - private ["_pSat", "_vaporPressure", "_partialPressure"]; // Saturation vapor pressure calculated according to: http://wahiduddin.net/calc/density_algorithms.htm - _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3)); - _vaporPressure = _relativeHumidity * _pSat; - _partialPressure = _pressure - _vaporPressure; + private _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3)); + private _vaporPressure = _relativeHumidity * _pSat; + private _partialPressure = _pressure - _vaporPressure; (_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature)) } else { diff --git a/addons/weather/functions/fnc_calculateBarometricPressure.sqf b/addons/weather/functions/fnc_calculateBarometricPressure.sqf index 134a741127..29b8fa7877 100644 --- a/addons/weather/functions/fnc_calculateBarometricPressure.sqf +++ b/addons/weather/functions/fnc_calculateBarometricPressure.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Calculates the barometric pressure based on altitude and weather * * Arguments: @@ -9,8 +8,10 @@ * Return Value: * barometric pressure - hPA * - * Return value: - * None + * Example: + * 0 call ace_weather_fnc_calculateBarometricPressure + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateDensityAltitude.sqf b/addons/weather/functions/fnc_calculateDensityAltitude.sqf index 97889e2499..8dea9849b1 100644 --- a/addons/weather/functions/fnc_calculateDensityAltitude.sqf +++ b/addons/weather/functions/fnc_calculateDensityAltitude.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Calculates density altitude for a given air density * * Arguments: @@ -9,8 +8,10 @@ * Return Value: * density altitude - m * - * Return value: - * None + * Example: + * 1.225 call ace_weather_fnc_calculateDensityAltitude + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateDewPoint.sqf b/addons/weather/functions/fnc_calculateDewPoint.sqf index cbfc606054..81db9565dc 100644 --- a/addons/weather/functions/fnc_calculateDewPoint.sqf +++ b/addons/weather/functions/fnc_calculateDewPoint.sqf @@ -1,17 +1,18 @@ /* * Author: Ruthberg - * * Calculates dew point based on temperature and relative humidity * * Arguments: - * 0: temperature - degrees celcius - * 2: relativeHumidity - value between 0.0 and 1.0 + * 0: temperature - degrees celsius + * 1: relativeHumidity - value between 0.0 and 1.0 * * Return Value: * dew point * - * Return value: - * None + * Example: + * [32, 0.4] call ace_weather_fnc_calculateDewPoint + * + * Public: No */ #include "script_component.hpp" @@ -24,7 +25,6 @@ if (_rh == 0) exitWith { CELSIUS(0) }; // Source: https://en.wikipedia.org/wiki/Dew_point -private ["_gamma"]; -_gamma = ln(_rh) + (__b * _t) / (__c + _t); +private _gamma = ln(_rh) + (__b * _t) / (__c + _t); (__c * _gamma) / (__b - _gamma) diff --git a/addons/weather/functions/fnc_calculateHeatIndex.sqf b/addons/weather/functions/fnc_calculateHeatIndex.sqf index 057c13d7ad..a4626128de 100644 --- a/addons/weather/functions/fnc_calculateHeatIndex.sqf +++ b/addons/weather/functions/fnc_calculateHeatIndex.sqf @@ -1,17 +1,18 @@ /* * Author: Ruthberg - * * Calculates heat index based on temperature and relative humidity * * Arguments: - * 0: temperature - degrees celcius + * 0: temperature - degrees celsius * 1: relativeHumidity - value between 0.0 and 1.0 * * Return Value: * heat index * - * Return value: - * None + * Example: + * [36, 0.75] call ace_weather_fnc_calculateHeatIndex + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateRoughnessLength.sqf b/addons/weather/functions/fnc_calculateRoughnessLength.sqf index 4fd0d18fb3..423f3fc3d6 100644 --- a/addons/weather/functions/fnc_calculateRoughnessLength.sqf +++ b/addons/weather/functions/fnc_calculateRoughnessLength.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Calculates the terrain roughness length at a given world position * * Arguments: @@ -9,19 +8,20 @@ * Return Value: * roughness length * + * Example: + * (getPosASL player) call ace_weather_fnc_calculateRoughnessLength + * * Public: No */ #include "script_component.hpp" -private ["_roughness_lengths", "_windSource", "_nearBuildings", "_isWater"]; - // Source: http://es.ucsc.edu/~jnoble/wind/extrap/index.html -_roughness_lengths = [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6]; +#define ROUGHNESS_LENGTHS [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6] -_windSource = _this vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 25); +private _windSource = _this vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 25); -_nearBuildings = count (_windSource nearObjects ["Building", 50]); -_isWater = surfaceIsWater _windSource; +private _nearBuildings = count (_windSource nearObjects ["Building", 50]); +private _isWater = surfaceIsWater _windSource; if (_nearBuildings == 0 && _isWater) exitWith { 0.0005 @@ -31,4 +31,4 @@ if (_nearBuildings >= 10) exitWith { 1.6 }; -_roughness_lengths select (2 + (_nearBuildings min 6)) +ROUGHNESS_LENGTHS select (2 + (_nearBuildings min 6)) diff --git a/addons/weather/functions/fnc_calculateSpeedOfSound.sqf b/addons/weather/functions/fnc_calculateSpeedOfSound.sqf index 322ba75ac5..f645ba2368 100644 --- a/addons/weather/functions/fnc_calculateSpeedOfSound.sqf +++ b/addons/weather/functions/fnc_calculateSpeedOfSound.sqf @@ -1,16 +1,17 @@ /* * Author: Ruthberg - * * Calculates the speed of sound for a given temperature * * Arguments: - * temperature - degrees celcius + * temperature - degrees celsius * * Return Value: * speed of sound - m/s * - * Return value: - * None + * Example: + * 0 call ace_weather_fnc_calculateSpeedOfSound + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf b/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf index 5e02795d59..e33b8213eb 100644 --- a/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf +++ b/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Calculates the temperature based on altitude and weather * * Arguments: @@ -9,8 +8,10 @@ * Return Value: * temperature - degrees celsius * - * Return value: - * None + * Example: + * 500 call ace_weather_fnc_calculateTemperatureAtHeight + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateWetBulb.sqf b/addons/weather/functions/fnc_calculateWetBulb.sqf index 94e96cd11b..a8a58b0dc3 100644 --- a/addons/weather/functions/fnc_calculateWetBulb.sqf +++ b/addons/weather/functions/fnc_calculateWetBulb.sqf @@ -1,36 +1,35 @@ /* * Author: Ruthberg - * * Calculates wet bulb based on temperature and relative humidity * * Arguments: - * 0: temperature - degrees celcius + * 0: temperature - degrees celsius * 1: pressure - hPa * 2: relativeHumidity - value between 0.0 and 1.0 * * Return Value: * wet bulb * - * Return value: - * None + * Example: + * [0, 1020, 0.5] call ace_weather_fnc_calculateWetBulb + * + * Public: No */ #include "script_component.hpp" -private ["_es", "_e", "_eDiff", "_eGuessPrev", "_cTempDelta", "_twGuess", "_eguess"]; - 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)); -_e = _es * _relativeHumidity; -_eDiff = _es - _e; -_eGuessPrev = _es; -_cTempDelta = 3.3145; -_twGuess = _temperature; +private _es = 6.112 * exp((17.67 * _temperature) / (_temperature + 243.5)); +private _e = _es * _relativeHumidity; +private _eDiff = _es - _e; +private _eGuessPrev = _es; +private _cTempDelta = 3.3145; +private _twGuess = _temperature; for "_j" from 1 to 50 do { _twGuess = _twGuess - _cTempDelta; - _eguess = 6.112 * exp((17.67 * _twGuess) / (_twGuess + 243.5)); + private _eguess = 6.112 * exp((17.67 * _twGuess) / (_twGuess + 243.5)); _eguess = _eguess - (_pressure * (_temperature - _twGuess) * 0.00066 * (1 + (0.00115 * _twGuess))); _eDiff = _eguess - _e; if (abs(_eDiff) <= 0.001) exitWith {}; diff --git a/addons/weather/functions/fnc_calculateWindChill.sqf b/addons/weather/functions/fnc_calculateWindChill.sqf index ee3a20283b..0e17d53377 100644 --- a/addons/weather/functions/fnc_calculateWindChill.sqf +++ b/addons/weather/functions/fnc_calculateWindChill.sqf @@ -1,15 +1,17 @@ /* * Author: Ruthberg - * * Calculates wind chill based on temperature and wind speed * * Arguments: - * 0: temperature - degrees celcius + * 0: temperature - degrees celsius * 1: wind speed - m/s * * Return Value: * wind chill * + * Example: + * [0, 10] call ace_weather_fnc_calculateWindChill + * * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateWindSpeed.sqf b/addons/weather/functions/fnc_calculateWindSpeed.sqf index 87c6c49d42..206bc1d298 100644 --- a/addons/weather/functions/fnc_calculateWindSpeed.sqf +++ b/addons/weather/functions/fnc_calculateWindSpeed.sqf @@ -1,43 +1,42 @@ /* * Author: Ruthberg - * * Calculates the true wind speed at a given world position * * Arguments: * 0: world position - posASL - * 1: Account for wind gradient + * 1: Account for wind gradient (used in advanced ballistics) * 2: Account for terrain * 3: Account for obstacles * * Return Value: * wind speed - m/s * + * Example: + * [eyePos ACE_player, true, true, true] call ace_weather_fnc_calculateWindSpeed; + * * Public: No */ #include "script_component.hpp" -private ["_fnc_polar2vect", "_windSpeed", "_windDir", "_windDirAdjusted", "_height", "_newWindSpeed", "_windSource", "_roughnessLength"]; - params ["_position", "_windGradientEnabled", "_terrainEffectEnabled", "_obstacleEffectEnabled"]; -_fnc_polar2vect = { - private ["_mag2D"]; - params ["_x", "_y", "_z"]; - _mag2D = _x * cos(_z); - [_mag2D * sin(_y), _mag2D * cos(_y), _x * sin(_z)]; +private _fnc_polar2vect = { + params ["_mag","_dir","_elev"]; + private _mag2D = _mag * cos(_elev); + [_mag2D * sin(_dir), _mag2D * cos(_dir), _mag * sin(_elev)]; }; -_windSpeed = vectorMagnitude ACE_wind; -_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); -_windDirAdjusted = _windDir + 180; +private _windSpeed = vectorMagnitude ACE_wind; +private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); +private _windDirAdjusted = _windDir + 180; // Wind gradient if (_windGradientEnabled) then { if (_windSpeed > 0.05) then { - _height = (ASLToATL _position) select 2; + private _height = (ASLToATL _position) select 2; _height = 0 max _height min 20; if (_height < 20) then { - _roughnessLength = _position call FUNC(calculateRoughnessLength); + private _roughnessLength = _position call FUNC(calculateRoughnessLength); _windSpeed = _windSpeed * abs(ln(_height / _roughnessLength) / ln(20 / _roughnessLength)); }; }; @@ -46,9 +45,9 @@ if (_windGradientEnabled) then { // Terrain effect on wind if (_terrainEffectEnabled) then { if (_windSpeed > 0.05) then { - _newWindSpeed = 0; + private _newWindSpeed = 0; { - _windSource = [100, _windDirAdjusted, _x] call _fnc_polar2vect; + private _windSource = [100, _windDirAdjusted, _x] call _fnc_polar2vect; if (!(terrainIntersectASL [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 9) * _windSpeed; }; @@ -60,6 +59,7 @@ if (_terrainEffectEnabled) then { if (!(terrainIntersectASL [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 9) * _windSpeed; }; + nil } count [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; _windSpeed = _newWindSpeed; }; @@ -68,9 +68,9 @@ if (_terrainEffectEnabled) then { // Obstacle effect on wind if (_obstacleEffectEnabled) then { if (_windSpeed > 0.05) then { - _newWindSpeed = 0; + private _newWindSpeed = 0; { - _windSource = [20, _windDirAdjusted, _x] call _fnc_polar2vect; + private _windSource = [20, _windDirAdjusted, _x] call _fnc_polar2vect; if (!(lineIntersects [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 2) * _windSpeed; }; @@ -82,6 +82,7 @@ if (_obstacleEffectEnabled) then { if (!(lineIntersects [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 2) * _windSpeed; }; + nil } count [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]; _windSpeed = _newWindSpeed; }; diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index 98d9026c1c..f81384c1b0 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Displays a wind info (colored arrow) in the top left corner of the screen * * Argument: @@ -8,6 +7,11 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_displayWindInfo + * + * Public: No */ #include "script_component.hpp" @@ -16,64 +20,87 @@ if (GVAR(WindInfo)) exitWith { GVAR(WindInfo) = false; - 0 cutText ["", "PLAIN"]; + (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; true }; -if (underwater ACE_player) exitWith { false }; -if (vehicle ACE_player != ACE_player) exitWith { false }; -2 cutText ["", "PLAIN"]; EGVAR(advanced_ballistics,Protractor) = false; 1 cutText ["", "PLAIN"]; GVAR(WindInfo) = true; -[{ - private ["_windSpeed", "_windDir", "_playerDir", "_windIndex", "_windColor"]; - if !(GVAR(WindInfo) && !(underwater ACE_player) && vehicle ACE_player == ACE_player) exitWith { +TRACE_1("Starting Wind Info PFEH", GVAR(WindInfo)); + +[{ + disableSerialization; + params ["", "_pfID"]; + + if ((!GVAR(WindInfo)) || {!([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith))}) exitWith { + TRACE_1("Ending Wind Info PFEH", GVAR(WindInfo)); GVAR(WindInfo) = false; - 0 cutText ["", "PLAIN"]; - [_this select 1] call CBA_fnc_removePerFrameHandler; + (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; + [_pfID] call CBA_fnc_removePerFrameHandler; }; - _windIndex = 12; - _windColor = [1, 1, 1, 1]; - _windSpeed = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { + //Keeps the display open: + (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutRsc ["RscWindIntuitive", "PLAIN", 1, false]; + + private _windSpeed = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { // With wind gradient [eyePos ACE_player, true, true, true] call FUNC(calculateWindSpeed); } else { // Without wind gradient [eyePos ACE_player, false, true, true] call FUNC(calculateWindSpeed); }; - - if (_windSpeed > 0.2) then { - _playerDir = (ACE_player call CBA_fnc_headDir) select 0; - _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); - _windIndex = round(((_playerDir - _windDir + 360) % 360) / 30); - _windIndex = _windIndex % 12; - }; + + + private _playerDir = (ACE_player call CBA_fnc_headDir) select 0; + private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); + _windDir = 30 * (round(((_windDir - _playerDir + 360) % 360) / 30)); // Color Codes from https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale - if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; }; - if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; }; - if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; }; - if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; }; - if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; }; - if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; }; - if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; }; - if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; }; - if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; }; - if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; }; - if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; }; - if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; }; + private _beaufortNumber = 0; + private _windColor = [1, 1, 1, 1]; + if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; _beaufortNumber = 1; }; + if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; _beaufortNumber = 2; }; + if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; _beaufortNumber = 3; }; + if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; _beaufortNumber = 4; }; + if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; _beaufortNumber = 5; }; + if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; _beaufortNumber = 6; }; + if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; _beaufortNumber = 7; }; + if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; _beaufortNumber = 8; }; + if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; _beaufortNumber = 9; }; + if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; _beaufortNumber = 10; }; + if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; _beaufortNumber = 11; }; + if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; _beaufortNumber = 12; }; - 0 cutRsc ["RscWindIntuitive", "PLAIN", 1, false]; - __ctrl ctrlSetScale 0.75; + TRACE_3("update display",_beaufortNumber,_windDir,_windSpeed); + __ctrl ctrlSetTextColor _windColor; + if (_beaufortNumber > 0) then { + __ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_arrow_ca.paa)); + __ctrl ctrlSetAngle [_windDir, 0.5, 0.5]; + } else { + __ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_noneCircle_ca.paa)); + }; __ctrl ctrlCommit 0; - __ctrl ctrlSetText format[QUOTE(PATHTOF(UI\wind%1.paa)), _windIndex]; - __ctrl ctrlSetTextColor _windColor; + //Update the beaufort balls: + (ctrlPosition __ctrl) params ["_ctrlX", "_ctrlY", "_ctrlWidth", "_ctrlHeight"]; + private _centerX = _ctrlX + _ctrlWidth / 2; + private _centerY = _ctrlY + _ctrlHeight / 2; + private _ballHeight = _ctrlHeight / 17; + private _ballWidth = _ballHeight * 3/4; + + for "_index" from 0 to (_beaufortNumber - 1) do { + private _ball = __dsp ctrlCreate ["RscPicture", _index]; + _ball ctrlSetText QUOTE(PATHTOF(UI\wind_dot_ca.paa)); + _ball ctrlSetTextColor [1,1,1,1]; + private _ballCenterX = _centerX - (_ballWidth / 2) + ((sin _windDir) * 0.013333) * (_index - 4.9) + ((cos _windDir) * 0.0125); + private _ballCenterY = _centerY - (_ballHeight / 2) - ((1 * cos _windDir) * 4/3*0.013333) * (_index - 4.9) + ((sin _windDir) * 0.0125); + _ball ctrlSetPosition [_ballCenterX, _ballCenterY, _ballWidth, _ballHeight]; + _ball ctrlCommit 0; + }; }, 0.5, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/weather/functions/fnc_getMapData.sqf b/addons/weather/functions/fnc_getMapData.sqf index 2e39f80764..b344ad2bdf 100644 --- a/addons/weather/functions/fnc_getMapData.sqf +++ b/addons/weather/functions/fnc_getMapData.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg, esteldunedain - * * Get the weather data for the current map * * Argument: @@ -8,6 +7,11 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_getMapData + * + * Public: No */ #include "script_component.hpp" @@ -207,4 +211,4 @@ GVAR(TempNight) = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2]; GVAR(Humidity) = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82]; GVAR(currentTemperature) = 20; -GVAR(currentHumidity) = 0.5; \ No newline at end of file +GVAR(currentHumidity) = 0.5; diff --git a/addons/weather/functions/fnc_getWind.sqf b/addons/weather/functions/fnc_getWind.sqf index 7e133896a6..c9ccd43ff9 100644 --- a/addons/weather/functions/fnc_getWind.sqf +++ b/addons/weather/functions/fnc_getWind.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team, Ruthberg - * * Calculate current wind locally from the data broadcasted by the server * * Argument: @@ -8,17 +7,21 @@ * * Return value: * Wind + * + * Example: + * [] call ace_weather_fnc_getWind + * + * Public: No */ #include "script_component.hpp" -private ["_periodPercent", "_periodPosition"]; - if (isNil "ACE_WIND_PARAMS") exitWith { [0, 0, 0] }; ACE_WIND_PARAMS params ["_dir", "_dirChange", "_spd", "_spdChange", "_period"]; +//Wind _dir is the "source" of the wind [eg: "northerly wind": _dir = 0 -> wind = [0,-1,0];] -_periodPosition = (ACE_time - GVAR(wind_period_start_time)) min _period; -_periodPercent = _periodPosition / _period; +private _periodPosition = (ACE_time - GVAR(wind_period_start_time)) min _period; +private _periodPercent = _periodPosition / _period; _spd = _spd + _spdChange * _periodPercent; _dir = _dir + _dirChange * _periodPercent; diff --git a/addons/weather/functions/fnc_initModuleSettings.sqf b/addons/weather/functions/fnc_initModuleSettings.sqf index 034612ab58..f1e9c1d6fc 100644 --- a/addons/weather/functions/fnc_initModuleSettings.sqf +++ b/addons/weather/functions/fnc_initModuleSettings.sqf @@ -10,6 +10,9 @@ * Return Value: * None * + * Example: + * [module, [], true] call ace_weather_fnc_initModuleSettings + * * Public: No */ diff --git a/addons/weather/functions/fnc_initWind.sqf b/addons/weather/functions/fnc_initWind.sqf index 10b22efa2a..4c88f59f95 100644 --- a/addons/weather/functions/fnc_initWind.sqf +++ b/addons/weather/functions/fnc_initWind.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Inits the wind variables on mission start * * Argument: @@ -8,28 +7,32 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_initWind + * + * Public: No */ #include "script_component.hpp" -private ["_sum", "_rand", "_csum", "_index", "_month", "_windDirectionProbabilities"]; -_month = date select 1; -_windDirectionProbabilities = GVAR(WindDirectionProbabilities) select (_month - 1); +private _month = date select 1; +private _windDirectionProbabilities = GVAR(WindDirectionProbabilities) select (_month - 1); ACE_wind = [0, 0, 0]; GVAR(wind_direction_reference) = random 360; -_sum = 0; +private _sum = 0; for "_i" from 0 to 7 do { _sum = _sum + (_windDirectionProbabilities select _i); }; -_rand = random _sum; -_csum = [0, 0, 0, 0, 0, 0, 0, 0]; +private _rand = random _sum; +private _csum = [0, 0, 0, 0, 0, 0, 0, 0]; for "_i" from 0 to 7 do { for "_j" from 0 to _i do { _csum set [_i, (_csum select _i) + (_windDirectionProbabilities select _j)]; }; }; -_index = 0; +private _index = 0; for "_i" from 0 to 7 do { if (_rand > (_csum select _i)) then { _index = _index + 1; diff --git a/addons/weather/functions/fnc_serverController.sqf b/addons/weather/functions/fnc_serverController.sqf index 2cbdeb581e..9791049914 100644 --- a/addons/weather/functions/fnc_serverController.sqf +++ b/addons/weather/functions/fnc_serverController.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Gather weather parameters and broadcast them to the clients * * Argument: @@ -8,11 +7,14 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_serverController + * + * Public: No */ #include "script_component.hpp" -if (!GVAR(enableServerController)) exitWith {}; - if (GVAR(useACEWeather)) then { // Use location based real world weather data [] call FUNC(updateAceWeather); @@ -23,7 +25,9 @@ if (GVAR(useACEWeather)) then { publicVariable "ACE_RAIN_PARAMS"; }; if (GVAR(syncWind)) then { - ACE_WIND_PARAMS = [wind call CBA_fnc_vectDir, 0, vectorMagnitude wind, 0, GVAR(serverUpdateInterval)]; + //Wind _dir is the "source" of the wind [eg: "northerly wind": _dir = 0 -> wind = [0,-1,0];] + private _windDir = ((((wind select 0) atan2 (wind select 1)) + 180) % 360); + ACE_WIND_PARAMS = [_windDir, 0, vectorMagnitude wind, 0, GVAR(serverUpdateInterval)]; publicVariable "ACE_WIND_PARAMS"; }; if (GVAR(syncMisc)) then { diff --git a/addons/weather/functions/fnc_updateAceWeather.sqf b/addons/weather/functions/fnc_updateAceWeather.sqf index 029e1eb89b..2eb264d91b 100644 --- a/addons/weather/functions/fnc_updateAceWeather.sqf +++ b/addons/weather/functions/fnc_updateAceWeather.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team, esteldunedain, ruthberg - * * Updates the wind and rain evolution on the server. Broadcasts the current and next values to the clients * * Argument: @@ -8,40 +7,44 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_updateAceWeather + * + * Public: No */ #include "script_component.hpp" -private ["_overcastMultiplier", "_lastRain", "_rainOverCast", "_transitionTime", "_windDirectionVariance", "_windSpeed", "_windSpeedChange", "_windMaxDiff", "_windMinDiff", "_windDirection", "_windDirectionChange", "_ratioMin", "_ratioMax"]; - -_overcastMultiplier = 1 max (2* overcast) min 2; // 0 (@ overcast 0), 2 (@ overcast 1) +private _overcastMultiplier = 1 max (2* overcast) min 2; // 0 (@ overcast 0), 2 (@ overcast 1) // Rain simulation -if (GVAR(syncRain) && GVAR(rain_period_count) > GVAR(rain_next_period)) then { +if (GVAR(syncRain) && {GVAR(rain_period_count) > GVAR(rain_next_period)}) then { GVAR(rain_next_period) = ceil((1 + (random 10)) / _overcastMultiplier); GVAR(rain_period_count) = 0; - - _lastRain = GVAR(current_rain); - + + private _lastRain = GVAR(current_rain); + private _rainOverCast = 0; + if (overcast >= 0.7) then { _rainOverCast = (overcast - 0.7) / 0.3; if (GVAR(current_rain) == 0) then { // Initialize rain with a random strength depending on the current overcast value GVAR(current_rain) = -0.25 + (random 0.75) + (random 0.5) * _rainOverCast; }; - + GVAR(current_rain) = GVAR(current_rain) + GVAR(current_rain) * ((_rainOverCast * _overcastMultiplier) / 8) * GVAR(rain_current_range); GVAR(current_rain) = 0 max GVAR(current_rain) min 1; - + GVAR(rain_current_range) = -1 + (random 2); } else { _rainOverCast = 1; - + GVAR(current_rain) = 0; }; - - _transitionTime = 1 + (_rainOverCast * 5) + (random (_rainOverCast * 20)); - + + private _transitionTime = 1 + (_rainOverCast * 5) + (random (_rainOverCast * 20)); + ACE_RAIN_PARAMS = [_lastRain, GVAR(current_rain), _transitionTime]; TRACE_4("",_lastRain,_rainOverCast,_transitionTime,overcast); @@ -50,47 +53,47 @@ if (GVAR(syncRain) && GVAR(rain_period_count) > GVAR(rain_next_period)) then { }; // Wind simulation -if (GVAR(syncWind) && GVAR(wind_period_count) > GVAR(wind_next_period)) then { - +if (GVAR(syncWind) && {GVAR(wind_period_count) > GVAR(wind_next_period)}) then { + GVAR(wind_next_period) = ceil((2 + (random 5)) / _overcastMultiplier); GVAR(wind_period_count) = 0; - - _windDirectionVariance = (90 - (random 180)) * (overcast ^ 2); - _windDirection = (360 + GVAR(wind_direction_reference) + _windDirectionVariance) % 360; - _windDirectionChange = _windDirection - GVAR(current_wind_direction); + + private _windDirectionVariance = (90 - (random 180)) * (overcast ^ 2); + private _windDirection = (360 + GVAR(wind_direction_reference) + _windDirectionVariance) % 360; + private _windDirectionChange = _windDirection - GVAR(current_wind_direction); if (_windDirectionChange > 180) then { _windDirectionChange = _windDirectionChange - 360; }; if (_windDirectionChange < -180) then { _windDirectionChange = 360 + _windDirectionChange; }; - - _windMaxDiff = GVAR(mean_wind_speed) - GVAR(max_wind_speed); - _windMinDiff = GVAR(min_wind_speed) - GVAR(mean_wind_speed); - - _ratioMax = (random 1) ^ 2; - _ratioMin = (random 1) ^ 2; - - _windSpeed = GVAR(current_wind_speed); - _windSpeedChange = 0; + + private _windMaxDiff = GVAR(mean_wind_speed) - GVAR(max_wind_speed); + private _windMinDiff = GVAR(min_wind_speed) - GVAR(mean_wind_speed); + + private _ratioMax = (random 1) ^ 2; + private _ratioMin = (random 1) ^ 2; + + private _windSpeed = GVAR(current_wind_speed); + private _windSpeedChange = 0; if ((random 1) < (0.3 max overcast)) then { _windSpeed = GVAR(mean_wind_speed) + _windMaxDiff * _ratioMax + _windMinDiff * _ratioMin; _windSpeedChange = _windSpeed - GVAR(current_wind_speed); }; - - _transitionTime = GVAR(wind_next_period) * GVAR(serverUpdateInterval); - + + private _transitionTime = GVAR(wind_next_period) * GVAR(serverUpdateInterval); + TRACE_5("dirCur/dirNew/spdCur/spdNew/period",GVAR(current_wind_direction),_windDirection,GVAR(current_wind_speed),_windSpeed,_transitionTime); - + ACE_WIND_PARAMS = [GVAR(current_wind_direction), - _windDirectionChange, - GVAR(current_wind_speed), - _windSpeedChange, - _transitionTime]; - + _windDirectionChange, + GVAR(current_wind_speed), + _windSpeedChange, + _transitionTime]; + GVAR(current_wind_direction) = _windDirection; GVAR(current_wind_speed) = _windSpeed; - + GVAR(wind_period_start_time) = ACE_time; publicVariable "ACE_WIND_PARAMS"; }; @@ -102,4 +105,4 @@ if (GVAR(syncMisc)) then { }; GVAR(rain_period_count) = GVAR(rain_period_count) + 1; -GVAR(wind_period_count) = GVAR(wind_period_count) + 1; \ No newline at end of file +GVAR(wind_period_count) = GVAR(wind_period_count) + 1; diff --git a/addons/weather/functions/fnc_updateHumidity.sqf b/addons/weather/functions/fnc_updateHumidity.sqf index df6e64df5d..3ea28d6a44 100644 --- a/addons/weather/functions/fnc_updateHumidity.sqf +++ b/addons/weather/functions/fnc_updateHumidity.sqf @@ -1,27 +1,30 @@ /* * Author: ACE2 Team - * - * Updates GVAR(currentHumidity) based on + * Updates GVAR(currentHumidity) * * Argument: * Nothing * * Return value: * Nothing + * + * Example: + * [] call ace_weather_fnc_updateHumidity + * + * Public: No */ #include "script_component.hpp" -private ["_month", "_avgTemperature", "_pS1", "_pS2"]; -_month = date select 1; +private _month = date select 1; GVAR(currentHumidity) = (GVAR(Humidity) select (_month - 1)) / 100; -if (rain > 0 && overcast > 0.7) then { +if ((rain > 0) && {overcast > 0.7}) then { GVAR(currentHumidity) = 1; } else { - _avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2; - _pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature)); - _PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature))); + private _avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2; + private _pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature)); + private _PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature))); GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2; GVAR(currentHumidity) = GVAR(currentHumidity) + GVAR(humidityShift); diff --git a/addons/weather/functions/fnc_updateRain.sqf b/addons/weather/functions/fnc_updateRain.sqf index 6c4c829747..8fa18500e8 100644 --- a/addons/weather/functions/fnc_updateRain.sqf +++ b/addons/weather/functions/fnc_updateRain.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team, Ruthberg - * * Updates rain based on ACE_RAIN_PARAMS * * Argument: @@ -8,17 +7,21 @@ * * Return value: * Nothing + * + * Example: + * [] call ace_weather_fnc_updateRain + * + * Public: No */ #include "script_component.hpp" -if (!GVAR(syncRain)) exitWith {}; - if (!isNil "ACE_RAIN_PARAMS") then { 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; + private _periodPosition = (ACE_time - GVAR(rain_period_start_time)) min _period; + private _periodPercent = (_periodPosition / _period) min 1; - GVAR(ACE_Rain) = (_oldRain + (_newRain - _oldRain) * _periodPercent); + GVAR(ACE_Rain) = linearConversion [GVAR(rain_period_start_time), (GVAR(rain_period_start_time) + _period), ACE_time, _oldRain, _newRain]; + + TRACE_3("Update Rain",rain,ACE_RAIN_PARAMS,GVAR(ACE_Rain)); }; diff --git a/addons/weather/functions/fnc_updateTemperature.sqf b/addons/weather/functions/fnc_updateTemperature.sqf index 82f126e33f..9ff11859f4 100644 --- a/addons/weather/functions/fnc_updateTemperature.sqf +++ b/addons/weather/functions/fnc_updateTemperature.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team - * * Updates GVAR(currentTemperature) based on the map data * * Argument: @@ -8,14 +7,18 @@ * * Return value: * Nothing + * + * Example: + * [] call ace_weather_fnc_updateTemperature + * + * Public: No */ #include "script_component.hpp" -private ["_time", "_month", "_timeRatio"]; -_time = daytime; -_month = date select 1; +private _time = daytime; +private _month = date select 1; -_timeRatio = abs(_time - 12) / 12; +private _timeRatio = abs(_time - 12) / 12; GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _timeRatio) + (GVAR(TempNight) select (_month - 1)) * _timeRatio; GVAR(currentTemperature) = GVAR(currentTemperature) + GVAR(temperatureShift) - GVAR(badWeatherShift) * overcast; diff --git a/addons/weather/functions/fnc_updateWind.sqf b/addons/weather/functions/fnc_updateWind.sqf index b362458fdb..75724e3674 100644 --- a/addons/weather/functions/fnc_updateWind.sqf +++ b/addons/weather/functions/fnc_updateWind.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team, Ruthberg - * * Updates wind, gusts and waves based on ACE_wind * * Argument: @@ -8,19 +7,22 @@ * * Return value: * Nothing + * + * Example: + * [] call ace_weather_fnc_updateWind + * + * Public: No */ #include "script_component.hpp" if (!GVAR(syncWind)) exitWith { ACE_wind = wind }; -private ["_newWaves"]; - ACE_wind = [] call FUNC(getWind); setWind [ACE_wind select 0, ACE_wind select 1, true]; 2 setGusts 0; // Set waves: 0 when no wind, 1 when wind >= 16 m/s -_newWaves = ((vectorMagnitude ACE_wind) / 16.0) min 1.0; +private _newWaves = ((vectorMagnitude ACE_wind) / 16.0) min 1.0; if (abs(_newWaves - waves) > 0.1) then { 1 setWaves _newWaves; }; diff --git a/addons/weather/script_component.hpp b/addons/weather/script_component.hpp index 2a6aeb0393..84d7e9987b 100644 --- a/addons/weather/script_component.hpp +++ b/addons/weather/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT weather #include "\z\ace\addons\main\script_mod.hpp" -//#define DEBUG_ENABLED_WEATHER + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_WEATHER #define DEBUG_MODE_FULL #endif diff --git a/addons/weather/stringtable.xml b/addons/weather/stringtable.xml index d6129f67e5..f2e9027e68 100644 --- a/addons/weather/stringtable.xml +++ b/addons/weather/stringtable.xml @@ -10,7 +10,7 @@ Mostra informazioni sul vento Zeige Windinformationen Széladatok mutatása - Zobrazit informace o větru + Zobrazit údaje o větru Mostrar informação do vento @@ -23,6 +23,7 @@ Météo Időjárás Погода + Meteo Multiplayer synchronized ACE weather module @@ -34,6 +35,7 @@ Module ACE de synchronisation de la météo en multi. Többjátékos szinkronizált ACE időjárás modul ACE Модуль для синхронизации погоды в мультиплеере + Modulo Sincronizzazione Meteo ACE Multiplayer Weather propagation @@ -45,6 +47,7 @@ Propagation de la météo Időjárás-változás Единая погода для всех + Propagazione Meteo Enables server side weather propagation @@ -56,6 +59,7 @@ Active la propagation météo par le serveur Engedélyezi a szerveroldali időjárás-változást Включает управление погодой на серверной стороне + Abilita propagazione meteo lato server ACE Weather @@ -67,6 +71,7 @@ ACE Météo ACE Időjárás Погода ACE + Meteo ACE Overrides the default weather (editor, mission settings) with ACE weather (map based) @@ -78,6 +83,7 @@ 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 (на основе карты) + Scavalca il meteo default (editor, parametri missione) con il meteo ACE (basato su mappa) Sync Rain @@ -89,6 +95,7 @@ Synchronisation de la pluie Eső szinkronizálása Синхрониз. дождь + Sincronizza Pioggia Synchronizes rain @@ -100,6 +107,7 @@ Synchronise la pluie Szinkronizálja az esőt Синхронизирует дождь + Sincronizza Pioggia Sync Wind @@ -111,6 +119,7 @@ Synchronisation du vent Szél szinkronizálása Синхрониз. ветер + Sincronizza Vento Synchronizes wind @@ -122,6 +131,7 @@ Synchronise le vent Szinkronizálja a szelet Синхронизирует ветер + Sincronizza Vento Sync Misc @@ -133,17 +143,19 @@ Synchronisation autres Egyéb szinkronizálása Синхрониз. прочее + Sincronizza Misto - Synchronizes lightnings, rainbow, fog, ... - Synchronizuje pioruny, tęcze, mgłę, ... - Sincroniza relampagos, arcoiris, niebla ... - Synchronisiert Blitze, Regenbögen, Nebel, ... - Synchronizace blesků, duhy, mlhy, ... + Synchronizes lightnings, rainbow, fog,... + Synchronizuje pioruny, tęcze, mgłę,... + Sincroniza relampagos, arcoiris, niebla... + 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, ... - Синхронизирует молнии, радугу, туман, ... + Synchronise les éclairs, les arcs en ciel, le brouillard,... + Szinkronizálja a villámokat, szivárványokat, ködöt,... + Синхронизирует молнии, радугу, туман,... + Sincronizza lampi, arcobaleni, nebbia,... Update Interval @@ -155,6 +167,7 @@ Intervalle de synchronisation Frissítési intervallum Интервал обновления + Intervallo Aggiornamenti Defines the interval (seconds) between weather updates @@ -166,6 +179,7 @@ Défini un intervalle (secondes) entre deux synchronisations Megadja az intervallumot (másodpercben) az időjárás-frissítések között Определяет интервал (в секундах) между обновлениями погоды + Definisce l'intervallo (in secondi) tra aggiornamenti del meteo - + \ No newline at end of file diff --git a/addons/winddeflection/CfgEventHandlers.hpp b/addons/winddeflection/CfgEventHandlers.hpp index a835fd0e88..becf395052 100644 --- a/addons/winddeflection/CfgEventHandlers.hpp +++ b/addons/winddeflection/CfgEventHandlers.hpp @@ -1,17 +1,18 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + 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_FiredBIS_EventHandlers { - class AllVehicles { - class ADDON { - firedBIS = QUOTE(_this call FUNC(handleFired)); - }; - }; -}; diff --git a/addons/winddeflection/XEH_PREP.hpp b/addons/winddeflection/XEH_PREP.hpp new file mode 100644 index 0000000000..60c5b830a7 --- /dev/null +++ b/addons/winddeflection/XEH_PREP.hpp @@ -0,0 +1,4 @@ + +PREP(handleFired); +PREP(updateTrajectoryPFH); +PREP(initModuleSettings); diff --git a/addons/winddeflection/XEH_postInit.sqf b/addons/winddeflection/XEH_postInit.sqf index ff9e2427f4..14b4db1def 100644 --- a/addons/winddeflection/XEH_postInit.sqf +++ b/addons/winddeflection/XEH_postInit.sqf @@ -8,6 +8,15 @@ GVAR(trackedBullets) = []; //If not enabled, dont't add PFEH if (!GVAR(enabled)) exitWith {}; + // Register fire event handler + ["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + + if (GVAR(vehicleEnabled)) then { + ["firedPlayerVehicle", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["firedPlayerVehicleNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + }; + [] call FUNC(updateTrajectoryPFH); }] call EFUNC(common,addEventHandler); diff --git a/addons/winddeflection/XEH_preInit.sqf b/addons/winddeflection/XEH_preInit.sqf index bac6a8323a..9104abccdb 100644 --- a/addons/winddeflection/XEH_preInit.sqf +++ b/addons/winddeflection/XEH_preInit.sqf @@ -12,8 +12,6 @@ ADDON = false; -PREP(handleFired); -PREP(updateTrajectoryPFH); -PREP(initModuleSettings); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/winddeflection/XEH_preStart.sqf b/addons/winddeflection/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/winddeflection/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/winddeflection/functions/fnc_handleFired.sqf b/addons/winddeflection/functions/fnc_handleFired.sqf index a3c51054ee..e2bfca394f 100644 --- a/addons/winddeflection/functions/fnc_handleFired.sqf +++ b/addons/winddeflection/functions/fnc_handleFired.sqf @@ -1,15 +1,9 @@ /* * Author: Glowbal, Ruthberg - * Handles wind deflection for projectiles. + * Handles wind deflection for projectiles. Called from the unified fired EH only for players on foot and their vehicles if required by settings. * * Arguments: - * 0: unit - Object the event handler is assigned to - * 1: weapon - Fired weapon - * 2: muzzle - Muzzle that was used - * 3: mode - Current mode of the fired weapon - * 4: ammo - Ammo used - * 5: magazine - magazine name which was used - * 6: projectile - Object of the projectile that was shot + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Nothing @@ -21,17 +15,12 @@ */ #include "script_component.hpp" -params ["_unit", "", "", "", "_ammo", "", "_bullet"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_bullet isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false}; +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_projectile isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false}; -if (!hasInterface) exitWith {false}; -if (!(GVAR(enabled))) exitWith {false}; -if (!(GVAR(vehicleEnabled)) && !(_unit isKindOf "Man")) exitWith {false}; -if (!((_bullet isKindOf "BulletBase") || (_bullet isKindOf "GrenadeBase"))) exitWith {false}; +if (!((_projectile isKindOf "BulletBase") || (_projectile isKindOf "GrenadeBase"))) exitWith {false}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false}; -if (!([_unit] call EFUNC(common,isPlayer))) exitWith {false}; -GVAR(trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; - -true; \ No newline at end of file +GVAR(trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; diff --git a/addons/winddeflection/functions/script_component.hpp b/addons/winddeflection/functions/script_component.hpp index eb67fc3887..ea22ecb35c 100644 --- a/addons/winddeflection/functions/script_component.hpp +++ b/addons/winddeflection/functions/script_component.hpp @@ -1,12 +1 @@ -#define COMPONENT windDeflection -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_WINDDEFLECTION - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_WINDDEFLECTION - #define DEBUG_SETTINGS DEBUG_SETTINGS_WINDDEFLECTION -#endif - -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\winddeflection\script_component.hpp" diff --git a/addons/winddeflection/script_component.hpp b/addons/winddeflection/script_component.hpp index 4af43227de..e4cc1df840 100644 --- a/addons/winddeflection/script_component.hpp +++ b/addons/winddeflection/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT winddeflection #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_WINDDEFLECTION #define DEBUG_MODE_FULL #endif diff --git a/addons/winddeflection/stringtable.xml b/addons/winddeflection/stringtable.xml index 76e3f7f4e4..8e8ad27e7a 100644 --- a/addons/winddeflection/stringtable.xml +++ b/addons/winddeflection/stringtable.xml @@ -71,6 +71,7 @@ Déflexion du vent Szél-hárítás Отклонение ветром + Deviazione del Vento Wind Deflection @@ -82,6 +83,7 @@ Déflexion du vent Szél-hárítás Отклонение ветром + Deviazione del Vento Enables wind deflection @@ -93,6 +95,7 @@ Active la déflexion dûe au vent Engedélyezi a szél-hárítást Включает отклонение ветром + Abilita deviazione del vento Vehicle Enabled @@ -104,6 +107,7 @@ Activer les véhicules Jármű engedélyezve Для техники + Abilita per Veicoli Enables wind deflection for static/vehicle gunners @@ -115,6 +119,7 @@ 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 Включает отклонение ветром для стрелков стационарных орудий и техники + Abilita deviazione del vento per artiglieri di statiche/veicoli Simulation Interval @@ -126,6 +131,7 @@ Intervalle de simulation Szimulációs intervallum Интервал симуляции + Intervallo Simulazione Defines the interval between every calculation step @@ -137,6 +143,7 @@ Défini l'intervalle entre deux points de calcul Megszabja a számítási lépések közötti intervallumot Определяет временной интервал между расчетами + Definisce l'intervallo tra ogni passaggio di calcolo Simulation Radius @@ -148,6 +155,7 @@ Rayon de simulation Szimulációs hatókör Радиус симуляции + Raggio Simulazione Defines the radius around the player (in meters) at which projectiles are wind deflected @@ -159,6 +167,7 @@ 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 Определяет радиус вокруг игрока (а метрах), в котором снаряды отклоняются ветром + Definisce il raggio attorno al giocatore (in metri) dove viene applicata la deviazione del vento ai proiettili Wind influence on projectiles trajectory @@ -170,6 +179,7 @@ Le vent influe sur la trajectoire des projectiles Szél hatása a lövedékek röppályájára Влияние втера на траекторию снарядов + Influenza del vento sulla traiettoria dei proiettili - + \ No newline at end of file diff --git a/addons/yardage450/CfgEventHandlers.hpp b/addons/yardage450/CfgEventHandlers.hpp index 2a05b72298..10dce0a9bf 100644 --- a/addons/yardage450/CfgEventHandlers.hpp +++ b/addons/yardage450/CfgEventHandlers.hpp @@ -1,3 +1,10 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); @@ -8,4 +15,4 @@ class Extended_PostInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; -}; \ No newline at end of file +}; diff --git a/addons/yardage450/XEH_PREP.hpp b/addons/yardage450/XEH_PREP.hpp new file mode 100644 index 0000000000..ae6a9b255b --- /dev/null +++ b/addons/yardage450/XEH_PREP.hpp @@ -0,0 +1,3 @@ + +PREP(acquireTarget); +PREP(turnOn); diff --git a/addons/yardage450/XEH_preInit.sqf b/addons/yardage450/XEH_preInit.sqf index ad84432e0d..a7feade1c3 100644 --- a/addons/yardage450/XEH_preInit.sqf +++ b/addons/yardage450/XEH_preInit.sqf @@ -2,7 +2,6 @@ ADDON = false; -PREP(acquireTarget); -PREP(turnOn); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/addons/yardage450/XEH_preStart.sqf b/addons/yardage450/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/yardage450/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/yardage450/script_component.hpp b/addons/yardage450/script_component.hpp index abff262efc..d49c301359 100644 --- a/addons/yardage450/script_component.hpp +++ b/addons/yardage450/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT yardage450 #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_YARDAGE450 #define DEBUG_MODE_FULL #endif diff --git a/addons/yardage450/stringtable.xml b/addons/yardage450/stringtable.xml index 5a57ff2193..f3f25f16a0 100644 --- a/addons/yardage450/stringtable.xml +++ b/addons/yardage450/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -10,6 +10,7 @@ Yardage 450 Yardage 450 Yardage 450 + Yardage 450 Laser Rangefinder @@ -20,6 +21,7 @@ Medidor de Distância a laser Lézeres távolságmérő Лазерный дальномер + Distanziometro Laser Yardage 450 - Power Button @@ -30,6 +32,7 @@ Yardage 450 - Botão de energia Yardage 450 - Főkapcsoló gomb Yardage 450 - Кнопка питания + Yardage 450 - Bottone Accensione \ No newline at end of file diff --git a/addons/zeus/CfgEventHandlers.hpp b/addons/zeus/CfgEventHandlers.hpp index 57d6a1afd0..89ab0bc900 100644 --- a/addons/zeus/CfgEventHandlers.hpp +++ b/addons/zeus/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index f5144e60e6..0013355370 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -167,4 +167,23 @@ class CfgVehicles { sync[] = {}; }; }; + + // class GVAR(moduleSetSuppression): GVAR(moduleBase) { + // curatorCanAttach = 1; + // displayName = CSTRING(ModuleSetSupp_DisplayName); + // function = QFUNC(moduleSetSuppression); + // class ModuleDescription { + // description = "Set group of units to supressed."; + // sync[] = {}; + // }; + // }; + // class GVAR(moduleDisableSuppression): GVAR(moduleBase) { + // curatorCanAttach = 1; + // displayName = CSTRING(ModuleDisableSupp_DisplayName); + // function = QFUNC(moduleDisableSuppression); + // class ModuleDescription { + // description = "Remove suppression for units in group"; + // sync[] = {}; + // }; + // }; }; diff --git a/addons/zeus/XEH_PREP.hpp b/addons/zeus/XEH_PREP.hpp new file mode 100644 index 0000000000..423b7f2f27 --- /dev/null +++ b/addons/zeus/XEH_PREP.hpp @@ -0,0 +1,16 @@ + +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/XEH_preInit.sqf b/addons/zeus/XEH_preInit.sqf index 9837d7162b..0d03673e46 100644 --- a/addons/zeus/XEH_preInit.sqf +++ b/addons/zeus/XEH_preInit.sqf @@ -2,21 +2,7 @@ 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); +#include "XEH_PREP.hpp" if (isServer) then { ["zeusUnitAssigned", FUNC(handleZeusUnitAssigned)] call EFUNC(common,addEventHandler); diff --git a/addons/zeus/XEH_preStart.sqf b/addons/zeus/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/zeus/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/zeus/functions/fnc_bi_moduleCurator.sqf b/addons/zeus/functions/fnc_bi_moduleCurator.sqf index fc21fe11e7..d10d36b839 100644 --- a/addons/zeus/functions/fnc_bi_moduleCurator.sqf +++ b/addons/zeus/functions/fnc_bi_moduleCurator.sqf @@ -57,8 +57,8 @@ if (_activated) then { if (_isAdmin) then { _letters = ["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"]; _adminVar = "admin_"; - for "_i" from 0 to 9 do {_adminVar = _adminVar + (_letters call bis_fnc_selectrandom);}; - _logic setVariable ["adminVar",_adminVar,true]; + for "_i" from 0 to 9 do {_adminVar = _adminVar + selectRandom _letters}; + _logic setvariable ["adminVar",_adminVar,true]; }; //--- Get allowed addons diff --git a/addons/zeus/functions/fnc_bi_moduleProjectile.sqf b/addons/zeus/functions/fnc_bi_moduleProjectile.sqf index 05d2e2d096..1143c30443 100644 --- a/addons/zeus/functions/fnc_bi_moduleProjectile.sqf +++ b/addons/zeus/functions/fnc_bi_moduleProjectile.sqf @@ -65,8 +65,8 @@ if (_activated) then { _altitude = 1000; _velocity = [0,0,-100]; _radio = "SentGenIncoming"; - _sounds = if (getnumber (_CfgAmmo >> "hit") < 200) then {["mortar1","mortar2"]} else {["shell1","shell2","shell3","shell4"]}; - _sound = _sounds call bis_fnc_selectrandom; + _sounds = if (getnumber (_cfgAmmo >> "hit") < 200) then {["mortar1","mortar2"]} else {["shell1","shell2","shell3","shell4"]}; + _sound = selectRandom _sounds; _hint = ["Curator","PlaceOrdnance"]; _shakeStrength = 0.01; _shakeRadius = 300; diff --git a/addons/zeus/script_component.hpp b/addons/zeus/script_component.hpp index 7211b28f7d..cb0fa29be3 100644 --- a/addons/zeus/script_component.hpp +++ b/addons/zeus/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT zeus #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_ZEUS #define DEBUG_MODE_FULL #endif diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 753b04a9af..5257981ba6 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -11,6 +11,7 @@ Paramètres du Zeus Zeus beállítások Настройки Зевса + Impostazioni Zeus Provides control over various aspects of Zeus. @@ -22,6 +23,7 @@ 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. Позволяет контролировать различные аспекты Зевса. + Fornisce controllo su vari aspetti di Zeus. Ascension Messages @@ -33,6 +35,7 @@ Message ascension Felemelkedési üzenetek Сообщения о вознесении + Messaggi di Ascesa Display global popup messages when a player is assigned as Zeus. @@ -44,6 +47,7 @@ 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. Отображает глобальное всплывающее сообщение, когда один из игроков становится Зевсом. + Mostra messaggi popup globali quando un giocatore viene assegnato come Zeus. Zeus Eagle @@ -55,6 +59,7 @@ Aigle Zeus Zeus sas Орел Зевса + Aquila Zeus Spawn an eagle that follows the Zeus camera. @@ -66,6 +71,7 @@ Faire apparaitre un aigle qui suit la caméra Zeus Lerak egy sast, ami követi a Zeus kamerát. Спавнит орла, который следует за камерой Зевса. + Crea un'aquila che segue la camera Zeus. Wind Sounds @@ -77,6 +83,7 @@ Bruit de vent Szélhangok Звук ветра + Suoni del Vento Play wind sounds when Zeus remote controls a unit. @@ -88,6 +95,7 @@ Joue des bruits de vent quand Zeus controle une unité Szélhangokat játszik le, ha a Zeus távvezérel egy egységet. Проигрывает звук ветра каждый раз, когда Зевс вселяется в юнита. + Esegui rumori di vento quando Zeus controlla un'unità in remoto. Ordnance Warning @@ -99,6 +107,7 @@ Alerte d'équipement militaire Tüzérségi figyelmeztetés Предупреждение об арте + Allarme Esplosivi Play a radio warning when Zeus uses ordnance. @@ -110,6 +119,7 @@ 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. Проигрывает звук радио каждый раз, когда Зевс использует артиллерию. + Esegui un messaggio radio quando Zeus usa esplosivi. Reveal Mines @@ -121,6 +131,7 @@ Révéler les mines Aknák feltárása Показывать мины + Rivela Mine Reveal mines to allies and place map markers. @@ -132,6 +143,7 @@ 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. Показывает мины союзникам и отмечает их маркерами на карте. + Rivela mine ad alleati e piazza marcatori in mappa. Reveal to Allies @@ -143,6 +155,7 @@ Révéler aux alliés Feltárás a szövetségeseknek Показывать союзникам + Rivela ad Alleati Allies + Map Markers @@ -154,6 +167,7 @@ Alliés + marqueurs sur la carte Szövetségesek + térkép jelölők Союзники + Маркеры на карте + Alleati + Marcatori Mappa Toggle Captive @@ -165,6 +179,7 @@ Basculer en captif Elfogott állapot váltása Пленный (вкл./выкл.) + Apri Catturato Toggle Surrender @@ -176,6 +191,7 @@ Basculer en capitulation Kapituláló állapot váltása Сдавшийся (вкл./выкл.) + Apri Resa Toggle Unconscious @@ -187,6 +203,7 @@ Basculer en inconscient Eszméletlen állapot váltása Без сознания (вкл./выкл.) + Apri Incosciente Assign Medic @@ -196,6 +213,7 @@ Назначить медиком Přiřadit Zdravotníka Asignar médico + Assegna Medico Assign Medical Vehicle @@ -205,6 +223,7 @@ Назначить медицинским транспортом Přiřadit Zdravotnické Vozidlo Asignar vehículo médico + Assegna Veicolo Medico Assign Medical Facility @@ -214,6 +233,7 @@ Назанчить медицинским сооружением Přiřadit Zdravotnické Zařízení Asignar instalación médica + Assegna Struttura Medica Add Spare Wheel @@ -221,6 +241,7 @@ Dodaj koło zapasowe Добавить запасное колесо Přidat rezervní kolo + Aggiungi Ruota di Scorta Adds a Spare Wheel to the vehicle @@ -228,6 +249,7 @@ Dodaje koło zapasowe do pojazdu Добавляет запасное колесо в транспорт Přidá rezervní kolo do vozidla + Aggiungi una ruota di scorta al veicolo Add Spare Track @@ -235,6 +257,7 @@ Dodaj zapasową gąsienicę Дабавить запасную гусеницу Přidat náhradní pás + Aggiungi Cingolo di Scorta Adds a Spare Track to the vehicle @@ -242,6 +265,7 @@ Dodaje zapasową gąsienicę do pojazdu Добавляет запасную гусеницу в транспорт Přidá náhradní pás do vozidla + Aggiungi un cingolo di scorta al veicolo Unit must be alive @@ -275,6 +299,7 @@ Юнит должен быть строением La unidad debe ser una estructura Jednotka musí být budova + Si può usare solo su strutture Unit must be a vehicle @@ -284,6 +309,7 @@ Юнит должен быть транспортом La unidad debe ser un vehículo Jednotka musí být vozidlo + Si può usare solo su veicoli Unit must be a vehicle with cargo space @@ -291,6 +317,7 @@ Jednostka musi być pojazdem z wolną przestrzenią cargo Юнит должен быть транспортом с грузовым отсеком Jednotka musí být vozidlo s úložným prostorem + L'unità dev'essere un veicolo con spazio di carico Unit must have cargo space left @@ -298,6 +325,7 @@ Jednostka musi mieć wolną przestrzeń cargo Юнит должен иметь свободное место в грузовом отсеке Jednotka musí mít místo v úložném prostoru + L'unità deve avere spazio di carico disponibile Unit must not be captive @@ -309,6 +337,7 @@ L'unité ne doit pas être captive Csak elfogatlan egységeken használni Юнит не должен быть пленным + L'unità non dev'essere un prigioniero Place on a unit @@ -320,7 +349,7 @@ Nie ma nic pod kursorem Ничего не выделено Semmi sincs az egér alatt - Nessuna selezione + Piazza su una unità Requires an addon that is not present @@ -332,6 +361,7 @@ Requiert un addon qui n'est pas présent Egy jelenleg hiányzó bővítményt igényel Требуется аддон, который отсутствует + Richiede un addon che non è presente Add Objects to Curator @@ -340,6 +370,7 @@ Добавить объекты куратору Agregar objetos al director Přidat objekty kurátorovi + Aggiungi Oggetti al Curatore Adds any spawned object to all curators in the mission @@ -348,6 +379,7 @@ Добавляет любой отспавненный объект всем кураторам в миссии Añadir cualquier objeto creado a todos los directores en la misión Přidá jakékoliv spawnuté objekty všem kurátorům v misi + Aggiungi ogni oggetto creato a tutti i Curatori in missione - + \ No newline at end of file diff --git a/docs/README_DE.md b/docs/README_DE.md index a51c562de8..62e847b889 100644 --- a/docs/README_DE.md +++ b/docs/README_DE.md @@ -1,21 +1,22 @@

- +

+

- ACE3 Version + ACE3 Version - - ACE3 Download + + ACE3 Download - ACE3 Issues + ACE3 Fehlermeldungen BIF Thread - ACE3 License + ACE3 Lizenz ACE3 Slack @@ -24,7 +25,11 @@ ACE3 Build Status

-

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

+

+

+ Benötigt die aktuellste Version vonCBA A3.
+ Besucht uns auf Twitter | Facebook | YouTube | 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. @@ -58,7 +63,6 @@ Die Mod ist **modular aufgebaut**. Beinahe jede PBO kann entfernt werden, sodass - Magazine umpacken - Realistische Waffen Er- bzw. Überhitzung - Temporäre Taubheit bei zu lauten Geräuschen -- Verbesserte Ragdoll-Physik - Verbesserte Interaktionen für MG2s und Munitionsschlepper - Einstellbare Zielfernrohre - Keine Ruheanimationen bei gesenkter Waffe diff --git a/docs/README_PL.md b/docs/README_PL.md index 4d7f5d1e09..736e914219 100644 --- a/docs/README_PL.md +++ b/docs/README_PL.md @@ -58,7 +58,6 @@ Modyfikacja ta jest **budowana modułowo**, dzięki temu prawie każdy dostarczo - 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ą diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt index 299a9f4a5b..db4c94242b 100644 --- a/extensions/CMakeLists.txt +++ b/extensions/CMakeLists.txt @@ -89,7 +89,7 @@ endif() string(TIMESTAMP ACE_BUILDSTAMP "%Y-%m-%dT%H:%M:%SZ") set(ACE_VERSION_MAJOR 3) -set(ACE_VERSION_MINOR 2) +set(ACE_VERSION_MINOR 5) set(ACE_VERSION_REVISION 0) EXECUTE_PROCESS(COMMAND git rev-parse --verify HEAD OUTPUT_VARIABLE T_ACE_VERSION_BUILD diff --git a/extensions/advanced_ballistics/AdvancedBallistics.cpp b/extensions/advanced_ballistics/AdvancedBallistics.cpp index 203243cd9d..8286e054d2 100644 --- a/extensions/advanced_ballistics/AdvancedBallistics.cpp +++ b/extensions/advanced_ballistics/AdvancedBallistics.cpp @@ -5,6 +5,7 @@ #include #include + #define GRAVITY 9.80665f #define ABSOLUTE_ZERO_IN_CELSIUS -273.15f #define KELVIN(t) (t - ABSOLUTE_ZERO_IN_CELSIUS) @@ -572,8 +573,8 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) positionOffset[1] += cos(bulletDir + M_PI / 2) * horizontalDeflectionPartial; } - double centripetalAccel = 2 * 0.0000729 * (bulletDatabase[index].muzzleVelocity / -32.2) * cos(bulletDatabase[index].latitude) * sin(bulletDir); - velocityOffset[2] -= centripetalAccel * deltaT; + double centripetalAccel = 2 * 0.0000729 * (bulletDatabase[index].muzzleVelocity) * cos(bulletDatabase[index].latitude) * sin(bulletDir); + velocityOffset[2] += centripetalAccel * deltaT; double spinDrift = bulletDatabase[index].twistDirection * 0.0254 * 1.25 * (bulletDatabase[index].stabilityFactor + 1.2) * pow(TOF, 1.83); double spinDriftPartial = spinDrift - bulletDatabase[index].spinDrift; diff --git a/extensions/common/shared.hpp b/extensions/common/shared.hpp index 6c49b99fad..ac8cebaf94 100644 --- a/extensions/common/shared.hpp +++ b/extensions/common/shared.hpp @@ -1,5 +1,9 @@ #pragma once +//_USE_MATH_DEFINES + cmath needs to be first or M_PI won't be defined in VS2015 +#define _USE_MATH_DEFINES +#include + #include "targetver.h" #include #include @@ -11,7 +15,6 @@ #include #include #include -#include #include #include #include "ace_version.hpp" diff --git a/extensions/medical/handleDamage.cpp b/extensions/medical/handleDamage.cpp index e36d8994b0..2a50ba4ee6 100644 --- a/extensions/medical/handleDamage.cpp +++ b/extensions/medical/handleDamage.cpp @@ -109,10 +109,10 @@ namespace ace { injuries::OpenWound newWound(woundID++, injuryToAdd->ID, bodyPartID, 1, injuryToAdd->bloodLoss, injuryToAdd->pain); injuriesToAdd.push_back(newWound); } + return injuriesToAdd; } ++c; } - return injuriesToAdd; } } return injuriesToAdd; diff --git a/extensions/parse_imagepath/ace_parse_imagepath.cpp b/extensions/parse_imagepath/ace_parse_imagepath.cpp index 56d503cbaf..fa1a8643e7 100644 --- a/extensions/parse_imagepath/ace_parse_imagepath.cpp +++ b/extensions/parse_imagepath/ace_parse_imagepath.cpp @@ -17,7 +17,7 @@ #include extern "C" { - __declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function); + EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); } std::string getImagePathFromStructuredText(const std::string & input) { diff --git a/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_makeLoadable_ca.png b/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_makeLoadable_ca.png new file mode 100644 index 0000000000..a719c13aa7 Binary files /dev/null and b/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_makeLoadable_ca.png differ diff --git a/extras/blank/CfgEventHandlers.hpp b/extras/blank/CfgEventHandlers.hpp index f0a9f14d91..be284a9d70 100644 --- a/extras/blank/CfgEventHandlers.hpp +++ b/extras/blank/CfgEventHandlers.hpp @@ -1,4 +1,10 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/extras/blank/XEH_PREP.hpp b/extras/blank/XEH_PREP.hpp new file mode 100644 index 0000000000..d089cdc8e4 --- /dev/null +++ b/extras/blank/XEH_PREP.hpp @@ -0,0 +1,2 @@ + +PREP(empty); diff --git a/extras/blank/XEH_preInit.sqf b/extras/blank/XEH_preInit.sqf index 69abb46fa9..a7feade1c3 100644 --- a/extras/blank/XEH_preInit.sqf +++ b/extras/blank/XEH_preInit.sqf @@ -2,6 +2,6 @@ ADDON = false; -PREP(empty); +#include "XEH_PREP.hpp" ADDON = true; diff --git a/extras/blank/XEH_preStart.sqf b/extras/blank/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/extras/blank/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/meta.cpp b/meta.cpp new file mode 100644 index 0000000000..4a3202f5aa --- /dev/null +++ b/meta.cpp @@ -0,0 +1,2 @@ +protocol = 1; +publishedid = 463939057; diff --git a/mod.cpp b/mod.cpp index f20926ece5..3713ca7c2d 100644 --- a/mod.cpp +++ b/mod.cpp @@ -1,8 +1,8 @@ -name = "Advanced Combat Environment 3.4.1"; +name = "Advanced Combat Environment 3.4.3"; picture = "logo_ace3_ca.paa"; actionName = "GitHub"; action = "https://github.com/acemod/ACE3"; -description = "ACE3 - Version 3.4.1"; +description = "ACE3 - Version 3.4.3"; logo = "logo_ace3_ca.paa"; logoOver = "logo_ace3_ca.paa"; tooltip = "ACE3"; diff --git a/optionals/compat_bwa3/CfgVehicles.hpp b/optionals/compat_bwa3/CfgVehicles.hpp deleted file mode 100644 index bdcebdab9d..0000000000 --- a/optionals/compat_bwa3/CfgVehicles.hpp +++ /dev/null @@ -1,11 +0,0 @@ -class CfgVehicles { - class Tank_F; - class BWA3_Puma_base: Tank_F { - // Assuming 1 L/km - EGVAR(refuel,fuelCapacity) = 700; - }; - - class BWA3_Leopard_base: Tank_F { - EGVAR(refuel,fuelCapacity) = 1160; - }; -}; diff --git a/optionals/compat_rhs_afrf3/CfgAmmo.hpp b/optionals/compat_rhs_afrf3/CfgAmmo.hpp index 2444da41cf..ead78866c1 100644 --- a/optionals/compat_rhs_afrf3/CfgAmmo.hpp +++ b/optionals/compat_rhs_afrf3/CfgAmmo.hpp @@ -112,11 +112,35 @@ class CfgAmmo { ACE_muzzleVelocities[]={298, 330, 350}; ACE_barrelLengths[]={96.52, 127.0, 228.6}; }; + class rhs_B_545x39_7U1_Ball: rhs_B_545x39_Ball { + // @todo: Provide accurate coefficients for this subsonic ammo + // In the meantime, prevent it inheriting from its supersonic parent + // ammoTempMuzzleVelocityShifts scaled down from normal + ACE_ammoTempMuzzleVelocityShifts[]={-8.85,-8.49,-7.61667,-6.70667,-5.66,-4.26667,-2.54667,-0.51,1.98667,5.05667,8.73}; + ACE_muzzleVelocities[] = {}; + ACE_barrelLengths[] = {}; + }; + class rhs_B_762x39_U_Ball: rhs_B_762x39_Ball { + // @todo: Provide accurate coefficients for this subsonic ammo + // In the meantime, prevent it inheriting from its supersonic parent + // ammoTempMuzzleVelocityShifts scaled down from normal + ACE_ammoTempMuzzleVelocityShifts[]={-8.85,-8.49,-7.61667,-6.70667,-5.66,-4.26667,-2.54667,-0.51,1.98667,5.05667,8.73}; //Just Scaled Down Normal? + ACE_muzzleVelocities[] = {}; + ACE_barrelLengths[] = {}; + }; + class rhs_B_9x39_SP5: rhs_B_762x39_Ball { + // @todo: Provide accurate coefficients for this subsonic ammo + // In the meantime, prevent it inheriting from its supersonic parent + ACE_ammoTempMuzzleVelocityShifts[]={}; + ACE_muzzleVelocities[]={}; + ACE_barrelLengths[]={}; + }; + class SubmunitionBase; class rhs_ammo_127x108mm_x5: SubmunitionBase { ACE_rearm_caliber=13; }; - + class GrenadeHand; class rhs_ammo_rgd5: GrenadeHand { ace_frag_enabled = 1; @@ -153,7 +177,7 @@ class CfgAmmo { class rhs_ammo_fakels: rhs_ammo_fakel {}; class rhs_ammo_zarya2: rhs_ammo_fakels {}; class rhs_ammo_plamyam: rhs_ammo_fakels {}; - + class RocketBase; class R_PG32V_F: RocketBase {}; class rhs_rpg26_rocket: R_PG32V_F {}; diff --git a/optionals/compat_rhs_afrf3/CfgWeapons.hpp b/optionals/compat_rhs_afrf3/CfgWeapons.hpp index 32c1f590c5..367045236f 100644 --- a/optionals/compat_rhs_afrf3/CfgWeapons.hpp +++ b/optionals/compat_rhs_afrf3/CfgWeapons.hpp @@ -51,7 +51,13 @@ class CfgWeapons { class rhs_acc_pso1m2: rhs_acc_sniper_base { ACE_ScopeAdjust_Vertical[] = { 0, 0 }; ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.0; + ACE_ScopeAdjust_VerticalIncrement = 0.5; + ACE_ScopeAdjust_HorizontalIncrement = 0.5; + }; + class rhs_acc_pso1m21: rhs_acc_sniper_base { + ACE_ScopeAdjust_Vertical[] = { 0, 0 }; + ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; + ACE_ScopeAdjust_VerticalIncrement = 0.5; ACE_ScopeAdjust_HorizontalIncrement = 0.5; }; @@ -79,4 +85,4 @@ class CfgWeapons { ace_hearing_protection = 0.5; ace_hearing_lowerVolume = 0.60; }; -}; \ No newline at end of file +}; diff --git a/optionals/compat_rhs_usf3/CfgAmmo.hpp b/optionals/compat_rhs_usf3/CfgAmmo.hpp index 44c0285e40..b830d5e564 100644 --- a/optionals/compat_rhs_usf3/CfgAmmo.hpp +++ b/optionals/compat_rhs_usf3/CfgAmmo.hpp @@ -139,7 +139,8 @@ class CfgAmmo ace_frag_skip = 1; ace_frag_force = 0; }; - class rhs_ammo_m69: GrenadeHand { + class GrenadeHand_stone; + class rhs_ammo_m69: GrenadeHand_stone { ace_frag_enabled = 0; ace_frag_skip = 1; ace_frag_force = 0; diff --git a/optionals/compat_rhs_usf3/CfgWeapons.hpp b/optionals/compat_rhs_usf3/CfgWeapons.hpp index becb91ada1..c49b9bc5e4 100644 --- a/optionals/compat_rhs_usf3/CfgWeapons.hpp +++ b/optionals/compat_rhs_usf3/CfgWeapons.hpp @@ -115,31 +115,31 @@ class CfgWeapons class rhs_weap_mk18: rhs_weap_m4a1 { ACE_barrelTwist = 177.8; ACE_barrelLength = 261.62; - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + ACE_Overheating_dispersion = 1; + ACE_Overheating_slowdownFactor = 1; + ACE_Overheating_mrbs = 3000; }; class rhs_weap_m16a4: rhs_weap_m4_Base { ACE_barrelTwist = 177.8; ACE_barrelLength = 508.0; }; - class rhs_weap_lmg_minimipara; + class rhs_weap_lmg_minimipara; class rhs_weap_lmg_minimi_railed : rhs_weap_lmg_minimipara { ACE_barrelLength = 465.0; ACE_barrelTwist = 177.8; ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + ACE_Overheating_dispersion = 0.75; + ACE_Overheating_slowdownFactor = 1; + ACE_Overheating_mrbs = 3000; }; class rhs_weap_m240_base; class rhs_weap_m240B: rhs_weap_m240_base { ACE_barrelTwist = 304.8; ACE_barrelLength = 629.92; ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + ACE_Overheating_dispersion = 1; + ACE_Overheating_slowdownFactor = 1; + ACE_Overheating_mrbs = 3000; }; class rhs_weap_m14ebrri: srifle_EBR_F { ACE_barrelTwist = 304.8; diff --git a/tools/cba/addons/main/script_macros_common.hpp b/tools/cba/addons/main/script_macros_common.hpp index d205bfc975..fa24f29432 100644 --- a/tools/cba/addons/main/script_macros_common.hpp +++ b/tools/cba/addons/main/script_macros_common.hpp @@ -621,9 +621,6 @@ Author: #define LSTR(var1) TRIPLES(ADDON,STR,var1) -#define CACHE_DIS_SYS(var1,var2) (isNumber(var1 >> "CfgSettings" >> "CBA" >> "caching" >> QUOTE(var2)) && getNumber(var1 >> "CfgSettings" >> "CBA" >> "caching" >> QUOTE(var2)) != 1) -#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] #endif @@ -829,21 +826,21 @@ Parameters: Author: 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") -#define IS_BOOL(VAR) IS_META_SYS(VAR,"BOOL") -#define IS_CODE(VAR) IS_META_SYS(VAR,"CODE") -#define IS_CONFIG(VAR) IS_META_SYS(VAR,"CONFIG") -#define IS_CONTROL(VAR) IS_META_SYS(VAR,"CONTROL") -#define IS_DISPLAY(VAR) IS_META_SYS(VAR,"DISPLAY") -#define IS_GROUP(VAR) IS_META_SYS(VAR,"GROUP") -#define IS_OBJECT(VAR) IS_META_SYS(VAR,"OBJECT") -#define IS_SCALAR(VAR) IS_META_SYS(VAR,"SCALAR") -#define IS_SCRIPT(VAR) IS_META_SYS(VAR,"SCRIPT") -#define IS_SIDE(VAR) IS_META_SYS(VAR,"SIDE") +#define IS_META_SYS(VAR,TYPE) (if (isNil {VAR}) then { false } else { (VAR) isEqualType TYPE }) +#define IS_ARRAY(VAR) IS_META_SYS(VAR,[]) +#define IS_BOOL(VAR) IS_META_SYS(VAR,false) +#define IS_CODE(VAR) IS_META_SYS(VAR,{}) +#define IS_CONFIG(VAR) IS_META_SYS(VAR,configNull) +#define IS_CONTROL(VAR) IS_META_SYS(VAR,controlNull) +#define IS_DISPLAY(VAR) IS_META_SYS(VAR,displayNull) +#define IS_GROUP(VAR) IS_META_SYS(VAR,grpNull) +#define IS_OBJECT(VAR) IS_META_SYS(VAR,objNull) +#define IS_SCALAR(VAR) IS_META_SYS(VAR,0) +#define IS_SCRIPT(VAR) IS_META_SYS(VAR,scriptNull) +#define IS_SIDE(VAR) IS_META_SYS(VAR,west) #define IS_STRING(VAR) IS_META_SYS(VAR,"STRING") -#define IS_TEXT(VAR) IS_META_SYS(VAR,"TEXT") -#define IS_LOCATION(VAR) IS_META_SYS(VAR,"LOCATION") +#define IS_TEXT(VAR) IS_META_SYS(VAR,text "") +#define IS_LOCATION(VAR) IS_META_SYS(VAR,locationNull) #define IS_BOOLEAN(VAR) IS_BOOL(VAR) #define IS_FUNCTION(VAR) IS_CODE(VAR) @@ -1408,8 +1405,9 @@ Author: } // XEH Specific -#define XEH_DISABLED class EventHandlers {}; SLX_XEH_DISABLED = 1 -#define XEH_ENABLED class EventHandlers { EXTENDED_EVENTHANDLERS }; delete SLX_XEH_DISABLED +#define XEH_CLASS CBA_Extended_EventHandlers +#define XEH_DISABLED class EventHandlers { class XEH_CLASS {}; }; SLX_XEH_DISABLED = 1 +#define XEH_ENABLED class EventHandlers { class XEH_CLASS { EXTENDED_EVENTHANDLERS }; }; SLX_XEH_DISABLED = 0 // TODO: These are actually outdated; _Once ? #define XEH_PRE_INIT QUOTE(call COMPILE_FILE(XEH_PreInit_Once)) diff --git a/tools/cba/addons/xeh/init_pre.sqf b/tools/cba/addons/xeh/init_pre.sqf deleted file mode 100644 index 1b6642c777..0000000000 --- a/tools/cba/addons/xeh/init_pre.sqf +++ /dev/null @@ -1,366 +0,0 @@ -// #define DEBUG_MODE_FULL -#include "script_component.hpp" -SCRIPT(init_pre); - -if !(isNil'SLX_XEH_MACHINE') exitWith {}; // Doublecheck.. - -LOG(MSG_INIT); -// No _this in pre/PostInit, also fixes call to init_compile -private "_this"; -_this = nil; - -private ["_id", "_cfgRespawn", "_respawn", "_level"]; - -// UNIQUE Session ID since start of game -_id = uiNamespace getVariable "SLX_XEH_ID"; -if (isNil "_id") then { _id = 1 } else { if (typeName _id != "SCALAR") then { _id = 0 }; if (_id < 0) then { _id = 0 }; INC(_id) }; -uiNamespace setVariable ["SLX_XEH_ID", _id]; - -CBA_isCached = uiNamespace getVariable "CBA_isCached"; -CBA_isCached = if (isNil "CBA_isCached" && {isMultiplayer} && {!isDedicated}) then { -1 } else { _id }; -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", []]; -}; - -SLX_XEH_CACHE_KEYS = uiNamespace getVariable "SLX_XEH_CACHE_KEYS"; -SLX_XEH_CACHE_KEYS2 = uiNamespace getVariable "SLX_XEH_CACHE_KEYS2"; -SLX_XEH_CACHE_KEYS3 = uiNamespace getVariable "SLX_XEH_CACHE_KEYS3"; -CBA_CACHE_KEYS = uiNamespace getVariable "CBA_CACHE_KEYS"; - -// Always compile cache function once -call compile preProcessFileLineNumbers 'x\cba\addons\xeh\init_compile.sqf'; - -// Log -SLX_XEH_DisableLogging = isClass(configFile/"CfgPatches"/"Disable_XEH_Logging"); - -// Backup functions for macros -// TODO: Cleanup... -// CBA_fnc_log = { diag_log [diag_frameNo, diag_tickTime, time, _this] }; - - -/* CBA_fnc_defaultParam = { - 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; - }; -}; -*/ - -XEH_LOG("XEH: PreInit Started. v"+getText(configFile >> "CfgPatches" >> "CBA_XEH" >> "version")+". "+PFORMAT_5("MISSINIT",missionName,worldName,isMultiplayer,isServer,isDedicated)); -if (time > 0) then { XEH_LOG("XEH WARNING: Time > 0; This probably means there are no XEH compatible units by default on the map, perhaps add the SLX_XEH_Logic module.") }; - -// Compile all necessary scripts and start one vehicle crew initialisation thread -_cfgRespawn = (missionConfigFile/"respawn"); -_respawn = false; -if ( isNumber(_cfgRespawn) ) then { - _respawn = !(getNumber(_cfgRespawn) in [0, 1, 4, 5]); -}; -if ( isText(_cfgRespawn) ) then { - _respawn = !(getText(_cfgRespawn) in ["none", "bird", "group", "side"]); -}; - -SLX_XEH_objects = []; // Temporary array, to track InitPosts at mission initialization -SLX_XEH_INIT_MEN = []; // Temporary array, to track ManBased inits - to workaround JIP issue "Double init eh ran for crew units" -SLX_XEH_DELAYED = []; // Temporary array, to track Delayed Inits at mission initialization - - -// Game version detection -_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 -//}; - -FUNC(determineProductVersion) = { - 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] - - } 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; -}; - -FUNC(determineGame) = { - // 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}; - }; -}; - -// 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 -]; - -SLX_XEH_DUMMY = switch (SLX_XEH_MACHINE select 14) do { - case 2: {"Helipad_Invisible_H" }; - case 3: {"Land_HelipadEmpty_F" }; - default { "HeliHEmpty" }; -}; - -SLX_XEH_STR = ""; // Empty string -SLX_XEH_STR_INIT_EH = "Extended_Init_EventHandlers"; -SLX_XEH_STR_INIT_POST_EH = "Extended_InitPost_EventHandlers"; -SLX_XEH_STR_PreInit = "Extended_PreInit_EventHandlers"; -SLX_XEH_STR_PostInit = "Extended_PostInit_EventHandlers"; -SLX_XEH_STR_DEH = "DefaultEventhandlers"; -SLX_XEH_STR_TAG = "SLX_XEH_"; -SLX_XEH_STR_PLAYABLE = "SLX_XEH_PLAYABLE"; - -SLX_XEH_STR_PROCESSED = "SLX_XEH_PROCESSED"; -SLX_XEH_AR_FALSE = [SLX_XEH_STR_PROCESSED, false]; -SLX_XEH_AR_TRUE = [SLX_XEH_STR_PROCESSED, true]; - -SLX_XEH_OTHER_EVENTS = [XEH_EVENTS,XEH_CUSTOM_EVENTS]; // All events except the init event -SLX_XEH_OTHER_EVENTS_FULL = []; -{ SLX_XEH_OTHER_EVENTS_FULL pushBack format["Extended_%1_EventHandlers", _x] } forEach SLX_XEH_OTHER_EVENTS; -SLX_XEH_OTHER_EVENTS_XEH = []; -{ SLX_XEH_OTHER_EVENTS_XEH pushBack format["Extended_%1EH", _x] } forEach SLX_XEH_OTHER_EVENTS; -SLX_XEH_OTHER_EVENTS_XEH_PLAYERS = []; -{ SLX_XEH_OTHER_EVENTS_XEH_PLAYERS pushBack format["Extended_%1EH_Player", _x] } forEach SLX_XEH_OTHER_EVENTS; -SLX_XEH_OTHER_EVENTS_PLAYERS = []; - -// HitPart is special in that the passed parameter to the event handler is an array of arrays -{ - if (_x == "HitPart") then - { - SLX_XEH_OTHER_EVENTS_PLAYERS pushBack (compile format["{ { _this call _x } forEach (((_this select 0) select 0) getVariable [SLX_XEH_STR_%1_Player,[]]) }",_x]) - } - else - { - SLX_XEH_OTHER_EVENTS_PLAYERS pushBack (compile format["{ { _this call _x } forEach ((_this select 0) getVariable [SLX_XEH_STR_%1_Player,[]]) }",_x]) - } -} forEach SLX_XEH_OTHER_EVENTS; - -SLX_XEH_CONFIG_FILES = [configFile, campaignConfigFile, missionConfigFile]; -SLX_XEH_CONFIG_FILES_VARIABLE = [campaignConfigFile, missionConfigFile]; - -SLX_XEH_DEF_CLASSES = [SLX_XEH_STR, "All"]; - -// XEH for non XEH supported addons -// Only works until someone uses removeAllEventhandlers on the object -// Only works if there is at least 1 XEH-enabled object on the Map - Place SLX_XEH_Logic to make sure XEH initializes. -// TODO: Perhaps do a config verification - if no custom eventhandlers detected in _all_ CfgVehicles classes, don't run this XEH handler - might be too much processing. -SLX_XEH_EVENTS_NAT = [XEH_EVENTS]; -SLX_XEH_EVENTS_FULL_NAT = []; -{ SLX_XEH_EVENTS_FULL_NAT pushBack format["Extended_%1_EventHandlers", _x] } forEach SLX_XEH_EVENTS_NAT; - -SLX_XEH_EXCLUDES = []; // TODO: Anything else?? - Ammo crates for instance have no XEH by default due to crashes) - however, they don't appear in 'vehicles' list anyway. -SLX_XEH_CLASSES = []; // Used to cache classes that have full XEH setup - TODO: Performance test.. Could use object with a variable space, classname as key -SLX_XEH_FULL_CLASSES = []; // Used to cache classes that NEED full XEH setup -SLX_XEH_EXCL_CLASSES = []; // Used for exclusion classes - - -// Function Compilation -SLX_XEH_LOG = { XEH_LOG(_this); }; - -PREP(init_once); // Pre and PostInits - -PREP(init_delayed); -PREP(init_playable); - -// Inits and InitPosts -PREP(init); -PREP(init_enum); -PREP(init_enum_cache); -PREP(init_post); - -// Init Others -PREP(init_others); -PREP(init_others_enum); -PREP(init_others_enum_cache); - -PREP(addPlayerEvents); // Add / Remove the playerEvents -PREP(removePlayerEvents); -PREP(support_monitor); -PREP(support_monitor2); - -call COMPILE_FILE(init_eh); // All XEH Event functions - - -/* -* Process the crews of vehicles. This "thread" will run just -* before PostInit and the mission init.sqf is processed. The order of execution is -* -* 1) all config.cpp init EHs (including all Extended_Init_Eventhandlers) -* 2) all the init lines in the mission.sqm -* 3) spawn:ed "threads" are started -* 4) the mission's init.sqf/sqs is run -*/ - -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 - - { - _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 - -// 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; -}]; - -// 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]; }; - }; - }; - - // 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 - - // 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 }; - }; - - // 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. -*/ -{ (_x/SLX_XEH_STR_PreInit) call FUNC(init_once) } forEach SLX_XEH_CONFIG_FILES; - -private "_s"; -// Normally, full caching is enabled. If not, log an informative message. -_s = if (SLX_XEH_RECOMPILE || CBA_COMPILE_RECOMPILE || CBA_FUNC_RECOMPILE) then { - PFORMAT_3(" CACHE DISABLED? (Disable caching with cba_cache_disable.pbo)",SLX_XEH_RECOMPILE,CBA_COMPILE_RECOMPILE,CBA_FUNC_RECOMPILE) -} else { - "" -}; -XEH_LOG("XEH: PreInit Finished." + _s); diff --git a/tools/cba/addons/xeh/script_xeh.hpp b/tools/cba/addons/xeh/script_xeh.hpp index 4f242b492e..82fb724c03 100644 --- a/tools/cba/addons/xeh/script_xeh.hpp +++ b/tools/cba/addons/xeh/script_xeh.hpp @@ -8,103 +8,88 @@ // MACRO: EXTENDED_EVENTHANDLERS // Add all XEH event handlers ///////////////////////////////////////////////////////////////////////////////// -#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"; \ -animStateChanged = "_this call SLX_XEH_EH_AnimStateChanged"; \ -containerClosed = "_this call SLX_XEH_EH_ContainerClosed"; \ -containerOpened = "_this call SLX_XEH_EH_ContainerOpened"; \ -controlsShifted = "_this call SLX_XEH_EH_ControlsShifted"; \ -dammaged = "_this call SLX_XEH_EH_Dammaged"; \ -engine = "_this call SLX_XEH_EH_Engine"; \ -epeContact = "_this call SLX_XEH_EH_EpeContact"; \ -epeContactEnd = "_this call SLX_XEH_EH_EpeContactEnd"; \ -epeContactStart = "_this call SLX_XEH_EH_EpeContactStart"; \ -explosion = "_this call SLX_XEH_EH_Explosion"; \ -firedNear = "_this call SLX_XEH_EH_FiredNear"; \ -fuel = "_this call SLX_XEH_EH_Fuel"; \ -gear = "_this call SLX_XEH_EH_Gear"; \ -getIn = "_this call SLX_XEH_EH_GetIn"; \ -getOut = "_this call SLX_XEH_EH_GetOut"; \ -handleHeal = "_this call SLX_XEH_EH_HandleHeal"; \ -hit = "_this call SLX_XEH_EH_Hit"; \ -hitPart = "_this call SLX_XEH_EH_HitPart"; \ -incomingMissile = "_this call SLX_XEH_EH_IncomingMissile"; \ -inventoryClosed = "_this call SLX_XEH_EH_InventoryClosed"; \ -inventoryOpened = "_this call SLX_XEH_EH_InventoryOpened"; \ -killed = "_this call SLX_XEH_EH_Killed"; \ -landedTouchDown = "_this call SLX_XEH_EH_LandedTouchDown"; \ -landedStopped = "_this call SLX_XEH_EH_LandedStopped"; \ -local = "_this call SLX_XEH_EH_Local"; \ -respawn = "_this call SLX_XEH_EH_Respawn"; \ -put = "_this call SLX_XEH_EH_Put"; \ -take = "_this call SLX_XEH_EH_Take"; \ -seatSwitched = "_this call SLX_XEH_EH_SeatSwitched"; \ -soundPlayed = "_this call SLX_XEH_EH_SoundPlayed"; \ -weaponAssembled = "_this call SLX_XEH_EH_WeaponAssembled"; \ -weaponDisAssembled = "_this call SLX_XEH_EH_WeaponDisassembled"; - -//handleDamage = "_this call SLX_XEH_EH_HandleDamage"; \ -//mpHit = "_this call SLX_XEH_EH_MPHit"; \ -//mpKilled = "_this call SLX_XEH_EH_MPKilled"; \ -//mpRespawn = "_this call SLX_XEH_EH_MPRespawn"; +#define EXTENDED_EVENTHANDLERS init = "(_this select 0) call CBA_fnc_initEvents; (_this select 0) call CBA_fnc_init"; \ +fired = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_fired"")"; \ +animChanged = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_animChanged"")"; \ +animDone = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_animDone"")"; \ +animStateChanged = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_animStateChanged"")"; \ +containerClosed = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_containerClosed"")"; \ +containerOpened = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_containerOpened"")"; \ +controlsShifted = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_controlsShifted"")"; \ +dammaged = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_dammaged"")"; \ +engine = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_engine"")"; \ +epeContact = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_epeContact"")"; \ +epeContactEnd = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_epeContactEnd"")"; \ +epeContactStart = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_epeContactStart"")"; \ +explosion = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_explosion"")"; \ +firedNear = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_firedNear"")"; \ +fuel = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_cba_xeh_fuel"")"; \ +gear = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_gear"")"; \ +getIn = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_getIn"")"; \ +getOut = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_getOut"")"; \ +handleHeal = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_handleHeal"")"; \ +hit = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_hit"")"; \ +hitPart = "{_this call _x} forEach ((_this select 0 select 0) getVariable ""cba_xeh_hitPart"")"; \ +incomingMissile = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_incomingMissile"")"; \ +inventoryClosed = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_inventoryClosed"")"; \ +inventoryOpened = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_inventoryOpened"")"; \ +killed = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_killed"")"; \ +landedTouchDown = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_landedTouchDown"")"; \ +landedStopped = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_landedStopped"")"; \ +local = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_local"")"; \ +respawn = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_respawn"")"; \ +put = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_put"")"; \ +take = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_take"")"; \ +seatSwitched = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_seatSwitched"")"; \ +soundPlayed = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_soundPlayed"")"; \ +weaponAssembled = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponAssembled"")"; \ +weaponDisassembled = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponDisassembled"")"; \ +weaponDeployed = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponDeployed"")"; \ +weaponRested = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponRested"")"; /* 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) + Removes all event handlers. */ -#define DELETE_EVENTHANDLERS delete init; \ -delete fired; \ -delete animChanged; \ -delete animDone; \ -delete animStateChanged; \ -delete containerClosed; \ -delete containerOpened; \ -delete controlsShifted; \ -delete dammaged; \ -delete engine; \ -delete epeContact; \ -delete epeContactEnd; \ -delete epeContactStart; \ -delete explosion; \ -delete firedNear; \ -delete fuel; \ -delete gear; \ -delete getIn; \ -delete getOut; \ -delete handleHeal; \ -delete hit; \ -delete hitPart; \ -delete incomingMissile; \ -delete inventoryClosed; \ -delete inventoryOpened; \ -delete killed; \ -delete landedTouchDown; \ -delete landedStopped; \ -delete local; \ -delete respawn; \ -delete put; \ -delete take; \ -delete seatSwitched; \ -delete soundPlayed; \ -delete weaponAssembled; \ -delete weaponDisAssembled; +#define DELETE_EVENTHANDLERS init = ""; \ +fired = ""; \ +animChanged = ""; \ +animDone = ""; \ +animStateChanged = ""; \ +containerClosed = ""; \ +containerOpened = ""; \ +controlsShifted = ""; \ +dammaged = ""; \ +engine = ""; \ +epeContact = ""; \ +epeContactEnd = ""; \ +epeContactStart = ""; \ +explosion = ""; \ +firedNear = ""; \ +fuel = ""; \ +gear = ""; \ +getIn = ""; \ +getOut = ""; \ +handleHeal = ""; \ +hit = ""; \ +hitPart = ""; \ +incomingMissile = ""; \ +inventoryClosed = ""; \ +inventoryOpened = ""; \ +killed = ""; \ +landedTouchDown = ""; \ +landedStopped = ""; \ +local = ""; \ +respawn = ""; \ +put = ""; \ +take = ""; \ +seatSwitched = ""; \ +soundPlayed = ""; \ +weaponAssembled = ""; \ +weaponDisassembled = ""; \ +weaponDeployed = ""; \ +weaponRested = ""; diff --git a/tools/config_validator.py b/tools/config_validator.py new file mode 100644 index 0000000000..790734101f --- /dev/null +++ b/tools/config_validator.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 + +#by PabstMirror - python script to verify all addons using MakePbo's lint checking and extFile Checking +#Arguments (eg: `config_validator.py full`): +#full dump full deRaped config of problem +#skipExt skips checking external file references + +import os +import sys +import subprocess +import timeit +import time + +######## GLOBALS ######### +MAINPREFIX = "Z" +PREFIX = "ACE" +########################## + +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 + +def CheckPBO(p,makePboArgs,errors): + try: + subprocess.run([ + "makepbo", + makePboArgs, + "-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p), + p, + "{}_{}.pbo".format(PREFIX,p) + ], stdin=None, input=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) + except subprocess.CalledProcessError as e: + print("!! Problem With {} ret {} !!".format(p, e.returncode)) + print(" stderr: {}".format(e.stderr)) + errors.append(p) + else: + print(" Checked ok {}".format(p)) + return + +def fullDump(p): + try: + subprocess.run([ + "makepbo", + "-PQGs", #Q Lint only - Gs Check external references and show deRap - P dont pause + "-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p), + p, + "{}_{}.pbo".format(PREFIX,p) + ], stdin=None, input=None, check=True) + except subprocess.CalledProcessError as e: + input("Press Enter to continue...") + return + +def main(argv): + print(""" + #################### + # ACE3 Config Check # + #################### +""") + + start_time = timeit.default_timer() + + addonspath = os.path.join("P:\\",MAINPREFIX,PREFIX,"addons") + + print("Switching to dir: {}".format(addonspath)) + try: + os.chdir(addonspath) + except: + raise Exception("Failed to switch to addon dir on P:") + + #Q Lint only - G Check external references - P dont pause (Gs) does full derap + makePboArgs = "-PQG" + if "skipExt" in argv: + print("Skipping External Files Check"); + makePboArgs = "-PQ" + + errors = [] + + for p in os.listdir(addonspath): + path = os.path.join(addonspath, p) + if not os.path.isdir(path): + continue + if p[0] == ".": + continue + CheckPBO(p,makePboArgs,errors) + + + d,h,m,s = Fract_Sec(timeit.default_timer() - start_time) + print("\n# Done with {0} errrors [took: {1:2}h {2:2}m {3:4.5f}s]".format(len(errors),h,m,s)) + + if (len(errors) > 0): + if "full" in argv: + input("Dumping Full DeRap: Press Enter to continue...") + for p in errors: + fullDump(p) + else: + print("use 'full' arg to show derap") + + ret = len(errors) + print("return {}".format(ret)) + return ret + +if __name__ == "__main__": + main(sys.argv) diff --git a/tools/make.py b/tools/make.py index 82c7a881d6..ecbb0216b8 100644 --- a/tools/make.py +++ b/tools/make.py @@ -73,8 +73,10 @@ dssignfile = "" prefix = "ace" pbo_name_prefix = "ace_" signature_blacklist = ["ace_server.pbo"] -importantFiles = ["mod.cpp", "README.md", "AUTHORS.txt", "LICENSE", "logo_ace3_ca.paa"] -versionFiles = ["README.md", "mod.cpp"] +importantFiles = ["mod.cpp", "README.md", "docs\\README_DE.md", "docs\\README_PL.md", "AUTHORS.txt", "LICENSE", "logo_ace3_ca.paa", "meta.cpp"] +versionFiles = ["README.md", "docs\\README_DE.md", "docs\\README_PL.md", "mod.cpp"] + +ciBuild = False # Used for CI builds ############################################################################### # http://akiscode.com/articles/sha-1directoryhash.shtml @@ -330,15 +332,20 @@ def copy_important_files(source_dir,destination_dir): originalDir = os.getcwd() - #copy importantFiles + # Copy importantFiles try: print_blue("\nSearching for important files in {}".format(source_dir)) print("Source_dir: {}".format(source_dir)) print("Destination_dir: {}".format(destination_dir)) for file in importantFiles: + filePath = os.path.join(module_root_parent, file) + # Take only file name for destination path (to put it into root of release dir) + if "\\" in file: + count = file.count("\\") + file = file.split("\\", count)[-1] print_green("Copying file => {}".format(os.path.join(source_dir,file))) - shutil.copyfile(os.path.join(source_dir,file),os.path.join(destination_dir,file)) + shutil.copyfile(os.path.join(source_dir,filePath),os.path.join(destination_dir,file)) except: print_error("COPYING IMPORTANT FILES.") raise @@ -626,6 +633,10 @@ def stash_version_files_for_building(): try: for file in versionFiles: filePath = os.path.join(module_root_parent, file) + # Take only file name for stash location if in subfolder (otherwise it gets removed when removing folders from release dir) + if "\\" in file: + count = file.count("\\") + file = file.split("\\", count)[-1] stashPath = os.path.join(release_dir, file) print("Temporarily stashing {} => {}.bak for version update".format(filePath, stashPath)) shutil.copy(filePath, "{}.bak".format(stashPath)) @@ -642,6 +653,10 @@ def restore_version_files(): try: for file in versionFiles: filePath = os.path.join(module_root_parent, file) + # Take only file name for stash path if in subfolder (otherwise it gets removed when removing folders from release dir) + if "\\" in file: + count = file.count("\\") + file = file.split("\\", count)[-1] stashPath = os.path.join(release_dir, file) print("Restoring {}".format(filePath)) shutil.move("{}.bak".format(stashPath), filePath) @@ -697,11 +712,9 @@ def version_stamp_pboprefix(module,commitID): f.close() if configtext: - patchestext = re.search(r"version.*?=.*?$", configtext, re.DOTALL) - if patchestext: + if re.search(r"version=(.*?)$", configtext, re.DOTALL): if configtext: - patchestext = re.search(r"(version.*?=)(.*?)$", configtext, re.DOTALL).group(1) - configtext = re.sub(r"version(.*?)=(.*?)$", "version = {}\n".format(commitID), configtext, flags=re.DOTALL) + configtext = re.sub(r"version=(.*?)$", "version={}\n".format(commitID), configtext, flags=re.DOTALL) f = open(configpath, "w") f.write(configtext) f.close() @@ -744,6 +757,7 @@ def main(argv): global dssignfile global prefix global pbo_name_prefix + global ciBuild if sys.platform != "win32": print_error("Non-Windows platform (Cygwin?). Please re-run from cmd.") @@ -847,6 +861,10 @@ See the make.cfg file for additional build options. else: version_update = False + if "--ci" in argv: + argv.remove("--ci") + ciBuild = True + print_yellow("\nCheck external references is set to {}".format(str(check_external))) # Get the directory the make script is in. @@ -936,7 +954,7 @@ See the make.cfg file for additional build options. # See if we have been given specific modules to build from command line. if len(argv) > 1 and not make_release_zip: arg_modules = True - modules = argv[1:] + modules = [a for a in argv[1:] if a[0] != "-"] # Find the tools we need. try: @@ -975,6 +993,17 @@ See the make.cfg file for additional build options. print ("No cache found.") cache = {} + # Check the build version (from main) with cached version - forces a full rebuild when version changes + project_version = get_project_version() + cacheVersion = "None"; + if 'cacheVersion' in cache: + cacheVersion = cache['cacheVersion'] + + if (project_version != cacheVersion): + cache = {} + print("Reseting Cache {0} to New Version {1}".format(cacheVersion, project_version)) + cache['cacheVersion'] = project_version + if not os.path.isdir(os.path.join(release_dir, project, "addons")): try: os.makedirs(os.path.join(release_dir, project, "addons")) @@ -999,6 +1028,9 @@ See the make.cfg file for additional build options. set_version_in_files(); print("Version in files has been changed, make sure you commit and push the updates!") + amountOfBuildsFailed = 0 + namesOfBuildsFailed = [] + try: # Temporarily copy optionals_root for building. They will be removed later. optionals_modules = [] @@ -1083,9 +1115,6 @@ See the make.cfg file for additional build options. print_error("\nFailed to delete {}".format(os.path.join(obsolete_check_path,file))) pass - amountOfBuildsFailed = 0 - namesOfBuildsFailed = [] - # For each module, prep files and then build. print_blue("\nBuilding...") for module in modules: @@ -1399,6 +1428,7 @@ See the make.cfg file for additional build options. for failedModuleName in namesOfBuildsFailed: print("- {} failed.".format(failedModuleName)) + sys.exit(1) else: print_green("\Completed with 0 errors.") @@ -1407,4 +1437,8 @@ if __name__ == "__main__": 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)) + + if ciBuild: + sys.exit(0) + input("Press Enter to continue...")