Merge branch 'master' of https://github.com/acemod/ACE3 into map_gestures

Conflicts:
	AUTHORS.txt
This commit is contained in:
Michael Braun 2015-08-29 22:22:16 +02:00
commit fa4ae6c9a8
575 changed files with 10222 additions and 5154 deletions

View File

@ -14,6 +14,7 @@ Garth "L-H" de Wet <garthofhearts@gmail.com>
Giallustio Giallustio
Glowbal Glowbal
Janus Janus
jokoho482 <jokoho482@gmail.com>`
Kieran Kieran
NouberNou NouberNou
PabstMirror <pabstmirror@gmail.com> PabstMirror <pabstmirror@gmail.com>
@ -70,8 +71,7 @@ Hamburger SV
Harakhti <shadowdragonphd@gmail.com> Harakhti <shadowdragonphd@gmail.com>
havena <silveredenis@gmail.com> havena <silveredenis@gmail.com>
Hawkins Hawkins
Head Head <brobergsebastian@gmail.com>
jokoho482 <jokoho482@gmail.com>`
Jonpas <jonpas33@gmail.com> Jonpas <jonpas33@gmail.com>
Karneck <dschultz26@hotmail.com> Karneck <dschultz26@hotmail.com>
Kavinsky <nmunozfernandez@gmail.com> Kavinsky <nmunozfernandez@gmail.com>

View File

@ -1,27 +1,21 @@
<p align="center"> <p align="center">
<img src="https://github.com/acemod/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg" <img src="https://github.com/acemod/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg" width="480">
height="112">
</p> </p>
<p align="center"> <p align="center">
<a href="https://github.com/acemod/ACE3/releases"> <a href="https://github.com/acemod/ACE3/releases">
<img src="https://img.shields.io/badge/Version-3.2.1-blue.svg" <img src="https://img.shields.io/badge/Version-3.2.1-blue.svg" alt="ACE3 version">
alt="ACE version">
</a> </a>
<a href="https://github.com/acemod/ACE3/releases/download/v3.2.1/ace3_3.2.1.zip"> <a href="https://github.com/acemod/ACE3/releases/download/v3.2.1/ace3_3.2.1.zip">
<img src="http://img.shields.io/badge/Download-56.5_MB-green.svg" <img src="http://img.shields.io/badge/Download-56.5_MB-green.svg" alt="ACE3 download">
alt="ACE download">
</a> </a>
<a href="https://github.com/acemod/ACE3/issues"> <a href="https://github.com/acemod/ACE3/issues">
<img src="http://img.shields.io/github/issues-raw/acemod/ACE3.svg?label=Issues" <img src="http://img.shields.io/github/issues-raw/acemod/ACE3.svg?label=Issues" alt="ACE3 issues">
alt="ACE issues">
</a> </a>
<a href="http://forums.bistudio.com/showthread.php?191716-ACE3-A-collaborative-merger-between-AGM-CSE-and-ACE&p=2935435&viewfull=1#post2935435"> <a href="http://forums.bistudio.com/showthread.php?191716-ACE3-A-collaborative-merger-between-AGM-CSE-and-ACE&p=2935435&viewfull=1#post2935435">
<img src="https://img.shields.io/badge/BIF-Thread-lightgrey.svg" <img src="https://img.shields.io/badge/BIF-Thread-lightgrey.svg" alt="BIF thread">
alt="BIF thread">
</a> </a>
<a href="https://github.com/acemod/ACE3/blob/master/LICENSE"> <a href="https://github.com/acemod/ACE3/blob/master/LICENSE">
<img src="http://img.shields.io/badge/License-GPLv2-red.svg" <img src="http://img.shields.io/badge/License-GPLv2-red.svg" alt="ACE3 license">
alt="ACE license">
</a> </a>
</p> </p>
<p align="center"><sup><strong>Requires the latest version of <a href="http://www.armaholic.com/page.php?id=18767">CBA A3</a>. Visit us on <a href="https://www.facebook.com/ACE3Mod">Facebook</a> | <a href="https://www.youtube.com/c/ACE3Mod">YouTube</a> | <a href="https://twitter.com/ACE3Mod">Twitter</a> | <a href="http://www.reddit.com/r/arma/search?q=ACE&restrict_sr=on&sort=new&t=all">Reddit</a></strong></sup></p> <p align="center"><sup><strong>Requires the latest version of <a href="http://www.armaholic.com/page.php?id=18767">CBA A3</a>. Visit us on <a href="https://www.facebook.com/ACE3Mod">Facebook</a> | <a href="https://www.youtube.com/c/ACE3Mod">YouTube</a> | <a href="https://twitter.com/ACE3Mod">Twitter</a> | <a href="http://www.reddit.com/r/arma/search?q=ACE&restrict_sr=on&sort=new&t=all">Reddit</a></strong></sup></p>

View File

@ -3,8 +3,9 @@ ace_advanced_ballistics
The Advanced Ballistics module introduces advanced external- and internal ballistics to the game. The Advanced Ballistics module introduces advanced external- and internal ballistics to the game.
## Maintainers ## Maintainers
The people responsible for merging changes to this component or answering potential questions. The people responsible for merging changes to this component or answering potential questions.
- [Ruthberg] (http://github.com/Ulteq) - [Ruthberg](http://github.com/Ulteq)

View File

@ -6,9 +6,8 @@ GVAR(currentbulletID) = -1;
GVAR(Protractor) = false; GVAR(Protractor) = false;
GVAR(ProtractorStart) = ACE_time; GVAR(ProtractorStart) = ACE_time;
GVAR(allBullets) = [];
GVAR(currentGrid) = 0; GVAR(currentGrid) = 0;
GVAR(initMessageEnabled) = false;
GVAR(extensionAvailable) = true; GVAR(extensionAvailable) = true;
/* @TODO: Remove this until versioning is in sync with cmake/build versioning /* @TODO: Remove this until versioning is in sync with cmake/build versioning

View File

@ -13,5 +13,5 @@ PREP(initializeTerrainExtension);
PREP(initModuleSettings); PREP(initModuleSettings);
PREP(readAmmoDataFromConfig); PREP(readAmmoDataFromConfig);
PREP(readWeaponDataFromConfig); PREP(readWeaponDataFromConfig);
PREP(handleFirePFH);
ADDON = true; ADDON = true;

View File

@ -8,29 +8,29 @@
* 1: temperature - degrees celcius <NUMBER> * 1: temperature - degrees celcius <NUMBER>
* *
* Return Value: * Return Value:
* 0: muzzle velocity shift - m/s <NUMBER> * muzzle velocity shift - m/s <NUMBER>
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_muzzleVelocityShiftTable", "_temperature", "_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"]; private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
_muzzleVelocityShiftTable = _this select 0; "_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
_temperature = _this select 1; params["_muzzleVelocityShiftTable", "_temperature"];
if (count _muzzleVelocityShiftTable != 11) exitWith { 0 }; // Check if muzzleVelocityShiftTable is Larger Than 11 Entrys
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
_temperatureIndexA = floor((_temperature + 15) / 5); // Find exact data index required for given temperature
_temperatureIndexA = 0 max _temperatureIndexA; _temperatureIndexFunction = (_temperature + 15) / 5;
_temperatureIndexA = _temperatureIndexA min 10;
_temperatureIndexB = ceil((_temperature + 15) / 5); // lower and upper data index used for interpolation
_temperatureIndexB = 0 max _temperatureIndexB; _temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
_temperatureIndexB = _temperatureIndexB min 10; _temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
_temperatureRatio = ((_temperature + 15) / 5) - floor((_temperature + 15) / 5); // Interpolation ratio
_interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
_muzzleVelocityShift = (_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _temperatureRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _temperatureRatio; // Interpolation
(_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _interpolationRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _interpolationRatio // Return
_muzzleVelocityShift

View File

@ -17,12 +17,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_ballisticCoefficient", "_temperature", "_pressure", "_relativeHumidity", "_atmosphereModel", "_airDensity"]; private "_airDensity";
_ballisticCoefficient = _this select 0;
_temperature = _this select 1; // in C params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/];
_pressure = _this select 2; // in hPa
_relativeHumidity = _this select 3; // as ratio 0-1
_atmosphereModel = _this select 4; // "ICAO" or "ASM"
_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity); _airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);

View File

@ -1,5 +1,5 @@
/* /*
* Author: Ruthberg * Author: Ruthberg, MikeMatrix, joko // Jonas
* *
* Calculates the muzzle velocity shift caused by different barrel lengths * Calculates the muzzle velocity shift caused by different barrel lengths
* *
@ -10,46 +10,61 @@
* 3: muzzle velocity - m/s <NUMBER> * 3: muzzle velocity - m/s <NUMBER>
* *
* Return Value: * Return Value:
* 0: muzzle velocity shift - m/s <NUMBER> * muzzle velocity shift - m/s <NUMBER>
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity", "_lowerIndex", "_upperIndex", "_barrelLengthRatio", "_muzzleVelocityNew"]; scopeName "main";
_barrelLength = _this select 0;
_muzzleVelocityTable = _this select 1;
_barrelLengthTable = _this select 2;
_muzzleVelocity = _this select 3;
private ["_muzzleVelocityTableCount", "_barrelLengthTableCount", "_lowerDataIndex",
"_upperDataIndex", "_lowerBarrelLength", "_upperBarrelLength", "_lowerMuzzleVelocity",
"_upperMuzzleVelocity", "_interpolationRatio"];
params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"];
// If barrel length is not defined, then there is no point in calculating muzzle velocity
if (_barrelLength == 0) exitWith { 0 }; if (_barrelLength == 0) exitWith { 0 };
if (count _muzzleVelocityTable != count _barrelLengthTable) exitWith { 0 };
if (count _muzzleVelocityTable == 0 || count _barrelLengthTable == 0) exitWith { 0 };
if (count _muzzleVelocityTable == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
_lowerIndex = 0; _muzzleVelocityTableCount = count _muzzleVelocityTable;
_upperIndex = (count _barrelLengthTable) - 1; _barrelLengthTableCount = count _barrelLengthTable;
if (_barrelLength <= (_barrelLengthTable select _lowerIndex)) exitWith { (_muzzleVelocityTable select _lowerIndex) - _muzzleVelocity }; // Exit if tables are different sizes, have no elements or have only one element
if (_barrelLength >= (_barrelLengthTable select _upperIndex)) exitWith { (_muzzleVelocityTable select _upperIndex) - _muzzleVelocity }; if (_muzzleVelocityTableCount != _barrelLengthTableCount || _muzzleVelocityTableCount == 0 || _barrelLengthTableCount == 0) exitWith { 0 };
if (_muzzleVelocityTableCount == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
for "_i" from 0 to (count _barrelLengthTable) - 1 do { // If we have the precise barrel length value, return result immediately
if (_barrelLength >= _barrelLengthTable select _i) then { if (_barrelLength in _barrelLengthTable) exitWith {
_lowerIndex = _i; (_muzzleVelocityTable select (_barrelLengthTable find _barrelLength)) - _muzzleVelocity
}; };
};
for "_i" from (count _barrelLengthTable) - 1 to 0 step -1 do { // Limit values to lower and upper bound of data we have available
if (_barrelLength <= _barrelLengthTable select _i) then { if (_barrelLength <= (_barrelLengthTable select 0)) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
_upperIndex = _i; if (_barrelLength >= (_barrelLengthTable select _barrelLengthTableCount - 1)) exitWith { (_muzzleVelocityTable select _barrelLengthTableCount - 1) - _muzzleVelocity };
// Find closest bordering values for barrel length
{
if (_barrelLength <= _x) then {
_upperDataIndex = _forEachIndex;
_lowerDataIndex = _upperDataIndex - 1;
breakTo "main";
}; };
} forEach _barrelLengthTable;
// Worst case scenario
if (isNil "_lowerDataIndex" || isNil "_upperDataIndex") exitWith {0};
_lowerBarrelLength = _barrelLengthTable select _lowerDataIndex;
_upperBarrelLength = _barrelLengthTable select _upperDataIndex;
_lowerMuzzleVelocity = _muzzleVelocityTable select _lowerDataIndex;
_upperMuzzleVelocity = _muzzleVelocityTable select _upperDataIndex;
// Calculate interpolation ratio
_interpolationRatio = if (abs (_lowerBarrelLength - _upperBarrelLength) > 0) then {
(_upperBarrelLength - _barrelLength) / (_upperBarrelLength - _lowerBarrelLength)
} else {
0
}; };
_barrelLengthRatio = 0; // Calculate interpolated muzzle velocity shift
if ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex) > 0) then { (_lowerMuzzleVelocity + ((_upperMuzzleVelocity - _lowerMuzzleVelocity) * (1 - _interpolationRatio))) - _muzzleVelocity // Return
_barrelLengthRatio = ((_barrelLengthTable select _upperIndex) - _barrelLength) / ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex));
};
_muzzleVelocityNew = (_muzzleVelocityTable select _lowerIndex) + ((_muzzleVelocityTable select _upperIndex) - (_muzzleVelocityTable select _lowerIndex)) * (1 - _barrelLengthRatio);
_muzzleVelocityNew - _muzzleVelocity

View File

@ -4,142 +4,129 @@
* Calculates the retardation of the bullet * Calculates the retardation of the bullet
* *
* Arguments: * Arguments:
* 0: drag model - 1-7 <integer> * 0: drag model - integer 1-7 <NUMBER>
* 1: drag coefficient - bc <NUMBER> * 1: drag coefficient - bc <NUMBER>
* 2: velocity - m/s <NUMBER> * 2: velocity - m/s <NUMBER>
* *
* Return Value: * Return Value:
* 0: retardation - m/(s^2) <NUMBER> * retardation - m/(s^2) <NUMBER>
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
// Source: GNU Exterior Ballistics // Source: GNU Exterior Ballistics
private ["_dragModel", "_dragCoefficient", "_velocity", "_A", "_M", "_result"]; private ["_A", "_M"];
_dragModel = _this select 0; params ["_dragModel", "_dragCoefficient", "_velocity"];
_dragCoefficient = _this select 1; _velocity = _velocity * 3.2808399;
_velocity = (_this select 2) * 3.2808399;
_A = -1;
_M = -1;
_result = 0;
switch _dragModel do { switch _dragModel do {
case 1: case 1: {
{ call {
switch true do { if (_velocity > 4230) exitWith { _A = 0.0001477404177730177; _M = 1.9565; };
case (_velocity > 4230) : { _A = 0.0001477404177730177; _M = 1.9565; }; if (_velocity > 3680) exitWith { _A = 0.0001920339268755614; _M = 1.925; };
case (_velocity > 3680) : { _A = 0.0001920339268755614; _M = 1.925 ; }; if (_velocity > 3450) exitWith { _A = 0.0002894751026819746; _M = 1.875; };
case (_velocity > 3450) : { _A = 0.0002894751026819746; _M = 1.875 ; }; if (_velocity > 3295) exitWith { _A = 0.0004349905111115636; _M = 1.825; };
case (_velocity > 3295) : { _A = 0.0004349905111115636; _M = 1.825 ; }; if (_velocity > 3130) exitWith { _A = 0.0006520421871892662; _M = 1.775; };
case (_velocity > 3130) : { _A = 0.0006520421871892662; _M = 1.775 ; }; if (_velocity > 2960) exitWith { _A = 0.0009748073694078696; _M = 1.725; };
case (_velocity > 2960) : { _A = 0.0009748073694078696; _M = 1.725 ; }; if (_velocity > 2830) exitWith { _A = 0.001453721560187286; _M = 1.675; };
case (_velocity > 2830) : { _A = 0.001453721560187286; _M = 1.675 ; }; if (_velocity > 2680) exitWith { _A = 0.002162887202930376; _M = 1.625; };
case (_velocity > 2680) : { _A = 0.002162887202930376; _M = 1.625 ; }; if (_velocity > 2460) exitWith { _A = 0.003209559783129881; _M = 1.575; };
case (_velocity > 2460) : { _A = 0.003209559783129881; _M = 1.575 ; }; if (_velocity > 2225) exitWith { _A = 0.003904368218691249; _M = 1.55; };
case (_velocity > 2225) : { _A = 0.003904368218691249; _M = 1.55 ; }; if (_velocity > 2015) exitWith { _A = 0.003222942271262336; _M = 1.575; };
case (_velocity > 2015) : { _A = 0.003222942271262336; _M = 1.575 ; }; if (_velocity > 1890) exitWith { _A = 0.002203329542297809; _M = 1.625; };
case (_velocity > 1890) : { _A = 0.002203329542297809; _M = 1.625 ; }; if (_velocity > 1810) exitWith { _A = 0.001511001028891904; _M = 1.675; };
case (_velocity > 1810) : { _A = 0.001511001028891904; _M = 1.675 ; }; if (_velocity > 1730) exitWith { _A = 0.0008609957592468259; _M = 1.75; };
case (_velocity > 1730) : { _A = 0.0008609957592468259; _M = 1.75 ; }; if (_velocity > 1595) exitWith { _A = 0.0004086146797305117; _M = 1.85; };
case (_velocity > 1595) : { _A = 0.0004086146797305117; _M = 1.85 ; }; if (_velocity > 1520) exitWith { _A = 0.0001954473210037398; _M = 1.95; };
case (_velocity > 1520) : { _A = 0.0001954473210037398; _M = 1.95 ; }; if (_velocity > 1420) exitWith { _A = 0.00005431896266462351; _M = 2.125; };
case (_velocity > 1420) : { _A = 0.00005431896266462351; _M = 2.125 ; }; if (_velocity > 1360) exitWith { _A = 0.000008847742581674416; _M = 2.375; };
case (_velocity > 1360) : { _A = 0.000008847742581674416; _M = 2.375 ; }; if (_velocity > 1315) exitWith { _A = 0.000001456922328720298; _M = 2.625; };
case (_velocity > 1315) : { _A = 0.000001456922328720298; _M = 2.625 ; }; if (_velocity > 1280) exitWith { _A = 0.0000002419485191895565; _M = 2.875; };
case (_velocity > 1280) : { _A = 0.0000002419485191895565; _M = 2.875 ; }; if (_velocity > 1220) exitWith { _A = 0.00000001657956321067612; _M = 3.25; };
case (_velocity > 1220) : { _A = 0.00000001657956321067612; _M = 3.25 ; }; if (_velocity > 1185) exitWith { _A = 0.0000000004745469537157371; _M = 3.75; };
case (_velocity > 1185) : { _A = 0.0000000004745469537157371; _M = 3.75 ; }; if (_velocity > 1150) exitWith { _A = 0.00000000001379746590025088; _M = 4.25; };
case (_velocity > 1150) : { _A = 0.00000000001379746590025088; _M = 4.25 ; }; if (_velocity > 1100) exitWith { _A = 0.0000000000004070157961147882; _M = 4.75; };
case (_velocity > 1100) : { _A = 0.0000000000004070157961147882; _M = 4.75 ; }; if (_velocity > 1060) exitWith { _A = 0.00000000000002938236954847331; _M = 5.125; };
case (_velocity > 1060) : { _A = 0.00000000000002938236954847331; _M = 5.125 ; }; if (_velocity > 1025) exitWith { _A = 0.00000000000001228597370774746; _M = 5.25; };
case (_velocity > 1025) : { _A = 0.00000000000001228597370774746; _M = 5.25 ; }; if (_velocity > 980) exitWith { _A = 0.00000000000002916938264100495; _M = 5.125; };
case (_velocity > 980) : { _A = 0.00000000000002916938264100495; _M = 5.125 ; }; if (_velocity > 945) exitWith { _A = 0.0000000000003855099424807451; _M = 4.75; };
case (_velocity > 945) : { _A = 0.0000000000003855099424807451; _M = 4.75 ; }; if (_velocity > 905) exitWith { _A = 0.00000000001185097045689854; _M = 4.25; };
case (_velocity > 905) : { _A = 0.00000000001185097045689854; _M = 4.25 ; }; if (_velocity > 860) exitWith { _A = 0.0000000003566129470974951; _M = 3.75; };
case (_velocity > 860) : { _A = 0.0000000003566129470974951; _M = 3.75 ; }; if (_velocity > 810) exitWith { _A = 0.00000001045513263966272; _M = 3.25; };
case (_velocity > 810) : { _A = 0.00000001045513263966272; _M = 3.25 ; }; if (_velocity > 780) exitWith { _A = 0.0000001291159200846216; _M = 2.875; };
case (_velocity > 780) : { _A = 0.0000001291159200846216; _M = 2.875 ; }; if (_velocity > 750) exitWith { _A = 0.0000006824429329105383; _M = 2.625; };
case (_velocity > 750) : { _A = 0.0000006824429329105383; _M = 2.625 ; }; if (_velocity > 700) exitWith { _A = 0.000003569169672385163; _M = 2.375; };
case (_velocity > 700) : { _A = 0.000003569169672385163; _M = 2.375 ; }; if (_velocity > 640) exitWith { _A = 0.00001839015095899579; _M = 2.125; };
case (_velocity > 640) : { _A = 0.00001839015095899579; _M = 2.125 ; }; if (_velocity > 600) exitWith { _A = 0.00005711174688734240; _M = 1.950; };
case (_velocity > 600) : { _A = 0.00005711174688734240; _M = 1.950 ; }; if (_velocity > 550) exitWith { _A = 0.00009226557091973427; _M = 1.875; };
case (_velocity > 550) : { _A = 0.00009226557091973427; _M = 1.875 ; }; if (_velocity > 250) exitWith { _A = 0.00009337991957131389; _M = 1.875; };
case (_velocity > 250) : { _A = 0.00009337991957131389; _M = 1.875 ; }; if (_velocity > 100) exitWith { _A = 0.00007225247327590413; _M = 1.925; };
case (_velocity > 100) : { _A = 0.00007225247327590413; _M = 1.925 ; }; if (_velocity > 65) exitWith { _A = 0.00005792684957074546; _M = 1.975; };
case (_velocity > 65) : { _A = 0.00005792684957074546; _M = 1.975 ; }; if (_velocity > 0) exitWith { _A = 0.00005206214107320588; _M = 2.000; };
case (_velocity > 0) : { _A = 0.00005206214107320588; _M = 2.000 ; };
}; };
}; };
case 2: case 2: {
{ call {
switch true do { if (_velocity > 1674) exitWith { _A = 0.0079470052136733; _M = 1.36999902851493; };
case (_velocity > 1674) : { _A = 0.0079470052136733; _M = 1.36999902851493; }; if (_velocity > 1172) exitWith { _A = 0.00100419763721974; _M = 1.65392237010294; };
case (_velocity > 1172) : { _A = 0.00100419763721974; _M = 1.65392237010294; }; if (_velocity > 1060) exitWith { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; };
case (_velocity > 1060) : { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; }; if (_velocity > 949) exitWith { _A = 0.000000000139589807205091; _M = 3.81439537623717; };
case (_velocity > 949) : { _A = 0.000000000139589807205091; _M = 3.81439537623717; }; if (_velocity > 670) exitWith { _A = 0.000234364342818625; _M = 1.71869536324748; };
case (_velocity > 670) : { _A = 0.000234364342818625; _M = 1.71869536324748; }; if (_velocity > 335) exitWith { _A = 0.000177962438921838; _M = 1.76877550388679; };
case (_velocity > 335) : { _A = 0.000177962438921838; _M = 1.76877550388679; }; if (_velocity > 0) exitWith { _A = 0.0000518033561289704; _M = 1.98160270524632; };
case (_velocity > 0) : { _A = 0.0000518033561289704; _M = 1.98160270524632; };
}; };
}; };
case 5: case 5: {
{ call {
switch true do { if (_velocity > 1730) exitWith { _A = 0.00724854775171929; _M = 1.41538574492812; };
case (_velocity > 1730) : { _A = 0.00724854775171929; _M = 1.41538574492812; }; if (_velocity > 1228) exitWith { _A = 0.0000350563361516117; _M = 2.13077307854948; };
case (_velocity > 1228) : { _A = 0.0000350563361516117; _M = 2.13077307854948; }; if (_velocity > 1116) exitWith { _A = 0.000000000000184029481181151; _M = 4.81927320350395; };
case (_velocity > 1116) : { _A = 0.000000000000184029481181151; _M = 4.81927320350395; }; if (_velocity > 1004) exitWith { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422; };
case (_velocity > 1004) : { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422 ; }; if (_velocity > 837) exitWith { _A = 0.000000103965974081168; _M = 2.84204791809926; };
case (_velocity > 837) : { _A = 0.000000103965974081168; _M = 2.84204791809926; }; if (_velocity > 335) exitWith { _A = 0.0001093015938698234; _M = 1.81096361579504; };
case (_velocity > 335) : { _A = 0.0001093015938698234; _M = 1.81096361579504; }; if (_velocity > 0) exitWith { _A = 0.0000351963178524273; _M = 2.00477856801111; };
case (_velocity > 0) : { _A = 0.0000351963178524273; _M = 2.00477856801111; };
}; };
}; };
case 6: case 6: {
{ call {
switch true do { if (_velocity > 3236) exitWith { _A = 0.0455384883480781; _M = 1.15997674041274; };
case (_velocity > 3236) : { _A = 0.0455384883480781; _M = 1.15997674041274; }; if (_velocity > 2065) exitWith { _A = 0.07167261849653769; _M = 1.10704436538885; };
case (_velocity > 2065) : { _A = 0.07167261849653769; _M = 1.10704436538885; }; if (_velocity > 1311) exitWith { _A = 0.00166676386084348; _M = 1.60085100195952; };
case (_velocity > 1311) : { _A = 0.00166676386084348; _M = 1.60085100195952; }; if (_velocity > 1144) exitWith { _A = 0.000000101482730119215; _M = 2.9569674731838; };
case (_velocity > 1144) : { _A = 0.000000101482730119215; _M = 2.9569674731838 ; }; if (_velocity > 1004) exitWith { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; };
case (_velocity > 1004) : { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; }; if (_velocity > 670) exitWith { _A = 0.0000204835650496866; _M = 2.11688446325998; };
case (_velocity > 670) : { _A = 0.0000204835650496866; _M = 2.11688446325998; }; if (_velocity > 0) exitWith { _A = 0.0000750912466084823; _M = 1.92031057847052; };
case (_velocity > 0) : { _A = 0.0000750912466084823; _M = 1.92031057847052; };
}; };
}; };
case 7: case 7: {
{ call {
switch true do { if (_velocity > 4200) exitWith { _A = 0.00000000129081656775919; _M = 3.24121295355962; };
case (_velocity > 4200) : { _A = 0.00000000129081656775919; _M = 3.24121295355962; }; if (_velocity > 3000) exitWith { _A = 0.0171422231434847; _M = 1.27907168025204; };
case (_velocity > 3000) : { _A = 0.0171422231434847; _M = 1.27907168025204; }; if (_velocity > 1470) exitWith { _A = 0.00233355948302505; _M = 1.52693913274526; };
case (_velocity > 1470) : { _A = 0.00233355948302505; _M = 1.52693913274526; }; if (_velocity > 1260) exitWith { _A = 0.000797592111627665; _M = 1.67688974440324; };
case (_velocity > 1260) : { _A = 0.000797592111627665; _M = 1.67688974440324; }; if (_velocity > 1110) exitWith { _A = 0.00000000000571086414289273; _M = 4.3212826264889; };
case (_velocity > 1110) : { _A = 0.00000000000571086414289273; _M = 4.3212826264889 ; }; if (_velocity > 960) exitWith { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; };
case (_velocity > 960) : { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; }; if (_velocity > 670) exitWith { _A = 0.00000752285155782535; _M = 2.1738019851075; };
case (_velocity > 670) : { _A = 0.00000752285155782535; _M = 2.1738019851075 ; }; if (_velocity > 540) exitWith { _A = 0.0000131766281225189; _M = 2.08774690257991; };
case (_velocity > 540) : { _A = 0.0000131766281225189; _M = 2.08774690257991; }; if (_velocity > 0) exitWith { _A = 0.0000134504843776525; _M = 2.08702306738884; };
case (_velocity > 0) : { _A = 0.0000134504843776525; _M = 2.08702306738884; };
}; };
}; };
case 8: case 8: {
{ call {
switch true do { if (_velocity > 3571) exitWith { _A = 0.0112263766252305; _M = 1.33207346655961; };
case (_velocity > 3571) : { _A = 0.0112263766252305; _M = 1.33207346655961; }; if (_velocity > 1841) exitWith { _A = 0.0167252613732636; _M = 1.28662041261785; };
case (_velocity > 1841) : { _A = 0.0167252613732636; _M = 1.28662041261785; }; if (_velocity > 1120) exitWith { _A = 0.00220172456619625; _M = 1.55636358091189; };
case (_velocity > 1120) : { _A = 0.00220172456619625; _M = 1.55636358091189; }; if (_velocity > 1088) exitWith { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; };
case (_velocity > 1088) : { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; }; if (_velocity > 976) exitWith { _A = 0.00000000000592182174254121; _M = 4.29275576134191; };
case (_velocity > 976) : { _A = 0.00000000000592182174254121; _M = 4.29275576134191; }; if (_velocity > 0) exitWith { _A = 0.000043917343795117; _M = 1.99978116283334; };
case (_velocity > 0) : { _A = 0.000043917343795117; _M = 1.99978116283334; };
}; };
}; };
}; };
if (_A != -1 && _M != -1 && _velocity > 0 && _velocity < 10000) then { if (!isNil "_A" && !isNil "_M" && _velocity > 0 && _velocity < 10000) then {
_result = _A * (_velocity ^ _M) / _dragCoefficient; (_A * (_velocity ^ _M) / _dragCoefficient) / 3.2808399
_result = _result / 3.2808399; } else {
0
}; };
_result

View File

@ -13,33 +13,23 @@
* 6: barometric Pressure - hPA <NUMBER> * 6: barometric Pressure - hPA <NUMBER>
* *
* Return Value: * Return Value:
* 0: stability factor <NUMBER> * stability factor <NUMBER>
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure", "_l", "_t", "_stabilityFactor"]; private ["_twist", "_length", "_stabilityFactor"];
_caliber = _this select 0; params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"];
_bulletLength = _this select 1;
_bulletMass = _this select 2;
_barrelTwist = _this select 3;
_muzzleVelocity = _this select 4;
_temperature = _this select 5;
_barometricPressure = _this select 6;
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf // Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
_t = _barrelTwist / _caliber; _twist = _barrelTwist / _caliber;
_l = _bulletLength / _caliber; _length = _bulletLength / _caliber;
_stabilityFactor = 7587000 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2)); _stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
if (_muzzleVelocity > 341.376) then { if (_muzzleVelocity > 341.376) then {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3); (_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
} else { } else {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3); (_stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
}; };
_stabilityFactor = _stabilityFactor * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure;
_stabilityFactor

View File

@ -8,6 +8,8 @@
* *
* Return value: * Return value:
* None * None
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
@ -15,8 +17,6 @@
#define __ctrl1 (__dsp displayCtrl 132950) #define __ctrl1 (__dsp displayCtrl 132950)
#define __ctrl2 (__dsp displayCtrl 132951) #define __ctrl2 (__dsp displayCtrl 132951)
private ["_inclinationAngle", "_refPosition"];
if (GVAR(Protractor)) exitWith { if (GVAR(Protractor)) exitWith {
GVAR(Protractor) = false; GVAR(Protractor) = false;
1 cutText ["", "PLAIN"]; 1 cutText ["", "PLAIN"];
@ -32,30 +32,26 @@ EGVAR(weather,WindInfo) = false;
GVAR(Protractor) = true; GVAR(Protractor) = true;
[{ [{
params ["","_idPFH"];
if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith { if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith {
GVAR(Protractor) = false; GVAR(Protractor) = false;
1 cutText ["", "PLAIN"]; 1 cutText ["", "PLAIN"];
[_this select 1] call cba_fnc_removePerFrameHandler; [_idPFH] call cba_fnc_removePerFrameHandler;
}; };
_refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3];
_inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2);
_inclinationAngle = -58 max _inclinationAngle min 58;
1 cutRsc ["RscProtractor", "PLAIN", 1, false]; 1 cutRsc ["RscProtractor", "PLAIN", 1, false];
__ctrl1 ctrlSetScale 1; __ctrl1 ctrlSetScale 1;
__ctrl1 ctrlCommit 0; __ctrl1 ctrlCommit 0;
__ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa)); __ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa));
__ctrl1 ctrlSetTextColor [1, 1, 1, 1]; __ctrl1 ctrlSetTextColor [1, 1, 1, 1];
__ctrl2 ctrlSetScale 1; __ctrl2 ctrlSetScale 1;
__ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)]; __ctrl2 ctrlSetPosition [SafeZoneX + 0.001, SafeZoneY + 0.001 - 0.0012 * (-58 max (asin((ACE_player weaponDirection currentWeapon ACE_player) select 2)) min 58), 0.2, 0.2 * 4/3];
__ctrl2 ctrlCommit 0; __ctrl2 ctrlCommit 0;
__ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa)); __ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa));
__ctrl2 ctrlSetTextColor [1, 1, 1, 1]; __ctrl2 ctrlSetTextColor [1, 1, 1, 1];
}, 0.1, []] call CBA_fnc_addPerFrameHandler; }, 0.1, []] call CBA_fnc_addPerFrameHandler;
true true

View File

@ -0,0 +1,47 @@
/*
* Author: Glowbal, Ruthberg, joko // Jonas
* Handle the PFH for Bullets
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private "_deleted";
_deleted = 0;
{
private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"];
_x params["_bullet","_caliber","_bulletTraceVisible","_index"];
_bulletVelocity = velocity _bullet;
_bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) exitWith {
GVAR(allBullets) deleteAt (_forEachIndex - _deleted);
_deleted = _deleted + 1;
};
_bulletPosition = getPosASL _bullet;
if (_bulletTraceVisible && _bulletSpeed > 500) then {
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];
};
_aceTimeSecond = floor ACE_time;
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]);
} forEach GVAR(allBullets);
if (GVAR(allBullets) isEqualTo []) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
GVAR(BulletPFH) = nil;
};

View File

@ -13,28 +13,28 @@
* 6: projectile - Object of the projectile that was shot <OBJECT> * 6: projectile - Object of the projectile that was shot <OBJECT>
* *
* Return Value: * Return Value:
* Nothing * None
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; // Early Quiting
_unit = _this select 0; if (!hasInterface) exitWith {};
_weapon = _this select 1; if (!GVAR(enabled)) exitWith {};
_mode = _this select 3;
_ammo = _this select 4; // Parameterization
_magazine = _this select 5; private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"];
_bullet = _this select 6; params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"];
_abort = false; _abort = false;
if (!hasInterface) exitWith {};
if (!alive _bullet) exitWith {};
if (!GVAR(enabled)) exitWith {};
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
if (underwater _unit) exitWith {};
if (!(_ammo isKindOf "BulletBase")) exitWith {}; if (!(_ammo isKindOf "BulletBase")) exitWith {};
if (!alive _bullet) exitWith {};
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {};
if (underwater _unit) exitWith {};
if (!GVAR(simulateForEveryone) && !(local _unit)) then { if (!GVAR(simulateForEveryone) && !(local _unit)) then {
// The shooter is non local // The shooter is non local
_abort = true; _abort = true;
@ -53,39 +53,44 @@ if (!GVAR(simulateForEveryone) && !(local _unit)) then {
if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; }; if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; };
if (_abort || !(GVAR(extensionAvailable))) exitWith { if (_abort || !(GVAR(extensionAvailable))) exitWith {
if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then { [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH);
EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")];
};
}; };
// Get Weapon and Ammo Configurations
_AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo]; _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo];
if (isNil {_AmmoCacheEntry}) then { if (isNil "_AmmoCacheEntry") then {
_AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig); _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig);
}; };
_WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon]; _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon];
if (isNil {_WeaponCacheEntry}) then { if (isNil "_WeaponCacheEntry") then {
_WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig); _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig);
}; };
_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable"];
_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
_bulletVelocity = velocity _bullet; _bulletVelocity = velocity _bullet;
_muzzleVelocity = vectorMagnitude _bulletVelocity; _muzzleVelocity = vectorMagnitude _bulletVelocity;
if (GVAR(barrelLengthInfluenceEnabled)) then { if (GVAR(barrelLengthInfluenceEnabled)) then {
_muzzleVelocityShift = [_WeaponCacheEntry select 2, _AmmoCacheEntry select 10, _AmmoCacheEntry select 11, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); _barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil];
if (_muzzleVelocityShift != 0) then { if (isNil "_barrelVelocityShift") then {
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
_bullet setVelocity _bulletVelocity; uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift];
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
}; };
}; };
if (GVAR(ammoTemperatureEnabled)) then { if (GVAR(ammoTemperatureEnabled)) then {
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
_muzzleVelocityShift = [_AmmoCacheEntry select 9, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); _temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
};
if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
if (_muzzleVelocityShift != 0) then { if (_muzzleVelocityShift != 0) then {
_muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift);
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
_bullet setVelocity _bulletVelocity; _bullet setVelocity _bulletVelocity;
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
}; };
}; };
@ -102,43 +107,22 @@ if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then {
}; };
}; };
_caliber = _AmmoCacheEntry select 1;
_bulletLength = _AmmoCacheEntry select 2;
_bulletMass = _AmmoCacheEntry select 3;
_barrelTwist = _WeaponCacheEntry select 0;
_stabilityFactor = 1.5; _stabilityFactor = 1.5;
if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); if (isNil "_temperature") then {
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
};
_barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure); _barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure);
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor);
}; };
GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000;
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _AmmoCacheEntry select 0, _AmmoCacheEntry select 6, _AmmoCacheEntry select 7, _AmmoCacheEntry select 8, _AmmoCacheEntry select 5, _stabilityFactor, _WeaponCacheEntry select 1, _muzzleVelocity, _AmmoCacheEntry select 4, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, floor(ACE_time), ACE_time - floor(ACE_time)]; _aceTimeSecond = floor ACE_time;
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond];
[{ GVAR(allBullets) pushBack [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)];
private ["_args", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"];
_args = _this select 0;
_bullet = _args select 0;
_caliber = _args select 1;
_bulletTraceVisible = _args select 2;
_index = _args select 3;
_bulletVelocity = velocity _bullet;
_bulletPosition = getPosASL _bullet;
_bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) exitWith {
[_this select 1] call cba_fnc_removePerFrameHandler;
};
if (_bulletTraceVisible && _bulletSpeed > 500) then {
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];
};
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, floor(ACE_time), ACE_time - floor(ACE_time)]); if (isNil QGVAR(BulletPFH)) then {
GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler;
}, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler; };

View File

@ -8,17 +8,13 @@
* 2: activated <BOOL> * 2: activated <BOOL>
* *
* Return Value: * Return Value:
* None <NIL> * None
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_logic", "_units", "_activated"]; params ["_logic","_units", "_activated"];
_logic = _this select 0;
_units = _this select 1;
_activated = _this select 2;
if !(_activated) exitWith {}; if !(_activated) exitWith {};

View File

@ -3,10 +3,10 @@
* Initializes the advanced ballistics dll extension with terrain data * Initializes the advanced ballistics dll extension with terrain data
* *
* Arguments: * Arguments:
* Nothing * None
* *
* Return Value: * Return Value:
* Nothing * None
* *
* Public: No * Public: No
*/ */
@ -22,9 +22,9 @@ _initStartTime = ACE_time;
_mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith { if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith {
if (GVAR(initMessageEnabled)) then { #ifdef DEBUG_MODE_FULL
systemChat "AdvancedBallistics: Terrain already initialized"; systemChat "AdvancedBallistics: Terrain already initialized";
}; #endIf
}; };
_mapGrids = ceil(_mapSize / 50) + 1; _mapGrids = ceil(_mapSize / 50) + 1;
@ -33,19 +33,16 @@ _gridCells = _mapGrids * _mapGrids;
GVAR(currentGrid) = 0; GVAR(currentGrid) = 0;
[{ [{
private ["_args", "_mapGrids", "_gridCells", "_initStartTime"]; params ["_args","_idPFH"];
_args = _this select 0; _args params ["_mapGrids", "_gridCells", "_initStartTime"];
_mapGrids = _args select 0;
_gridCells = _args select 1;
_initStartTime = _args select 2;
if (GVAR(currentGrid) >= _gridCells) exitWith { if (GVAR(currentGrid) >= _gridCells) exitWith {
if (GVAR(initMessageEnabled)) then { #ifdef DEBUG_MODE_FULL
systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)]; systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)];
}; #endif
[_this select 1] call cba_fnc_removePerFrameHandler; [_idPFH] call cba_fnc_removePerFrameHandler;
}; };
for "_i" from 1 to 50 do { for "_i" from 1 to 50 do {
_x = floor(GVAR(currentGrid) / _mapGrids) * 50; _x = floor(GVAR(currentGrid) / _mapGrids) * 50;
_y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50; _y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50;
@ -57,5 +54,5 @@ GVAR(currentGrid) = 0;
GVAR(currentGrid) = GVAR(currentGrid) + 1; GVAR(currentGrid) = GVAR(currentGrid) + 1;
if (GVAR(currentGrid) >= _gridCells) exitWith {}; if (GVAR(currentGrid) >= _gridCells) exitWith {};
}; };
}, 0, [_mapGrids, _gridCells, _initStartTime]] call CBA_fnc_addPerFrameHandler }, 0, [_mapGrids, _gridCells, _initStartTime]] call CBA_fnc_addPerFrameHandler

View File

@ -4,61 +4,53 @@
* Reads the ammo class config and updates the config cache * Reads the ammo class config and updates the config cache
* *
* Arguments: * Arguments:
* 0: ammo - classname <string> * ammo - classname <STRING>
* *
* Return Value: * Return Value:
* 0: [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable] <ARRAY> * 0: _airFriction
* 1: _caliber
* 2: _bulletLength
* 3: _bulletMass
* 4: _transonicStabilityCoef
* 5: _dragModel
* 6: _ballisticCoefficients
* 7: _velocityBoundaries
* 8: _atmosphereModel
* 9: _ammoTempMuzzleVelocityShifts
* 10: _muzzleVelocityTable
* 11: _barrelLengthTable
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_ammo", "_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_result"]; private ["_ammo", "_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_result"];
_ammo = _this; _ammoConfig = configFile >> "CfgAmmo" >> _this;
_airFriction = getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction"); _airFriction = getNumber(_ammoConfig >> "airFriction");
_caliber = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber"); _caliber = getNumber(_ammoConfig >> "ACE_caliber");
_bulletLength = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletLength"); _bulletLength = getNumber(_ammoConfig >> "ACE_bulletLength");
_bulletMass = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletMass"); _bulletMass = getNumber(_ammoConfig >> "ACE_bulletMass");
_transonicStabilityCoef = 0.5; _transonicStabilityCoef = getNumber(_ammoConfig >> "ACE_transonicStabilityCoef");
if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef")) then { if (_transonicStabilityCoef == 0) then {
_transonicStabilityCoef = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef"); _transonicStabilityCoef = 0.5;
}; };
_dragModel = 1; _dragModel = getNumber(_ammoConfig >> "ACE_dragModel");
_ballisticCoefficients = []; if (_dragModel == 0 || !(_dragModel in [1, 2, 5, 6, 7, 8])) then {
_velocityBoundaries = []; _dragModel = 1;
_atmosphereModel = "ICAO";
if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel")) then {
_dragModel = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel");
if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then {
_dragModel = 1;
};
}; };
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then { _ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients");
_ballisticCoefficients = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients"); _velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries");
}; _atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere");
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then { if (_atmosphereModel isEqualTo "") then {
_velocityBoundaries = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries"); _atmosphereModel = "ICAO";
};
if (isText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then {
_atmosphereModel = getText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere");
};
_ammoTempMuzzleVelocityShifts = [];
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts")) then {
_ammoTempMuzzleVelocityShifts = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts");
};
_muzzleVelocityTable = [];
_barrelLengthTable = [];
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities")) then {
_muzzleVelocityTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities");
};
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths")) then {
_barrelLengthTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths");
}; };
_ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVelocityShifts");
_muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities");
_barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths");
_result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable]; _result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable];
uiNamespace setVariable [format[QGVAR(%1), _ammo], _result]; uiNamespace setVariable [format[QGVAR(%1), _this], _result];
_result _result

View File

@ -4,28 +4,28 @@
* Reads the weapon class config and updates the config cache * Reads the weapon class config and updates the config cache
* *
* Arguments: * Arguments:
* 0: weapon - classname <string> * weapon - classname <STRING>
* *
* Return Value: * Return Value:
* 0: [_barrelTwist, _twistDirection, _barrelLength] <ARRAY> * 0: _barrelTwist
* 1: _twistDirection
* 2: _barrelLength
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_weapon", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"]; private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"];
_weapon = _this; _weaponConfig = (configFile >> "CfgWeapons" >> _this);
_barrelTwist = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelTwist"); _barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
_twistDirection = 1; _twistDirection = 1;
if (isNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection")) then { _twistDirection = getNumber(_weaponConfig >> "ACE_twistDirection");
_twistDirection = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection"); if !(_twistDirection in [-1, 0, 1]) then {
if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then { _twistDirection = 1;
_twistDirection = 1;
};
}; };
_barrelLength = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelLength");
_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
_result = [_barrelTwist, _twistDirection, _barrelLength]; _result = [_barrelTwist, _twistDirection, _barrelLength];

View File

@ -1,9 +1,10 @@
ace_aircraft ace_aircraft
============ ============
Changes to air weaponry, flightmodels and HUDs. Changes to air weaponry, flight models and HUDs.
- Contributions by Kimi (geraldbolso1899) for HUD updates
* Contributations by Kimi (geraldbolso1899) for HUD updates
## Maintainers ## Maintainers
@ -11,4 +12,4 @@ The people responsible for merging changes to this component or answering potent
- [KoffeinFlummi](https://github.com/KoffeinFlummi) - [KoffeinFlummi](https://github.com/KoffeinFlummi)
- [commy2](https://github.com/commy2) - [commy2](https://github.com/commy2)
- [jaynus](https://github.com/walterpearce) - [jaynus](https://github.com/walterpearce)

11
addons/apl/README.md Normal file
View File

@ -0,0 +1,11 @@
ace_apl
============
Assets licensed under Arma Public License (APL).
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- None

View File

@ -3,8 +3,9 @@ ace_atragmx
ATragMX - Handheld ballistics calculator ATragMX - Handheld ballistics calculator
## Maintainers ## Maintainers
The people responsible for merging changes to this component or answering potential questions. The people responsible for merging changes to this component or answering potential questions.
- [Ruthberg] (http://github.com/Ulteq) - [Ruthberg](http://github.com/Ulteq)

View File

@ -2,7 +2,9 @@ ace_attach
========== ==========
Introducing the ability to attach various throwables to yourself or vehicles, to mark your position and assist in IFF. Introducing the ability to attach various throwables to yourself or vehicles, to mark your position and assist in IFF.
Adds item `ACE_IR_Strobe_Item`.
#### Items Added:
`ACE_IR_Strobe_Item`
## Maintainers ## Maintainers

View File

@ -5,7 +5,7 @@
<English>Attach item &gt;&gt;</English> <English>Attach item &gt;&gt;</English>
<German>Gegenstand befestigen &gt;&gt;</German> <German>Gegenstand befestigen &gt;&gt;</German>
<Spanish>Acoplar objeto &gt;&gt;</Spanish> <Spanish>Acoplar objeto &gt;&gt;</Spanish>
<Polish>Przyczep przedmiot &gt;&gt;</Polish> <Polish>Przyczep &gt;&gt;</Polish>
<French>Attacher l'objet &gt;&gt;</French> <French>Attacher l'objet &gt;&gt;</French>
<Czech>Připnout předmět &gt;&gt;</Czech> <Czech>Připnout předmět &gt;&gt;</Czech>
<Portuguese>Fixar item &gt;&gt;</Portuguese> <Portuguese>Fixar item &gt;&gt;</Portuguese>
@ -185,7 +185,7 @@
<English>%1&lt;br/&gt;Attached</English> <English>%1&lt;br/&gt;Attached</English>
<German>%1&lt;br/&gt;befestigt</German> <German>%1&lt;br/&gt;befestigt</German>
<Spanish>%1&lt;br/&gt;acoplada</Spanish> <Spanish>%1&lt;br/&gt;acoplada</Spanish>
<Polish>%1&lt;br/&gt;przyczepiono</Polish> <Polish>Przyczepiono&lt;br/&gt;%1</Polish>
<French>%1&lt;br/&gt;attachée</French> <French>%1&lt;br/&gt;attachée</French>
<Czech>%1&lt;br/&gt;Připnutý</Czech> <Czech>%1&lt;br/&gt;Připnutý</Czech>
<Portuguese>%1&lt;br/&gt;Fixada</Portuguese> <Portuguese>%1&lt;br/&gt;Fixada</Portuguese>
@ -197,7 +197,7 @@
<English>%1&lt;br/&gt;Detached</English> <English>%1&lt;br/&gt;Detached</English>
<German>%1&lt;br/&gt;entfernt</German> <German>%1&lt;br/&gt;entfernt</German>
<Spanish>%1&lt;br/&gt;quitada</Spanish> <Spanish>%1&lt;br/&gt;quitada</Spanish>
<Polish>%1&lt;br/&gt;odczepiono</Polish> <Polish>Odczepiono&lt;br/&gt;%1</Polish>
<French>%1&lt;br/&gt;détachée</French> <French>%1&lt;br/&gt;détachée</French>
<Czech>%1&lt;br/&gt;Odepnutý</Czech> <Czech>%1&lt;br/&gt;Odepnutý</Czech>
<Portuguese>%1&lt;br/&gt;Separada</Portuguese> <Portuguese>%1&lt;br/&gt;Separada</Portuguese>
@ -206,4 +206,4 @@
<Russian>%1&lt;br/&gt;отсоединен(-а)</Russian> <Russian>%1&lt;br/&gt;отсоединен(-а)</Russian>
</Key> </Key>
</Package> </Package>
</Project> </Project>

View File

@ -1,7 +1,8 @@
ace_backpacks ace_backpacks
================= =================
Adds indication when someone else opens your backpack (soundeffect / camShake). Adds indication when someone else opens your backpack (sound effect and camera shake).
## Maintainers ## Maintainers

View File

@ -1,3 +1,3 @@
#include "script_component.hpp" #include "script_component.hpp"
["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler); ["backpackOpened", DFUNC(backpackOpened)] call EFUNC(common,addEventHandler);

View File

@ -2,18 +2,18 @@
* Author: commy2 * Author: commy2
* *
* Someone opened your backpack. Execute locally. * Someone opened your backpack. Execute locally.
* *
* Argument: * Argument:
* 0: Who accessed your inventory? (Object) * 0: Who accessed your inventory? (Object)
* 1: Unit that wields the backpack (Object) * 1: Unit that wields the backpack (Object)
* 2: The backpack object (Object) * 2: The backpack object (Object)
* *
* Return value: * Return value:
* None. * None.
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_sounds", "_position"];
PARAMS_3(_unit,_target,_backpack); params ["_target", "_backpack"];
// do cam shake if the target is the player // do cam shake if the target is the player
if ([_target] call EFUNC(common,isPlayer)) then { if ([_target] call EFUNC(common,isPlayer)) then {
@ -21,7 +21,6 @@ if ([_target] call EFUNC(common,isPlayer)) then {
}; };
// play a rustling sound // play a rustling sound
private ["_sounds", "_position"];
_sounds = [ _sounds = [
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss", /*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",

View File

@ -2,21 +2,21 @@
* Author: commy2 * Author: commy2
* *
* Returns the unit that has the given backpack object equipped. * Returns the unit that has the given backpack object equipped.
* *
* Argument: * Argument:
* 0: A backpack object (Object) * 0: Executing Unit (Object)
* * 1: A backpack object (Object)
*
* Return value: * Return value:
* Unit that has the backpack equipped. (Object) * Unit that has the backpack equipped. (Object)
*/ */
#include "script_component.hpp" #include "script_component.hpp"
scopeName "main";
private ["_backpack", "_unit"]; params ["_unit","_backpack"];
_target = objNull;
_backpack = _this select 0;
_unit = objNull;
{ {
if (backpackContainer _x == _backpack) exitWith {_unit = _x}; if (backpackContainer _x == _backpack) then {_target = _x; breakTo "main"};
} forEach (allUnits + allDeadMen); } count nearestObjects [_unit, ["Man"], 5];
_unit if (isNull _target) exitWith {ACE_Player};
_target

View File

@ -11,9 +11,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_backpack", "_config"]; private ["_config"];
params ["_backpack"];
_backpack = _this select 0;
if (typeName _backpack == "OBJECT") then { if (typeName _backpack == "OBJECT") then {
_backpack = typeOf _backpack; _backpack = typeOf _backpack;

View File

@ -2,29 +2,27 @@
* Author: commy2 * Author: commy2
* *
* Handle the open inventory event. Display message on traget client. * Handle the open inventory event. Display message on traget client.
* *
* Argument: * Argument:
* Input from "InventoryOpened" eventhandler * Input from "InventoryOpened" eventhandler
* *
* Return value: * Return value:
* false. Always open the inventory dialog. (Bool) * false. Always open the inventory dialog. (Bool)
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_backpack"]; private "_target";
params ["","_backpack"];
_unit = _this select 0;
_backpack = _this select 1;
// exit if the target is not a backpack // exit if the target is not a backpack
if !([_backpack] call FUNC(isBackpack)) exitWith {}; if !([_backpack] call FUNC(isBackpack)) exitWith {};
// get the unit that wears the backpack object // get the unit that wears the backpack object
private "_target"; _target = _this call FUNC(getBackpackAssignedUnit);
_target = [_backpack] call FUNC(getBackpackAssignedUnit);
if (isNull _target) exitWith {false};
// raise event on target unit // raise event on target unit
["backpackOpened", _target, [_unit, _target, _backpack]] call EFUNC(common,targetEvent); ["backpackOpened", _target, [_target, _backpack]] call EFUNC(common,targetEvent);
// return false to open inventory as usual // return false to open inventory as usual
false false

View File

@ -3,10 +3,11 @@ ace_ballistics
Changes to weapon, magazine and ammunition values. Changes to weapon, magazine and ammunition values.
## Maintainers ## Maintainers
The people responsible for merging changes to this component or answering potential questions. The people responsible for merging changes to this component or answering potential questions.
- [Ruthberg] (http://github.com/Ulteq) - [Ruthberg](http://github.com/Ulteq)
- [KoffeinFlummi](https://github.com/KoffeinFlummi) - [KoffeinFlummi](https://github.com/KoffeinFlummi)
- [commy2](https://github.com/commy2) - [commy2](https://github.com/commy2)

View File

@ -190,8 +190,8 @@ class CfgVehicles {
defaultValue = 1; defaultValue = 1;
}; };
class requireSurrender { class requireSurrender {
displayName = CSTRING(ModuleSettings_allowSurrender_name); displayName = CSTRING(ModuleSettings_requireSurrender_name);
description = CSTRING(ModuleSettings_allowSurrender_description); description = CSTRING(ModuleSettings_requireSurrender_description);
typeName = "NUMBER"; typeName = "NUMBER";
class values { class values {
class disable { class disable {

View File

@ -1,10 +1,10 @@
ace_captives ace_captives
============ ============
Allows taking people captive/handcuffed Adds ability to handcuff and surrender.
####Items: #### Items Added:
`ACE_CableTie` - adds ability to take someone captive `ACE_CableTie`
## Maintainers ## Maintainers

View File

@ -27,7 +27,7 @@ if (isNull _target) then {
}; };
if (isNull _vehicle) then { if (isNull _vehicle) then {
_objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10]; _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10];
if ((count _objects) > 0) then {_vehicle = _objects select 0;}; if ((count _objects) > 0) then {_vehicle = _objects select 0;};
}; };

View File

@ -29,7 +29,7 @@ if (isNull _target) then {
if (isNull _target) exitWith {}; if (isNull _target) exitWith {};
if (isNull _vehicle) then { if (isNull _vehicle) then {
_objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10];
if ((count _objects) > 0) then {_vehicle = _objects select 0;}; if ((count _objects) > 0) then {_vehicle = _objects select 0;};
}; };
if (isNull _vehicle) exitWith {}; if (isNull _vehicle) exitWith {};

View File

@ -223,15 +223,19 @@
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_name"> <Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_name">
<English>Require surrendering</English> <English>Require surrendering</English>
<Polish>Wymagaj kapitulacji</Polish>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_description"> <Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_description">
<English>Require Players to surrender before they can be arrested</English> <English>Require Players to surrender before they can be arrested</English>
<Polish>Wymagaj od graczy kapitulacji zanim będzie można ich zaaresztować</Polish>
</Key> </Key>
<Key ID="STR_ACE_Captives_SurrenderOnly"> <Key ID="STR_ACE_Captives_SurrenderOnly">
<English>Surrendering only</English> <English>Surrendering only</English>
<Polish>Tylko kapitulacja</Polish>
</Key> </Key>
<Key ID="STR_ACE_Captives_SurrenderOrNoWeapon"> <Key ID="STR_ACE_Captives_SurrenderOrNoWeapon">
<English>Surrendering or No weapon</English> <English>Surrendering or No weapon</English>
<Polish>Kapitulacja lub brak broni</Polish>
</Key> </Key>
</Package> </Package>
</Project> </Project>

1
addons/cargo/$PBOPREFIX$ Normal file
View File

@ -0,0 +1 @@
z\ace\addons\cargo

View File

@ -0,0 +1,9 @@
class ACE_Settings {
class GVAR(enable) {
displayName = CSTRING(ModuleSettings_enable);
description = CSTRING(ModuleSettings_enable_Description);
typeName = "BOOL";
value = 1;
category = ECSTRING(OptionsMenu,CategoryLogistics);
};
};

View File

@ -0,0 +1,103 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_Killed_EventHandlers {
class All {
init = QUOTE(call FUNC(handleDestroyed));
};
};
class Extended_Init_EventHandlers {
class StaticWeapon {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class ReammoBox_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class Cargo_base_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
};
};
class CargoNet_01_box_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
};
};
class Land_CargoBox_V1_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
};
};
class Land_PaperBox_closed_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
};
};
class Car {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
class Tank {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
class Helicopter {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
class Plane {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
class Ship_F {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
class ACE_RepairItem_Base {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class ACE_bodyBagObject {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class ACE_ConcertinaWireCoil {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
};

View File

@ -0,0 +1,294 @@
class CfgVehicles {
class ACE_Module;
class ACE_moduleCargoSettings: ACE_Module {
scope = 2;
displayName = CSTRING(SettingsModule_DisplayName);
icon = QUOTE(PATHTOF(UI\Icon_Module_Cargo_ca.paa));
category = "ACE_Logistics";
function = QFUNC(moduleSettings);
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
author = ECSTRING(common,ACETeam);
class Arguments {
class enable {
displayName = CSTRING(ModuleSettings_enable);
description = CSTRING(ModuleSettings_enable_Description);
typeName = "BOOL";
defaultValue = 1;
};
};
class ModuleDescription {
description = CSTRING(SettingsModule_Description);
sync[] = {};
};
};
class LandVehicle;
class Car: LandVehicle {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
class ACE_Cargo {
/*
class Cargo {
class ACE_medicalSupplyCrate {
type = "ACE_medicalSupplyCrate";
amount = 1;
};
};*/
};
};
class Tank: LandVehicle {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
class Car_F;
class Truck_F: Car_F {
GVAR(space) = 8;
GVAR(hasCargo) = 1;
};
class Air;
class Helicopter: Air {
GVAR(space) = 8;
GVAR(hasCargo) = 1;
};
class Heli_Transport_02_base_F;
class I_Heli_Transport_02_F : Heli_Transport_02_base_F {
GVAR(space) = 20;
GVAR(hasCargo) = 1;
};
class Plane: Air {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
class Ship;
class Ship_F: Ship {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
// Static weapons
class StaticWeapon: LandVehicle {
GVAR(size) = 2; // 1 = small, 2 = large
GVAR(canLoad) = 1;
};
class StaticMortar;
class Mortar_01_base_F: StaticMortar {
GVAR(size) = 2; // 1 = small, 2 = large
GVAR(canLoad) = 1;
};
// Ammo boxes
class ThingX;
class ReammoBox_F: ThingX {
GVAR(size) = 2; // 1 = small, 2 = large
GVAR(canLoad) = 1;
};
class Scrapyard_base_F;
class Land_PaperBox_closed_F: Scrapyard_base_F {
GVAR(space) = 10;
GVAR(hasCargo) = 1;
GVAR(size) = 11;
GVAR(canLoad) = 1;
XEH_ENABLED;
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
distance = 5;
condition = QUOTE(true);
statement = "";
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
selection = "";
};
};
};
class Cargo_base_F: ThingX {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
GVAR(size) = 4;
GVAR(canLoad) = 1;
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
distance = 5;
condition = QUOTE(true);
statement = "";
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
selection = "";
};
};
};
class Cargo10_base_F: Cargo_base_F {
GVAR(space) = 14;
GVAR(size) = 15;
XEH_ENABLED;
};
class Land_Cargo20_blue_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_brick_red_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_cyan_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_grey_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_light_blue_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_light_green_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_military_green_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Ruins_F;
class Land_Cargo20_military_ruins_F: Ruins_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_orange_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_red_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_sand_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_vr_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_white_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_yellow_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo40_blue_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_brick_red_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_cyan_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_grey_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_light_blue_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_light_green_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_military_green_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_military_ruins_F: Ruins_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_orange_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_red_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_sand_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_vr_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_white_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_yellow_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
// small
class Land_CargoBox_V1_F: ThingX {
GVAR(space) = 7;
GVAR(hasCargo) = 1;
GVAR(size) = 7;
XEH_ENABLED;
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
distance = 5;
condition = QUOTE(true);
statement = "";
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
selection = "";
};
};
};
};

12
addons/cargo/README.md Normal file
View File

@ -0,0 +1,12 @@
ace_cargo
============
Adds cargo menu to vehicles and allows loading and unloading of cargo items.
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [commy2](https://github.com/commy2)
- [Glowbal](https://github.com/Glowbal)

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,5 @@
#include "script_component.hpp"
["LoadCargo", {_this call FUNC(loadItem)}] call EFUNC(common,addEventHandler);
["UnloadCargo", {_this call FUNC(unloadItem)}] call EFUNC(common,addEventHandler);
["AddCargoByClass", {_this call FUNC(addCargoItem)}] call EFUNC(common,addEventHandler);

View File

@ -0,0 +1,25 @@
#include "script_component.hpp"
ADDON = false;
PREP(addCargoItem);
PREP(canLoad);
PREP(canLoadItemIn);
PREP(canUnloadItem);
PREP(findNearestVehicle);
PREP(getCargoSpaceLeft);
PREP(getSizeItem);
PREP(handleDestroyed);
PREP(initObject);
PREP(initVehicle);
PREP(loadItem);
PREP(moduleSettings);
PREP(onMenuOpen);
PREP(startLoadIn);
PREP(startUnload);
PREP(unloadItem);
PREP(validateCargoSpace);
GVAR(initializedItemClasses) = [];
ADDON = true;

18
addons/cargo/config.cpp Normal file
View File

@ -0,0 +1,18 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};
author[] = {"commy2", "Glowbal"};
authorUrl = "https://ace3mod.com/";
VERSION_CONFIG;
};
};
#include "ACE_Settings.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "menu.hpp"

View File

@ -0,0 +1,38 @@
/*
* Author: Glowbal, Jonpas
* Adds a cargo item to the vehicle.
*
* Arguments:
* 0: Item Classname <STRING>
* 1: Vehicle <OBJECT>
* 2: Amount <NUMBER> (default: 1)
*
* Return Value:
* None
*
* Example:
* ["item", vehicle] call ace_cargo_fnc_addCargoItem
*
* Public: No
*/
#include "script_component.hpp"
private ["_position", "_item", "_i"];
params ["_itemClass", "_vehicle", ["_amount", 1]];
TRACE_3("params",_itemClass,_vehicle,_amount);
_position = getPos _vehicle;
_position set [1, (_position select 1) + 1];
_position set [2, (_position select 2) + 7.5];
for "_i" from 1 to _amount do {
_item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"];
// Load item or delete it if no space left
if !([_item, _vehicle] call FUNC(loadItem)) exitWith {
deleteVehicle _item;
};
// Invoke listenable event
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
};

View File

@ -0,0 +1,34 @@
/*
* Author: Glowbal
* Check if player can load an item into the nearest vehicle.
*
* Arguments:
* 0: Player <OBJECT>
* 1: Object to load <OBJECT>
*
* Return value:
* Can load <BOOL>
*
* Example:
* [player, object] call ace_cargo_fnc_canLoad
*
* Public: No
*/
#include "script_component.hpp"
params ["_player", "_object"];
if (!([_player, _object, []] call EFUNC(common,canInteractWith))) exitWith {false};
private ["_nearestVehicle"];
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then {
{
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_nearestVehicle = _x};
} forEach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
};
if (isNull _nearestVehicle) exitWith {false};
[_object, _nearestVehicle] call FUNC(canLoadItemIn)

View File

@ -0,0 +1,29 @@
/*
* Author: Glowbal
* Check if item can be loaded into other Object.
*
* Arguments:
* 0: Item Object <OBJECT>
* 1: Holder Object (Vehicle) <OBJECT>
*
* Return value:
* Can load in <BOOL>
*
* Example:
* [item, holder] call ace_cargo_fnc_canLoadItemIn
*
* Public: No
*/
#include "script_component.hpp"
params ["_item", "_vehicle"];
if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false};
private "_itemSize";
_itemSize = ([_item] call FUNC(getSizeItem));
(_itemSize > 0) &&
{alive _item && alive _vehicle} &&
{(_item distance _vehicle <= MAX_LOAD_DISTANCE)} &&
{_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))}

View File

@ -0,0 +1,44 @@
/*
* Author: Glowbal, ViperMaul
* Check if item can be unloaded.
*
* Arguments:
* 0: loaded Object <OBJECT>
* 1: Object <OBJECT>
*
* Return value:
* Can be unloaded <BOOL>
*
* Example:
* [item, holder] call ace_cargo_fnc_canUnloadItem
*
* Public: No
*/
#include "script_component.hpp"
private ["_loaded", "_validVehiclestate", "_emptyPos"];
params ["_item", "_vehicle"];
_loaded = _vehicle getVariable [QGVAR(loaded), []];
if !(_item in _loaded) exitWith {false};
_validVehiclestate = true;
_emptyPos = [];
if (_vehicle isKindOf "Ship" ) then {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot.
} else {
if (_vehicle isKindOf "Air" ) then {
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
_emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition);
_emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ];
} else {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]);
};
};
if (!_validVehiclestate) exitWith {false};
(count _emptyPos != 0)

View File

@ -0,0 +1,37 @@
/*
* Author: Glowbal
* Get nearest vehicle from unit, priority: Car-Air-Tank-Ship.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return value:
* Vehicle in Distance <OBJECT>
*
* Example:
* [unit] call ace_cargo_fnc_findNearestVehicle
*
* Public: No
*/
#include "script_component.hpp"
private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip", "_loadContainer"];
params ["_unit"];
_loadCar = nearestObject [_unit, "car"];
if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitWith {_loadCar};
_loadHelicopter = nearestObject [_unit, "air"];
if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitWith {_loadHelicopter};
_loadTank = nearestObject [_unit, "tank"];
if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitWith {_loadTank};
_loadShip = nearestObject [_unit, "ship"];
if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitWith {_loadShip};
_loadContainer = nearestObject [_unit,"Cargo_base_F"];
if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitWith {_loadContainer};
objNull

View File

@ -0,0 +1,20 @@
/*
* Author: Glowbal
* Get the cargo space left on object.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* Cargo space left <NUMBER>
*
* Example:
* [object] call ace_cargo_fnc_getCargoSpaceLeft
*
* Public: No
*/
#include "script_component.hpp"
params ["_object"];
_object getVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _object >> QGVAR(space))]

View File

@ -0,0 +1,28 @@
/*
* Author: Glowbal
* Get the cargo size of an object.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* Cargo size <NUMBER> (default: -1)
*
* Example:
* [object] call ace_cargo_fnc_getSizeItem
*
* Public: No
*/
#include "script_component.hpp"
private "_config";
params ["_item"];
_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
if (isNumber (_config)) exitWith {
_item getVariable [QGVAR(size), getNumber (_config)]
};
-1

View File

@ -0,0 +1,31 @@
/*
* Author: Glowbal
* Handle object being destroyed.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* None
*
* Example:
* [object] call ace_cargo_fnc_handleDestroyed
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle"];
private["_loaded"];
_loaded = _vehicle getVariable [QGVAR(loaded), []];
if (count _loaded == 0) exitWith {};
{
// TODO deleteVehicle or just delete vehicle? Do we want to be able to recover destroyed equipment?
deleteVehicle _x;
//_x setDamage 1;
} count _loaded;
[_vehicle] call FUNC(validateCargoSpace);

View File

@ -0,0 +1,30 @@
/*
* Author: Glowbal
* Initializes variables for loadable objects. Called from init EH.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* None
*
* Example:
* [object] call ace_cargo_fnc_initObject
*
* Public: No
*/
#include "script_component.hpp"
params ["_object"];
if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(canLoad)) != 1) exitWith {};
private ["_type", "_action"];
_type = typeOf _object;
// do nothing if the class is already initialized
if (_type in GVAR(initializedItemClasses)) exitWith {};
GVAR(initializedItemClasses) pushBack _type;
_action = [QGVAR(load), localize LSTRING(loadObject), QUOTE(PATHTOF(UI\Icon_load.paa)), {[_player, _target] call FUNC(startLoadIn)}, {GVAR(enable) && {[_player, _target] call FUNC(canLoad)}}] call EFUNC(interact_menu,createAction);
[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass);

View File

@ -0,0 +1,51 @@
/*
* Author: Glowbal
* Initializes vehicle, adds open cargo menu action if available.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [vehicle] call ace_cargo_fnc_initVehicle
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle"];
TRACE_1("params", _vehicle);
private ["_type", "_initializedClasses"];
_type = typeOf _vehicle;
_initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
if (isServer) then {
{
if (isClass _x) then {
["AddCargoByClass", [getText (_x >> "type"), _vehicle, getNumber (_x >> "amount")]] call EFUNC(common,localEvent);
};
} count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
};
// do nothing if the class is already initialized
if (_type in _initializedClasses) exitWith {};
// set class as initialized
_initializedClasses pushBack _type;
SETMVAR(GVAR(initializedClasses),_initializedClasses);
if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitWith {};
private ["_text", "_condition", "_statement", "_icon", "_action"];
_condition = {
params ["_target", "_player"];
GVAR(enable) && {[_player, _target, []] call EFUNC(common,canInteractWith)}
};
_text = localize LSTRING(openMenu);
_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);};
_icon = "";
_action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction);
[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass);

View File

@ -0,0 +1,40 @@
/*
* Author: Glowbal
* Load object into vehicle.
*
* Arguments:
* 0: Object <OBJECT>
* 1: Vehicle <OBJECT>
*
* Return value:
* Object loaded <BOOL>
*
* Example:
* [object, vehicle] call ace_cargo_fnc_loadItem
*
* Public: No
*/
#include "script_component.hpp"
private ["_loaded", "_space", "_itemSize"];
params ["_item", "_vehicle"];
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false};
_loaded = _vehicle getVariable [QGVAR(loaded), []];
_loaded pushback _item;
_vehicle setVariable [QGVAR(loaded), _loaded, true];
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
_itemSize = [_item] call FUNC(getSizeItem);
_vehicle setVariable [QGVAR(space), _space - _itemSize, true];
detach _item;
_item attachTo [_vehicle,[0,0,100]];
["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent);
// Invoke listenable event
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
true

View File

@ -0,0 +1,28 @@
/*
* Author: Glowbal
* Module for adjusting the cargo settings
*
* Arguments:
* 0: The module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* function = "ace_cargo_fnc_loadItem"
*
* Public: No
*/
#include "script_component.hpp"
if (!isServer) exitWith {};
params ["_logic", "_units", "_activated"];
if (!_activated) exitWith {};
[_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule);
diag_log text "[ACE]: Cargo Module Initialized.";

View File

@ -0,0 +1,48 @@
/*
* Author: Glowbal
* Handle the UI data display.
*
* Arguments:
* 0: Display <DISPLAY>
*
* Return value:
* None
*
* Example:
* [display] call ace_cargo_fnc_onMenuOpen
*
* Public: No
*/
#include "script_component.hpp"
disableSerialization;
params ["_display"];
uiNamespace setVariable [QGVAR(menuDisplay), _display];
[{
private ["_display","_loaded", "_ctrl", "_label"];
disableSerialization;
_display = uiNamespace getVariable QGVAR(menuDisplay);
if (isnil "_display") exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
if (isNull GVAR(interactionVehicle) || ACE_player distance GVAR(interactionVehicle) >= 10) exitWith {
closeDialog 0;
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
_ctrl = _display displayCtrl 100;
_label = _display displayCtrl 2;
lbClear _ctrl;
{
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> typeOf _x >> "displayName"));
true
} count _loaded;
_label ctrlSetText format[localize LSTRING(labelSpace), [GVAR(interactionVehicle)] call DFUNC(getCargoSpaceLeft)];
}, 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1,31 @@
/*
* Author: Glowbal
* Start load item.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* Object loaded <BOOL>
*
* Example:
* [object] call ace_cargo_fnc_starLoadIn
*
* Public: No
*/
#include "script_component.hpp"
params ["_player", "_object"];
private ["_nearestVehicle"];
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
if (isNull _nearestVehicle || _nearestVehicle isKindOf "Cargo_Base_F") then {
{
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_nearestVehicle = _x};
} foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
};
if (isNull _nearestVehicle) exitWith {false};
[_object, _nearestVehicle] call FUNC(loadItem)

View File

@ -0,0 +1,35 @@
/*
* Author: Glowbal
* Start unload action.
*
* Arguments:
* None
*
* Return value:
* None
*
* Example:
* [] call ace_cargo_fnc_startUnload
*
* Public: No
*/
#include "script_component.hpp"
private ["_display", "_loaded", "_ctrl", "_selected", "_item"];
disableSerialization;
_display = uiNamespace getVariable QGVAR(menuDisplay);
if (isnil "_display") exitWith {};
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
if (count _loaded == 0) exitWith {};
_ctrl = _display displayCtrl 100;
_selected = (lbCurSel _ctrl) max 0;
if (count _loaded <= _selected) exitWith {};
_item = _loaded select _selected;
[_item, GVAR(interactionVehicle)] call FUNC(unloadItem);

View File

@ -0,0 +1,68 @@
/*
* Author: Glowbal, ViperMaul
* Unload object from vehicle.
*
* Arguments:
* 0: Object <OBJECT>
* 1: Vehicle <OBJECT>
*
* Return value:
* Object unloaded <BOOL>
*
* Example:
* [object, vehicle] call ace_cargo_fnc_unloadItem
*
* Public: No
*/
#include "script_component.hpp"
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
params ["_item", "_vehicle"];
if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith {
false
};
_validVehiclestate = true;
_emptyPos = [];
if (_vehicle isKindOf "Ship" ) then {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
TRACE_1("SHIP Ground Check", getPosATL _vehicle );
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot.
} else {
if (_vehicle isKindOf "Air" ) then {
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
_emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition);
_emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ];
} else {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeOf _item]);
};
};
TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle);
if (!_validVehiclestate) exitWith {false};
if (count _emptyPos == 0) exitWith {false}; //consider displaying text saying there are no safe places to exit the vehicle
_loaded = _vehicle getVariable [QGVAR(loaded), []];
_loaded = _loaded - [_item];
_vehicle setVariable [QGVAR(loaded), _loaded, true];
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
_itemSize = [_item] call FUNC(getSizeItem);
_vehicle setVariable [QGVAR(space), (_space + _itemSize), true];
detach _item;
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent);
// TOOO maybe drag/carry the unloaded item?
// Invoke listenable event
["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
true

View File

@ -0,0 +1,38 @@
/*
* Author: Glowbal
* Validate the vehicle cargo space.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* None
*
* Example:
* [object] call ace_cargo_fnc_validateCargoSpace
*
* Public: No
*/
#include "script_component.hpp"
private ["_loaded", "_newLoaded", "_totalSpaceOccupied"];
params ["_vehicle"];
_loaded = _vehicle getVariable [QGVAR(loaded), []];
_newLoaded = [];
_totalSpaceOccupied = 0;
{
if !(isNull _x) then {
_newLoaded pushback _x;
_totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem));
};
true
} count _loaded;
if (count _loaded != count _newLoaded) then {
_vehicle setVariable [QGVAR(loaded), _newLoaded, true];
};
_vehicle setVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];

View File

@ -0,0 +1 @@
#include "\z\ace\addons\cargo\script_component.hpp"

103
addons/cargo/menu.hpp Normal file
View File

@ -0,0 +1,103 @@
#include "\z\ace\addons\common\define.hpp"
class GVAR(menu) {
idd = 314614;
movingEnable = true;
onLoad = QUOTE([_this select 0] call FUNC(onMenuOpen));
onUnload = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(menuDisplay)),nil)];);
class controlsBackground {
class HeaderBackground: ACE_gui_backgroundBase{
idc = -1;
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
text = "#(argb,8,8,3)color(0,0,0,0)";
};
class CenterBackground: HeaderBackground {
y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
h = "14 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
text = "#(argb,8,8,3)color(0,0,0,0.8)";
colorText[] = {0, 0, 0, "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"};
colorBackground[] = {0,0,0,"(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"};
};
};
class controls {
class HeaderName {
idc = 1;
type = CT_STATIC;
x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
style = ST_LEFT + ST_SHADOW;
font = "PuristaMedium";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {0.95, 0.95, 0.95, 0.75};
colorBackground[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"};
text = CSTRING(cargoMenu);
};
class SubHeader: HeaderName {
idc = 2;
x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
style = ST_CENTER;
colorText[] = {1, 1, 1.0, 0.9};
colorBackground[] = {0,0,0,0};
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
text = "";
};
class cargoList: ACE_gui_listBoxBase {
idc = 100;
x = "13.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "12.8 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)";
rowHeight = 0.03;
colorBackground[] = {0, 0, 0, 0.2};
colorText[] = {1, 1, 1, 1.0};
colorScrollbar[] = {0.95, 0.95, 0.95, 1};
colorSelect[] = {1, 1, 1, 1.0};
colorSelect2[] = {1, 1, 1, 1.0};
colorSelectBackground[] = {0.3, 0.3, 0.3, 1.0};
colorSelectBackground2[] = {0.3, 0.3, 0.3, 1.0};
};
class btnUnload: ACE_gui_buttonBase {
text = "Cancel";
idc = 11;
x = "13.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "14.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "5 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)";
animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)";
animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.8)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
color[] = {1, 1, 1, 1};
color2[] = {0,0,0, 1};
colorBackgroundFocused[] = {1,1,1,1};
colorBackground[] = {1,1,1,1};
colorbackground2[] = {1,1,1,1};
colorDisabled[] = {1,1,1,1};
colorFocused[] = {0,0,0,1};
periodFocus = 1;
periodOver = 1;
action = QUOTE(closeDialog 0);
};
class btnCancel: btnUnload {
text = CSTRING(unloadObject);
idc = 12;
x = "20.9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
action = QUOTE([] call FUNC(startUnload););
};
};
};

View File

@ -0,0 +1,14 @@
#define COMPONENT cargo
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_CARGO
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_ENABLED_CARGO
#define DEBUG_SETTINGS DEBUG_ENABLED_CARGO
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define MAX_LOAD_DISTANCE 10

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Cargo">
<Key ID="STR_ACE_Cargo_loadObject">
<English>Load</English>
<Polish>Załaduj</Polish>
</Key>
<Key ID="STR_ACE_Cargo_unloadObject">
<English>Unload</English>
<Polish>Wyładuj</Polish>
</Key>
<Key ID="STR_ACE_Cargo_openMenu">
<English>Cargo</English>
<Polish>Ładunek</Polish>
</Key>
<Key ID="STR_ACE_Cargo_cargoMenu">
<English>Cargo Menu</English>
<Polish>Menu ładunku</Polish>
</Key>
<Key ID="STR_ACE_Cargo_labelSpace">
<English>Cargo space left: %1</English>
<Polish>Pozostałe miejsce: %1</Polish>
</Key>
<Key ID="STR_ACE_Cargo_ModuleSettings_enable">
<English>Enable Cargo</English>
<Polish>Aktywuj cargo</Polish>
</Key>
<Key ID="STR_ACE_Cargo_ModuleSettings_enable_Description">
<English>Enable the load in cargo module</English>
<Polish>Aktywuj możliwość załadunku skrzyń i przedmiotów do pojazdów.</Polish>
</Key>
<Key ID="STR_ACE_Cargo_SettingsModule_DisplayName">
<English>Cargo Settings</English>
<Polish>Ustawienia cargo</Polish>
</Key>
<Key ID="STR_ACE_Cargo_SettingsModule_Description">
<English>Configure the cargo module settings</English>
<Polish>Skonfiguruj ustawienia modułu cargo.</Polish>
</Key>
</Package>
</Project>

View File

@ -75,16 +75,6 @@ if (isServer) then {
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler); ["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
}; };
// hack to get PFH to work in briefing
[QGVAR(onBriefingPFH), "onEachFrame", {
if (ACE_time > 0) exitWith {
[QGVAR(onBriefingPFH), "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
};
call cba_common_fnc_onFrame;
}] call BIS_fnc_addStackedEventHandler;
/////
QGVAR(remoteFnc) addPublicVariableEventHandler { QGVAR(remoteFnc) addPublicVariableEventHandler {
(_this select 1) call FUNC(execRemoteFnc); (_this select 1) call FUNC(execRemoteFnc);
}; };
@ -121,6 +111,7 @@ if(!isServer) then {
if (isServer) then { if (isServer) then {
[FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler; [FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler;
}; };
call FUNC(checkFiles); call FUNC(checkFiles);
@ -213,10 +204,11 @@ GVAR(OldCameraView) = cameraView;
GVAR(OldPlayerVehicle) = vehicle ACE_player; GVAR(OldPlayerVehicle) = vehicle ACE_player;
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
GVAR(OldPlayerWeapon) = currentWeapon ACE_player; GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
GVAR(OldVisibleMap) = false;
// PFH to raise varios events // PFH to raise varios events
[{ [{
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen"]; private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen", "_newVisibleMap"];
// "playerInventoryChanged" event // "playerInventoryChanged" event
_newPlayerInventory = [ACE_player] call FUNC(getAllGear); _newPlayerInventory = [ACE_player] call FUNC(getAllGear);
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then { if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
@ -280,7 +272,15 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
GVAR(OldPlayerWeapon) = _newPlayerWeapon; GVAR(OldPlayerWeapon) = _newPlayerWeapon;
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent); ["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
}; };
// "visibleMapChanged" event
_newVisibleMap = visibleMap;
if (!_newVisibleMap isEqualTo GVAR(OldVisibleMap)) then {
// Raise ACE event locally
GVAR(OldVisibleMap) = _newVisibleMap;
["visibleMapChanged", [ACE_player, _newVisibleMap]] call FUNC(localEvent);
};
}, 0, []] call CBA_fnc_addPerFrameHandler; }, 0, []] call CBA_fnc_addPerFrameHandler;
@ -327,7 +327,7 @@ GVAR(OldIsCamera) = false;
// Lastly, do JIP events // Lastly, do JIP events
// JIP Detection and event trigger. Run this at the very end, just in case anything uses it // JIP Detection and event trigger. Run this at the very end, just in case anything uses it
if(isMultiplayer && { ACE_time > 0 || isNull player } ) then { if (didJip) then {
// We are jipping! Get ready and wait, and throw the event // We are jipping! Get ready and wait, and throw the event
[{ [{
if(!(isNull player)) then { if(!(isNull player)) then {

View File

@ -11,6 +11,7 @@ PREP(addCanInteractWithCondition);
PREP(addLineToDebugDraw); PREP(addLineToDebugDraw);
PREP(addSetting); PREP(addSetting);
PREP(addToInventory); PREP(addToInventory);
PREP(assignObjectsInList);
PREP(ambientBrightness); PREP(ambientBrightness);
PREP(applyForceWalkStatus); PREP(applyForceWalkStatus);
PREP(ASLToPosition); PREP(ASLToPosition);

View File

@ -0,0 +1,50 @@
/*
* Author: Glowbal
* Loops through a string and filters out object names/variables to assign a value for given variable.
* Used by moduleAssign* within various parts of the ACE3 project.
*
* Arguments:
* 0: list <STRING>
* 1: variableName <STRING>
* 2: value <ANY>
* 3: Global <BOOL>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
private ["_splittedList", "_nilCheckPassedList"];
params ["_list", "_variable", "_setting", "_global"];
if (typeName _list == "STRING") then {
_splittedList = [_list, ","] call BIS_fnc_splitString;
_nilCheckPassedList = "";
{
_x = [_x] call FUNC(stringRemoveWhiteSpace);
if !(isnil _x) then {
if (_nilCheckPassedList == "") then {
_nilCheckPassedList = _x;
} else {
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
};
};
}foreach _splittedList;
_list = [] call compile format["[%1]",_nilCheckPassedList];
};
{
if (!isnil "_x") then {
if (typeName _x == typeName objNull) then {
if (local _x) then {
_x setvariable [_variable, _setting, _global];
};
};
};
}foreach _list;
true

View File

@ -27,6 +27,8 @@ _whitelist = [_whitelist, {toLower _this}] call FUNC(map);
ACE_Version_CheckAll = _checkAll; ACE_Version_CheckAll = _checkAll;
ACE_Version_Whitelist = _whitelist; ACE_Version_Whitelist = _whitelist;
if (!_checkAll) exitWith {}; //ACE is checked by FUNC(checkFiles)
if (!isServer) then { if (!isServer) then {
[_mode, _checkAll, _whitelist] spawn { [_mode, _checkAll, _whitelist] spawn {
private ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer", "_text", "_error", "_rscLayer", "_ctrlHint"]; private ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer", "_text", "_error", "_rscLayer", "_ctrlHint"];

View File

@ -84,7 +84,7 @@ if (_state) then {
openMap true; openMap true;
}; };
if (serverCommandAvailable "#missions" || {player getVariable ["ACE_isUnconscious", false] && {(call FUNC(player)) getVariable [QEGVAR(medical,AllowChatWhileUnconscious), missionNamespace getVariable [QEGVAR(medical,AllowChatWhileUnconscious), false]]}}) then { if (isServer || {serverCommandAvailable "#kick"} || {player getVariable ["ACE_isUnconscious", false] && {(call FUNC(player)) getVariable [QEGVAR(medical,AllowChatWhileUnconscious), missionNamespace getVariable [QEGVAR(medical,AllowChatWhileUnconscious), false]]}}) then {
if (!(_key in (actionKeys "DefaultAction" + actionKeys "Throw")) && {_key in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) then { if (!(_key in (actionKeys "DefaultAction" + actionKeys "Throw")) && {_key in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) then {
_key = 0; _key = 0;
}; };

View File

@ -18,6 +18,7 @@
* 14-16: pistol (String, Array, Array) * 14-16: pistol (String, Array, Array)
* 17: map, compass, watch, etc. (Array) * 17: map, compass, watch, etc. (Array)
* 18: binocluar (String) * 18: binocluar (String)
* 19: active weapon, active muzzle, active weaponMode (Array)
* *
*/ */
#include "script_component.hpp" #include "script_component.hpp"
@ -34,7 +35,8 @@ if (isNull _unit) exitWith {[
"", ["","","",""], [], "", ["","","",""], [],
"", ["","","",""], [], "", ["","","",""], [],
[], [],
"" "",
["","",""]
]}; ]};
[ [
@ -47,5 +49,6 @@ if (isNull _unit) exitWith {[
secondaryWeapon _unit, secondaryWeaponItems _unit, secondaryWeaponMagazine _unit, secondaryWeapon _unit, secondaryWeaponItems _unit, secondaryWeaponMagazine _unit,
handgunWeapon _unit, handgunItems _unit, handgunMagazine _unit, handgunWeapon _unit, handgunItems _unit, handgunMagazine _unit,
assignedItems _unit, assignedItems _unit,
binocular _unit binocular _unit,
[currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit]
] ]

View File

@ -41,14 +41,15 @@ _hitpointClasses = [_config >> "HitPoints"];
while {isClass _class} do { while {isClass _class} do {
for "_i" from 0 to (count _class - 1) do { for "_i" from 0 to (count _class - 1) do {
private ["_entry", "_selection"]; if (isClass (_class select _i)) then {
private ["_entry", "_selection"];
_entry = configName (_class select _i);
_selection = getText (_class select _i >> "name");
_entry = configName (_class select _i); if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then {
_selection = getText (_class select _i >> "name"); _hitpoints pushBack _entry;
_selections pushBack _selection;
if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { };
_hitpoints pushBack _entry;
_selections pushBack _selection;
}; };
}; };

View File

@ -1,31 +1,35 @@
/* /*
* Author: Sniperwolf572 * Author: Sniperwolf572
* Checks if one of the following common feature cameras is active:
* *
* Checks if one of the following BI feature cameras are active: * - Curator
* * - ACE Spectator
* - Classic camera (BIS_fnc_cameraOld)
* - Splendid camera (BIS_fnc_camera)
* - Arsenal camera (BIS_fnc_arsenal) * - Arsenal camera (BIS_fnc_arsenal)
* - Animation viewer (BIS_fnc_animViewer)
* - Establishing shot (BIS_fnc_establishingShot) * - Establishing shot (BIS_fnc_establishingShot)
* - Splendid camera (BIS_fnc_camera)
* - Animation viewer (BIS_fnc_animViewer)
* - Classic camera (BIS_fnc_cameraOld)
* *
* Arguments: * Arguments:
* None * 0: None <NIL>
* *
* Return value: * Return Value:
* Is BI feature camera active (bool) * A feature camera is active <BOOL>
* *
* Example: * Example:
* call ace_common_fnc_isFeatureCameraActive; * [] call ace_common_fnc_isFeatureCameraActive
* *
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
( !(
!isNull (missionNamespace getVariable ["BIS_DEBUG_CAM", objNull]) || // Classic camera isNull curatorCamera && // Curator
{!isNull (missionNamespace getVariable ["BIS_fnc_camera_cam", objNull])} || // Splendid camera {isNull (GETMVAR(EGVAR(spectator,camera),objNull))} && // ACE Spectator
{!isNull (uiNamespace getVariable ["BIS_fnc_arsenal_cam", objNull])} || // Arsenal camera {isNull (GETUVAR(BIS_fnc_arsenal_cam, objNull))} && // Arsenal camera
{!isNull (uiNamespace getVariable ["BIS_fnc_animViewer_cam", objNull])} || // Animation viewer camera {isNull (GETMVAR(BIS_fnc_establishingShot_fakeUAV, objNull))} && // Establishing shot camera
{!isNull (missionNamespace getVariable ["BIS_fnc_establishingShot_fakeUAV", objNull])} // Establishing shot camera {isNull (GETMVAR(BIS_fnc_camera_cam, objNull))} && // Splendid camera
) {isNull (GETUVAR(BIS_fnc_animViewer_cam, objNull))} && // Animation viewer camera
{isNull (GETMVAR(BIS_DEBUG_CAM, objNull))} // Classic camera
)

View File

@ -15,16 +15,16 @@
private ["_parseConfigForDisplayNames", "_name"]; private ["_parseConfigForDisplayNames", "_name"];
_parseConfigForDisplayNames = { _parseConfigForDisplayNames = {
private "_optionEntry"; private ["_optionEntry", "_values", "_text"];
_optionEntry = _this select 0; _optionEntry = _this select 0;
if !(isClass _optionEntry) exitwith {false}; if !(isClass _optionEntry) exitwith {false};
_values = getArray (_optionEntry >> "values");
_x set [3, getText (_optionEntry >> "displayName")]; _x set [3, getText (_optionEntry >> "displayName")];
_x set [4, getText (_optionEntry >> "description")]; _x set [4, getText (_optionEntry >> "description")];
_x set [5, _values];
_x set [8, getText (_optionEntry >> "category")];
private "_values";
_values = _x select 5;
{ {
private "_text";
_text = _x; _text = _x;
if (((typeName _text) == "STRING") && {(count _text) > 1} && {(_text select [0,1]) == "$"}) then { if (((typeName _text) == "STRING") && {(count _text) > 1} && {(_text select [0,1]) == "$"}) then {
_text = localize (_text select [1, ((count _text) - 1)]); //chop off the leading $ _text = localize (_text select [1, ((count _text) - 1)]); //chop off the leading $
@ -41,7 +41,9 @@ _parseConfigForDisplayNames = {
if !([configFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames) then { if !([configFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames) then {
if !([configFile >> "ACE_ServerSettings" >> _name] call _parseConfigForDisplayNames) then { if !([configFile >> "ACE_ServerSettings" >> _name] call _parseConfigForDisplayNames) then {
[missionConfigFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames; if !([missionConfigFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames) then {
diag_log text format ["[ACE] - Setting found, but couldn't localize [%1] (server has but we don't?)", _name];
};
}; };
}; };

View File

@ -72,12 +72,12 @@ if (isNil _name) then {
_name, _name,
_typeName, _typeName,
(getNumber (_optionEntry >> "isClientSettable")) > 0, (getNumber (_optionEntry >> "isClientSettable")) > 0,
getText (_optionEntry >> "displayName"), "", //getText (_optionEntry >> "displayName"), //No need to broadcast, handeled by fnc_loadSettingsLocalizedText
getText (_optionEntry >> "description"), "", //getText (_optionEntry >> "description"), //No need to broadcast, handeled by fnc_loadSettingsLocalizedText
getArray (_optionEntry >> "values"), [], //getArray (_optionEntry >> "values"), //No need to broadcast, handeled by fnc_loadSettingsLocalizedText
getNumber (_optionEntry >> "force") > 0, getNumber (_optionEntry >> "force") > 0,
_value, _value,
getText (_optionEntry >> "category") "" //getText (_optionEntry >> "category") //No need to broadcast, handeled by fnc_loadSettingsLocalizedText
]; ];
//Strings in the values array won't be localized from the config, so just do that now: //Strings in the values array won't be localized from the config, so just do that now:

View File

@ -479,7 +479,6 @@
<Portuguese>Verificar PBOs</Portuguese> <Portuguese>Verificar PBOs</Portuguese>
</Key> </Key>
<Key ID="STR_ACE_Common_CheckPBO_Description"> <Key ID="STR_ACE_Common_CheckPBO_Description">
<English></English>
<Polish>Sprawdzaj spójność addonów z serwerem</Polish> <Polish>Sprawdzaj spójność addonów z serwerem</Polish>
<Spanish>Este módulo verifica la integridad de los addons con los que iniciamos el simulador</Spanish> <Spanish>Este módulo verifica la integridad de los addons con los que iniciamos el simulador</Spanish>
<German>Dieses Modul überprüft ob jeder Spieler die richtigen PBO-Dateien hat.</German> <German>Dieses Modul überprüft ob jeder Spieler die richtigen PBO-Dateien hat.</German>
@ -646,6 +645,7 @@
</Key> </Key>
<Key ID="STR_ACE_Common_VehiclesOnly"> <Key ID="STR_ACE_Common_VehiclesOnly">
<English>Vehicles only</English> <English>Vehicles only</English>
<Polish>Tylko pojazdy</Polish>
</Key> </Key>
<Key ID="STR_ACE_Common_DoNotForce"> <Key ID="STR_ACE_Common_DoNotForce">
<English>Do Not Force</English> <English>Do Not Force</English>
@ -680,4 +680,4 @@
<Polish>ACE3 Pojazdy</Polish> <Polish>ACE3 Pojazdy</Polish>
</Key> </Key>
</Package> </Package>
</Project> </Project>

View File

@ -3,7 +3,7 @@ class CfgVehicles {
class Fence; class Fence;
class thingX; class thingX;
class NonStrategic; class NonStrategic;
class ACE_ConcertinaWireNoGeo: Fence { class ACE_ConcertinaWireNoGeo: Fence {
XEH_ENABLED; XEH_ENABLED;
scope = 1; scope = 1;
@ -48,7 +48,7 @@ class CfgVehicles {
class wire_16: wire_2{}; class wire_16: wire_2{};
class wire_17: wire_2{}; class wire_17: wire_2{};
class wire_18: wire_2{}; class wire_18: wire_2{};
class wire_2_1: wire_2 { class wire_2_1: wire_2 {
animPeriod = 8; animPeriod = 8;
}; };
@ -67,13 +67,14 @@ class CfgVehicles {
class wire_15_1: wire_2_1 {}; class wire_15_1: wire_2_1 {};
class wire_16_1: wire_2_1 {}; class wire_16_1: wire_2_1 {};
class wire_17_1: wire_2_1 {}; class wire_17_1: wire_2_1 {};
class wire_18_1: wire_2_1 {}; class wire_18_1: wire_2_1 {};
}; };
}; };
class ACE_ConcertinaWire: ACE_ConcertinaWireNoGeo { class ACE_ConcertinaWire: ACE_ConcertinaWireNoGeo {
scope = 2; scope = 2;
displayName = $STR_ACE_CONCERTINA_WIRE; displayName = $STR_ACE_CONCERTINA_WIRE;
model = PATHTOF(data\ACE_ConcertinaWire.p3d); model = PATHTOF(data\ACE_ConcertinaWire.p3d);
EGVAR(logistics_wirecutter,isFence) = 1;
class ACE_Actions { class ACE_Actions {
class ACE_MainActions { class ACE_MainActions {
selection = ""; selection = "";
@ -113,6 +114,8 @@ class CfgVehicles {
EGVAR(dragging,canDrag) = 1; EGVAR(dragging,canDrag) = 1;
EGVAR(dragging,dragPosition[]) = {0,0.5,0.5}; EGVAR(dragging,dragPosition[]) = {0,0.5,0.5};
EGVAR(dragging,dragDirection) = 0; EGVAR(dragging,dragDirection) = 0;
EGVAR(cargo,size) = 1;
EGVAR(cargo,canLoad) = 1;
class ACE_Actions { class ACE_Actions {
class ACE_MainActions { class ACE_MainActions {
selection = ""; selection = "";
@ -133,7 +136,7 @@ class CfgVehicles {
}; };
}; };
}; };
class Land_Razorwire_F: NonStrategic { class Land_Razorwire_F: NonStrategic {
XEH_ENABLED; XEH_ENABLED;
}; };

View File

@ -3,8 +3,9 @@ ace_concertina_wire
Adds concertina wire. Adds concertina wire.
## Maintainers ## Maintainers
The people responsible for merging changes to this component or answering potential questions. The people responsible for merging changes to this component or answering potential questions.
- [Ruthberg] (http://github.com/Ulteq) - [Ruthberg](http://github.com/Ulteq)

View File

@ -1,10 +1,11 @@
ace_dagr ace_dagr
=============== ===============
Defense Advanced GPS Receiver Adds Defense Advanced GPS Receiver.
## Maintainers ## Maintainers
The people responsible for merging changes to this component or answering potential questions. The people responsible for merging changes to this component or answering potential questions.
- [Ruthberg] (http://github.com/Ulteq) - [Ruthberg](http://github.com/Ulteq)

View File

@ -1,4 +1,4 @@
#include "script_component.hpp" #include "script_component.hpp"
["DisarmDropItems", {_this call FUNC(eventTargetStart)}] call EFUNC(common,addEventHandler); ["DisarmDropItems", FUNC(eventTargetStart)] call EFUNC(common,addEventHandler);
["DisarmDebugCallback", {_this call FUNC(eventCallerFinish)}] call EFUNC(common,addEventHandler); ["DisarmDebugCallback", FUNC(eventCallerFinish)] call EFUNC(common,addEventHandler);

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Checks the conditions for being able to disarm a unit * Checks the conditions for being able to disarm a unit
* *
* Arguments: * Arguments:
@ -15,17 +16,17 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_1(_target);
private ["_animationStateCfgMoves", "_putDownAnim"]; private ["_animationStateCfgMoves", "_putDownAnim"];
params ["_target"];
//Check animationState for putDown anim //Check animationState for putDown anim
//This ensures the unit doesn't have to actualy do any animation to drop something //This ensures the unit doesn't have to actualy do any animation to drop something
//This should always be true for the 3 possible status effects that allow disarming //This should always be true for the 3 possible status effects that allow disarming
_animationStateCfgMoves = getText (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _target) >> "actions"); _animationStateCfgMoves = getText (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _target) >> "actions");
if (_animationStateCfgMoves == "") exitWith {false}; if (_animationStateCfgMoves == "") exitWith { false };
_putDownAnim = getText (configFile >> "CfgMovesBasic" >> "Actions" >> _animationStateCfgMoves >> "PutDown"); _putDownAnim = getText (configFile >> "CfgMovesBasic" >> "Actions" >> _animationStateCfgMoves >> "PutDown");
if (_putDownAnim != "") exitWith {false}; if (_putDownAnim != "") exitWith { false };
(alive _target) && (alive _target) &&

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Checks the conditions for being able to disarm a unit * Checks the conditions for being able to disarm a unit
* *
* Arguments: * Arguments:
@ -16,7 +17,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_player,_target); params ["_player", "_target"];
([_target] call FUNC(canBeDisarmed)) && ([_target] call FUNC(canBeDisarmed)) &&
{([_player, _target, []] call EFUNC(common,canInteractWith))} {([_player, _target, []] call EFUNC(common,canInteractWith))}

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Makes a unit drop items * Makes a unit drop items
* *
* Arguments: * Arguments:
@ -22,13 +23,11 @@
private ["_fncSumArray", "_return", "_holder", "_dropPos", "_targetMagazinesStart", "_holderMagazinesStart", "_xClassname", "_xAmmo", "_targetMagazinesEnd", "_holderMagazinesEnd", "_holderItemsStart", "_targetItemsStart", "_addToCrateClassnames", "_addToCrateCount", "_index", "_holderItemsEnd", "_targetItemsEnd", "_holderIsEmpty"]; private ["_fncSumArray", "_return", "_holder", "_dropPos", "_targetMagazinesStart", "_holderMagazinesStart", "_xClassname", "_xAmmo", "_targetMagazinesEnd", "_holderMagazinesEnd", "_holderItemsStart", "_targetItemsStart", "_addToCrateClassnames", "_addToCrateCount", "_index", "_holderItemsEnd", "_targetItemsEnd", "_holderIsEmpty"];
params ["_caller", "_target", "_listOfItemsToRemove", ["_doNotDropAmmo", false, [false]]]; //By default units drop all weapon mags when dropping a weapon
PARAMS_3(_caller,_target,_listOfItemsToRemove);
DEFAULT_PARAM(3,_doNotDropAmmo,false); //By default units drop all weapon mags when dropping a weapon
_fncSumArray = { _fncSumArray = {
_return = 0; _return = 0;
{_return = _return + _x;} forEach (_this select 0); {_return = _return + _x;} count (_this select 0);
_return _return
}; };
@ -48,7 +47,7 @@ if (!_doNotDropAmmo) then {
if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith { if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith {
_holder = _x; _holder = _x;
}; };
} forEach ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); } count ((getpos _target) nearObjects [DISARM_CONTAINER, 3]);
}; };
//Create a new weapon holder //Create a new weapon holder

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Recieves a possible error code from FUNC(eventTargetFinish) * Recieves a possible error code from FUNC(eventTargetFinish)
* *
* Arguments: * Arguments:
@ -17,7 +18,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_3(_caller,_target,_errorMsg); params ["_caller", "_target", "_errorMsg"];
if (_caller != ACE_player) exitWith {}; if (_caller != ACE_player) exitWith {};

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* After FUNC(disarmDropItems) has completed, passing a possible error code. * After FUNC(disarmDropItems) has completed, passing a possible error code.
* Passes that error back to orginal caller. * Passes that error back to orginal caller.
* *
@ -18,7 +19,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_3(_caller,_target,_errorMsg); params ["_caller", "_target", "_errorMsg"];
if (_errorMsg != "") then { if (_errorMsg != "") then {
diag_log text format ["[ACE_Disarming] %1 - eventTargetFinish: %2", ACE_time, _this]; diag_log text format ["[ACE_Disarming] %1 - eventTargetFinish: %2", ACE_time, _this];

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Disarm Event Handler, Starting func, called on the target. * Disarm Event Handler, Starting func, called on the target.
* If target has to remove uniform/vest, this will add all uniform/vest items to the drop list. * If target has to remove uniform/vest, this will add all uniform/vest items to the drop list.
* *
@ -18,7 +19,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_3(_caller,_target,_listOfObjectsToRemove); params ["_caller", "_target", "_listOfObjectsToRemove"];
private "_itemsToAdd"; private "_itemsToAdd";

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Helper function to get all gear of a container * Helper function to get all gear of a container
* *
* Arguments: * Arguments:
@ -15,15 +16,16 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_1(_target); params ["_target"];
private ["_allGear"]; private ["_items", "_counts"];
_allGear = [[],[]];
_items = [];
_counts = [];
{ {
(_allGear select 0) append (_x select 0); _x params ["_item", "_count"];
(_allGear select 1) append (_x select 1); _items append _item;
_counts append _count;
} forEach [(getWeaponCargo _target), (getItemCargo _target), (getMagazineCargo _target), (getBackpackCargo _target)]; } forEach [(getWeaponCargo _target), (getItemCargo _target), (getMagazineCargo _target), (getBackpackCargo _target)];
_allGear [_items,_counts] // Return

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Helper function to get all gear of a unit. * Helper function to get all gear of a unit.
* *
* Arguments: * Arguments:
@ -15,7 +16,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_1(_target); params ["_target"];
private ["_allItems", "_classnamesCount", "_index", "_uniqueClassnames"]; private ["_allItems", "_classnamesCount", "_index", "_uniqueClassnames"];

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Opens the disarm dialog (allowing a person to remove items) * Opens the disarm dialog (allowing a person to remove items)
* *
* Arguments: * Arguments:
@ -15,21 +16,9 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_caller", "_target"];
#define TEXTURES_RANKS [ \
"", \
"\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa", \
"\A3\Ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa", \
"\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa", \
"\A3\Ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa", \
"\A3\Ui_f\data\GUI\Cfg\Ranks\captain_gs.paa", \
"\A3\Ui_f\data\GUI\Cfg\Ranks\major_gs.paa", \
"\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa" \
]
PARAMS_2(_caller,_target);
private "_display"; private "_display";
#define DEFUALTPATH "\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa"
//Sanity Checks //Sanity Checks
if (_caller != ACE_player) exitwith {ERROR("Player isn't caller?");}; if (_caller != ACE_player) exitwith {ERROR("Player isn't caller?");};
if (!([_player, _target] call FUNC(canPlayerDisarmUnit))) exitWith {ERROR("Can't Disarm Unit");}; if (!([_player, _target] call FUNC(canPlayerDisarmUnit))) exitWith {ERROR("Can't Disarm Unit");};
@ -47,8 +36,8 @@ GVAR(disarmTarget) = _target;
//Setup Drop Event (on right pannel) //Setup Drop Event (on right pannel)
(_display displayCtrl 632) ctrlAddEventHandler ["LBDrop", { (_display displayCtrl 632) ctrlAddEventHandler ["LBDrop", {
if (isNull GVAR(disarmTarget)) exitWith {}; if (isNull GVAR(disarmTarget)) exitWith {};
PARAMS_5(_ctrl,_xPos,_yPos,_idc,_itemInfo); params ["_ctrl", "_xPos", "_yPos", "_idc", "_itemInfo"];
EXPLODE_3_PVT((_itemInfo select 0),_displayText,_value,_data); (_itemInfo select 0) params ["_displayText", "_value", "_data"];
if (isNull GVAR(disarmTarget)) exitWith {ERROR("disarmTarget is null");}; if (isNull GVAR(disarmTarget)) exitWith {ERROR("disarmTarget is null");};
@ -60,18 +49,18 @@ GVAR(disarmTarget) = _target;
//Setup PFEH //Setup PFEH
[{ [{
private ["_groundContainer", "_targetContainer", "_playerName", "_rankPicture", "_rankIndex", "_targetUniqueItems", "_holderUniqueItems", "_holder"]; private ["_groundContainer", "_targetContainer", "_playerName", "_icon", "_rankPicture", "_targetUniqueItems", "_holderUniqueItems", "_holder"];
disableSerialization; disableSerialization;
EXPLODE_2_PVT(_this,_args,_pfID); params ["_args", "_idPFH"];
EXPLODE_3_PVT(_args,_player,_target,_display); _args params ["_player", "_target", "_display"];
if ((!([_player, _target] call FUNC(canPlayerDisarmUnit))) || if ((!([_player, _target] call FUNC(canPlayerDisarmUnit))) ||
{isNull _display} || {isNull _display} ||
{_player != ACE_player}) then { {_player != ACE_player}) then {
[_pfID] call CBA_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
GVAR(disarmTarget) = objNull; GVAR(disarmTarget) = objNull;
if (!isNull _display) then {closeDialog 0;}; //close dialog if still open if (!isNull _display) then { closeDialog 0; }; //close dialog if still open
} else { } else {
_groundContainer = _display displayCtrl 632; _groundContainer = _display displayCtrl 632;
@ -80,8 +69,9 @@ GVAR(disarmTarget) = _target;
_rankPicture = _display displayCtrl 1203; _rankPicture = _display displayCtrl 1203;
//Show rank and name (just like BIS's inventory) //Show rank and name (just like BIS's inventory)
_rankIndex = ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find (rank _target)) + 1); _icon = format [DEFUALTPATH, toLower (rank _target)];
_rankPicture ctrlSetText (TEXTURES_RANKS select _rankIndex); if (_icon isEqualTo DEFUALTPATH) then {_icon = ""};
_rankPicture ctrlSetText _icon;
_playerName ctrlSetText ([GVAR(disarmTarget)] call EFUNC(common,getName)); _playerName ctrlSetText ([GVAR(disarmTarget)] call EFUNC(common,getName));
//Clear both inventory lists: //Clear both inventory lists:
@ -98,7 +88,7 @@ GVAR(disarmTarget) = _target;
if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith { if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith {
_holder = _x; _holder = _x;
}; };
} forEach ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); } count ((getpos _target) nearObjects [DISARM_CONTAINER, 3]);
//If a holder exists, show it's inventory //If a holder exists, show it's inventory
if (!isNull _holder) then { if (!isNull _holder) then {

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Shows a list of inventory items in a listBox control. * Shows a list of inventory items in a listBox control.
* *
* Arguments: * Arguments:
@ -17,11 +18,12 @@
#include "script_component.hpp" #include "script_component.hpp"
disableSerialization; disableSerialization;
PARAMS_2(_listBoxCtrl,_itemsCountArray);
private ["_classname", "_count", "_displayName", "_picture"]; private ["_classname", "_count", "_displayName", "_picture"];
params ["_listBoxCtrl", "_itemsCountArray"];
{ {
private "_configPath";
_displayName = ""; _displayName = "";
_picture = ""; _picture = "";
@ -31,21 +33,25 @@ private ["_classname", "_count", "_displayName", "_picture"];
if ((_classname != DUMMY_ITEM) && {_classname != "ACE_FakePrimaryWeapon"}) then { //Don't show the dummy potato or fake weapon if ((_classname != DUMMY_ITEM) && {_classname != "ACE_FakePrimaryWeapon"}) then { //Don't show the dummy potato or fake weapon
switch (true) do { switch (true) do {
case (isClass (configFile >> "CfgWeapons" >> _classname)): { case (isClass (configFile >> "CfgWeapons" >> _classname)): {
_displayName = getText (configFile >> "CfgWeapons" >> _classname >> "displayName"); _configPath = (configFile >> "CfgWeapons");
_picture = getText (configFile >> "CfgWeapons" >> _classname >> "picture"); _displayName = getText (_configPath >> _classname >> "displayName");
_picture = getText (_configPath >> _classname >> "picture");
}; };
case (isClass (configFile >> "CfgMagazines" >> _classname)): { case (isClass (configFile >> "CfgMagazines" >> _classname)): {
_displayName = getText (configFile >> "CfgMagazines" >> _classname >> "displayName"); _configPath = (configFile >> "CfgMagazines");
_picture = getText (configFile >> "CfgMagazines" >> _classname >> "picture"); _displayName = getText (_configPath >> _classname >> "displayName");
_picture = getText (_configPath >> _classname >> "picture");
}; };
case (isClass (configFile >> "CfgVehicles" >> _classname)): { case (isClass (configFile >> "CfgVehicles" >> _classname)): {
_displayName = getText (configFile >> "CfgVehicles" >> _classname >> "displayName"); _configPath = (configFile >> "CfgVehicles");
_picture = getText (configFile >> "CfgVehicles" >> _classname >> "picture"); _displayName = getText (_configPath >> _classname >> "displayName");
_picture = getText (_configPath >> _classname >> "picture");
}; };
case (isClass (configFile >> "CfgGlasses" >> _classname)): { case (isClass (configFile >> "CfgGlasses" >> _classname)): {
_displayName = getText (configFile >> "CfgGlasses" >> _classname >> "displayName"); _configPath = (configFile >> "CfgGlasses");
_picture = getText (configFile >> "CfgGlasses" >> _classname >> "picture"); _displayName = getText (_configPath >> _classname >> "displayName");
_picture = getText (_configPath >> _classname >> "picture");
}; };
default { default {
ERROR(format ["[%1] - bad classname", _classname]); ERROR(format ["[%1] - bad classname", _classname]);

View File

@ -1,5 +1,6 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
*
* Verifies magazines moved with exact ammo counts preserved. * Verifies magazines moved with exact ammo counts preserved.
* Arrays will be in format from magazinesAmmo/magazinesAmmoCargo * Arrays will be in format from magazinesAmmo/magazinesAmmoCargo
* e.g.: [["30Rnd_65x39_caseless_mag",15], ["30Rnd_65x39_caseless_mag",30]] * e.g.: [["30Rnd_65x39_caseless_mag",15], ["30Rnd_65x39_caseless_mag",30]]

View File

@ -22,7 +22,7 @@ class Extended_FiredBIS_EventHandlers {
class Extended_InitPost_EventHandlers { class Extended_InitPost_EventHandlers {
class CAManBase { class CAManBase {
class ADDON { class ADDON {
init = QUOTE([ARR_2(_this select 0, secondaryWeapon (_this select 0))] call FUNC(takeLoadedATWeapon)); init = QUOTE([_this select 0] call FUNC(takeLoadedATWeapon));
}; };
}; };
}; };

View File

@ -1,6 +1,6 @@
class CfgMagazines { class CfgMagazines {
class NLAW_F; class NLAW_F;
class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
scope = 1; scope = 1;
scopeArsenal = 1; scopeArsenal = 1;
@ -12,14 +12,4 @@ class CfgMagazines {
class ACE_FiredMissileDummy: ACE_PreloadedMissileDummy { class ACE_FiredMissileDummy: ACE_PreloadedMissileDummy {
count = 0; count = 0;
}; };
class ACE_UsedTube_F: NLAW_F {
author = ECSTRING(common,ACETeam);
displayName = CSTRING(UsedTube);
descriptionShort = CSTRING(UsedTubeDescription);
displayNameShort = "-";
count = 0;
weaponPoolAvailable = 0;
modelSpecial = "";
mass = 0;
};
}; };

View File

@ -1,7 +1,7 @@
ace_disposable ace_disposable
============== ==============
Makes the NLAW a disposable one-shot weapon. Makes the NLAW a disposable one-shot weapon and provides disposable launchers framework for use by other mods.
## Maintainers ## Maintainers

View File

@ -3,8 +3,12 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
["inventoryDisplayLoaded", {[ACE_player, _this select 0] call FUNC(updateInventoryDisplay)}] call EFUNC(common,addEventHandler); ["inventoryDisplayLoaded", {
["playerInventoryChanged", { [ACE_player, _this select 0] call FUNC(updateInventoryDisplay)
[_this select 0, _this select 1 select 11] call FUNC(takeLoadedATWeapon); }] call EFUNC(common,addEventHandler);
[_this select 0] call FUNC(updateInventoryDisplay);
["playerInventoryChanged", {
params ["_unit"];
[_unit] call FUNC(takeLoadedATWeapon);
[_unit] call FUNC(updateInventoryDisplay);
}] call EFUNC(common,addEventHandler); }] call EFUNC(common,addEventHandler);

View File

@ -1,10 +0,0 @@
// by commy2
// The Arma InventoryOpened EH fires actually before the inventory dialog is opened (findDisplay 602 => displayNull).
#include "script_component.hpp"
["inventoryDisplayLoaded",{
[ACE_player] call FUNC(takeLoadedATWeapon);
[ACE_player, (_this select 0)] call FUNC(updateInventoryDisplay);
}] call EFUNC(common,addEventHandler);

View File

@ -21,17 +21,14 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_weapon", "_projectile", "_replacementTube", "_items"]; params ["_unit", "_weapon", "", "", "", "", "_projectile"];
TRACE_3("params",_unit,_weapon,_projectile);
_unit = _this select 0; if ((!local _unit) || {_weapon != (secondaryWeapon _unit)}) exitWith {};
_weapon = _this select 1;
_projectile = _this select 6;
if (!local _unit) exitWith {};
private ["_replacementTube", "_items"];
_replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube"); _replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube");
if (_replacementTube == "") exitWith {}; //If no replacement defined just exit if (_replacementTube == "") exitWith {}; //If no replacement defined just exit
if (_weapon != (secondaryWeapon _unit)) exitWith {}; //just to be sure
//Save array of items attached to launcher //Save array of items attached to launcher
@ -43,19 +40,19 @@ _unit selectWeapon _replacementTube;
//Re-add all attachments to the used tube //Re-add all attachments to the used tube
{ {
if (_x != "") then {_unit addSecondaryWeaponItem _x}; if (_x != "") then {_unit addSecondaryWeaponItem _x};
} forEach _items; } count _items;
// AI - Remove the ai's missle launcher tube after the missle has exploded // AI - Remove the ai's missle launcher tube after the missle has exploded
if !([_unit] call EFUNC(common,isPlayer)) then { if !([_unit] call EFUNC(common,isPlayer)) then {
[{ [{
EXPLODE_2_PVT(_this,_params,_pfhId); params ["_args","_idPFH"];
EXPLODE_3_PVT(_params,_unit,_tube,_projectile); _args params ["_unit", "_tube", "_projectile"];
//don't do anything until projectile is null (exploded/max range) //don't do anything until projectile is null (exploded/max range)
if (isNull _projectile) then { if (isNull _projectile) then {
//Remove PFEH: //Remove PFEH:
[_pfhId] call cba_fnc_removePerFrameHandler; [_idPFH] call cba_fnc_removePerFrameHandler;
//If (tube is dropped) OR (is dead) OR (is player) just exit //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 {};
@ -66,13 +63,13 @@ if !([_unit] call EFUNC(common,isPlayer)) then {
_container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"]; _container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
_container setPosAsl (getPosAsl _unit); _container setPosAsl (getPosAsl _unit);
_container addWeaponCargoGlobal [_tube, 1]; _container addWeaponCargoGlobal [_tube, 1];
//This will duplicate attachements, because we will be adding a weapon that may already have attachments on it //This will duplicate attachements, because we will be adding a weapon that may already have attachments on it
//We either need a way to add a clean weapon, or a way to add a fully configured weapon to a container: //We either need a way to add a clean weapon, or a way to add a fully configured weapon to a container:
// { // {
// if (_x != "") then {_container addItemCargoGlobal [_x, 1];}; // if (_x != "") then {_container addItemCargoGlobal [_x, 1];};
// } forEach _items; // } forEach _items;
_unit removeWeaponGlobal _tube; _unit removeWeaponGlobal _tube;
}; };
}, 1, [_unit, _replacementTube, _projectile]] call CBA_fnc_addPerFrameHandler; }, 1, [_unit, _replacementTube, _projectile]] call CBA_fnc_addPerFrameHandler;

View File

@ -15,16 +15,18 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_launcher", "_config"]; params ["_unit"];
TRACE_1("params",_unit);
PARAMS_1(_unit);
if (!local _unit) exitWith {}; if (!local _unit) exitWith {};
private ["_launcher", "_config"];
_launcher = secondaryWeapon _unit; _launcher = secondaryWeapon _unit;
_config = configFile >> "CfgWeapons" >> _launcher; _config = configFile >> "CfgWeapons" >> _launcher;
if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then { if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then {
private ["_magazine", "_isLauncherSelected"]; private ["_magazine", "_isLauncherSelected", "_didAdd"];
_magazine = getArray (_config >> "magazines") select 0; _magazine = getArray (_config >> "magazines") select 0;
@ -34,14 +36,22 @@ if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber
if (backpack _unit == "") then { if (backpack _unit == "") then {
_unit addBackpack "Bag_Base"; _unit addBackpack "Bag_Base";
_unit addMagazine _magazine; _unit addMagazine _magazine;
_didAdd = _magazine in (magazines _unit);
_unit addWeapon _launcher; _unit addWeapon _launcher;
if (!_didAdd) then {
TRACE_1("Failed To Add Disposable Magazine Normally, doing backup method (no backpack)",_unit);
_unit addSecondaryWeaponItem _magazine;
};
removeBackpack _unit; removeBackpack _unit;
} else { } else {
_unit addMagazine _magazine; _unit addMagazine _magazine;
_didAdd = _magazine in (magazines _unit);
_unit addWeapon _launcher; _unit addWeapon _launcher;
if (!_didAdd) then {
TRACE_2("Failed To Add Disposable Magazine Normally, doing backup method",_unit,(backpack _unit));
_unit addSecondaryWeaponItem _magazine;
};
}; };
if (_isLauncherSelected) then { if (_isLauncherSelected) then {

View File

@ -16,9 +16,8 @@
#include "script_component.hpp" #include "script_component.hpp"
disableSerialization; disableSerialization;
params ["_player", ["_display",(findDisplay 602),[displayNull]]];
PARAMS_1(_player); TRACE_2("params",_player,_display);
DEFAULT_PARAM(1,_display,(findDisplay 602));
_player removeMagazines "ACE_PreloadedMissileDummy"; _player removeMagazines "ACE_PreloadedMissileDummy";
_player removeMagazines "ACE_FiredMissileDummy"; _player removeMagazines "ACE_FiredMissileDummy";

View File

@ -1,6 +1,8 @@
#define COMPONENT disposable #define COMPONENT disposable
#include "\z\ace\addons\main\script_mod.hpp" #include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
#ifdef DEBUG_ENABLED_ATTACH #ifdef DEBUG_ENABLED_ATTACH
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
#endif #endif

Some files were not shown because too many files have changed in this diff Show More