mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into spectator
Conflicts: AUTHORS.txt
This commit is contained in:
commit
620136a1a7
@ -14,6 +14,7 @@ Garth "L-H" de Wet <garthofhearts@gmail.com>
|
||||
Giallustio
|
||||
Glowbal
|
||||
Janus
|
||||
jokoho482 <jokoho482@gmail.com>`
|
||||
Kieran
|
||||
NouberNou
|
||||
PabstMirror <pabstmirror@gmail.com>
|
||||
@ -50,6 +51,7 @@ Coren <coren4@gmail.com>
|
||||
Crusty
|
||||
Dharma Bellamkonda <dharma.bellamkonda@gmail.com>
|
||||
Dimaslg <dimaslg@telecable.es>
|
||||
Drill <drill87@gmail.com>
|
||||
eRazeri
|
||||
evromalarkey <evromalarkey@gmail.com>
|
||||
F3 Project <alanr@ferstaberinde.com>
|
||||
@ -69,7 +71,6 @@ Harakhti <shadowdragonphd@gmail.com>
|
||||
havena <silveredenis@gmail.com>
|
||||
Hawkins
|
||||
Head <brobergsebastian@gmail.com>
|
||||
jokoho482 <jokoho482@gmail.com>
|
||||
Jonpas <jonpas33@gmail.com>
|
||||
Karneck <dschultz26@hotmail.com>
|
||||
Kavinsky <nmunozfernandez@gmail.com>
|
||||
@ -81,6 +82,7 @@ Macusercom <macusercom@gmail.com>
|
||||
MarcBook
|
||||
meat <p.humberdroz@gmail.com>
|
||||
Michail Nikolaev
|
||||
MikeMatrix <m.braun92@gmail.com>
|
||||
nic547 <nic547@outlook.com>
|
||||
nikolauska <nikolauska1@gmail.com>
|
||||
nomisum <nomisum@gmail.com>
|
||||
@ -106,4 +108,3 @@ Valentin Torikian <valentin.torikian@gmail.com>
|
||||
VyMajoris(W-Cephei)<vycanismajoriscsa@gmail.com>
|
||||
Winter <simon@agius-muscat.net>
|
||||
zGuba
|
||||
Drill <drill87@gmail.com>
|
||||
|
20
README.md
20
README.md
@ -1,27 +1,21 @@
|
||||
<p align="center">
|
||||
<img src="https://github.com/acemod/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg"
|
||||
height="112">
|
||||
<img src="https://github.com/acemod/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg" width="480">
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/acemod/ACE3/releases">
|
||||
<img src="https://img.shields.io/badge/Version-3.2.0-blue.svg"
|
||||
alt="ACE version">
|
||||
<img src="https://img.shields.io/badge/Version-3.2.1-blue.svg" alt="ACE3 version">
|
||||
</a>
|
||||
<a href="https://github.com/acemod/ACE3/releases/download/v3.2.0/ace3_3.2.0.zip">
|
||||
<img src="http://img.shields.io/badge/Download-56.5_MB-green.svg"
|
||||
alt="ACE download">
|
||||
<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" alt="ACE3 download">
|
||||
</a>
|
||||
<a href="https://github.com/acemod/ACE3/issues">
|
||||
<img src="http://img.shields.io/github/issues-raw/acemod/ACE3.svg?label=Issues"
|
||||
alt="ACE issues">
|
||||
<img src="http://img.shields.io/github/issues-raw/acemod/ACE3.svg?label=Issues" alt="ACE3 issues">
|
||||
</a>
|
||||
<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"
|
||||
alt="BIF thread">
|
||||
<img src="https://img.shields.io/badge/BIF-Thread-lightgrey.svg" alt="BIF thread">
|
||||
</a>
|
||||
<a href="https://github.com/acemod/ACE3/blob/master/LICENSE">
|
||||
<img src="http://img.shields.io/badge/License-GPLv2-red.svg"
|
||||
alt="ACE license">
|
||||
<img src="http://img.shields.io/badge/License-GPLv2-red.svg" alt="ACE3 license">
|
||||
</a>
|
||||
</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>
|
||||
|
@ -1,31 +1,31 @@
|
||||
class ACE_Settings {
|
||||
class GVAR(enabled) {
|
||||
displayName = "Advanced Ballistics";
|
||||
description = "Enables advanced ballistics";
|
||||
displayName = CSTRING(enabled_DisplayName);
|
||||
description = CSTRING(enabled_Description);
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
};
|
||||
class GVAR(simulateForSnipers) {
|
||||
displayName = "Enabled For Snipers";
|
||||
description = "Enables advanced ballistics for non local snipers (when using high power optics)";
|
||||
displayName = CSTRING(simulateForSnipers_DisplayName);
|
||||
description = CSTRING(simulateForSnipers_Description);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(simulateForGroupMembers) {
|
||||
displayName = "Enabled For Group Members";
|
||||
description = "Enables advanced ballistics for non local group members";
|
||||
displayName = CSTRING(simulateForGroupMembers_DisplayName);
|
||||
description = CSTRING(simulateForGroupMembers_Description);
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
};
|
||||
class GVAR(simulateForEveryone) {
|
||||
displayName = "Enabled For Everyone";
|
||||
description = "Enables advanced ballistics for all non local players (enabling this may degrade performance during heavy firefights in multiplayer)";
|
||||
displayName = CSTRING(simulateForEveryone_DisplayName);
|
||||
description = CSTRING(simulateForEveryone_Description);
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
};
|
||||
class GVAR(disabledInFullAutoMode) {
|
||||
displayName = "Disabled In FullAuto Mode";
|
||||
description = "Disables advanced ballistics during full auto fire";
|
||||
displayName = CSTRING(disabledInFullAutoMod_DisplayName);
|
||||
description = CSTRING(disabledInFullAutoMod_Description);
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
};
|
||||
@ -38,32 +38,32 @@ class ACE_Settings {
|
||||
};
|
||||
*/
|
||||
class GVAR(ammoTemperatureEnabled) {
|
||||
displayName = "Enable Ammo Temperature Simulation";
|
||||
description = "Muzzle velocity varies with ammo temperature";
|
||||
displayName = CSTRING(ammoTemperatureEnabled_DisplayName);
|
||||
description = CSTRING(ammoTemperatureEnabled_Description);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(barrelLengthInfluenceEnabled) {
|
||||
displayName = "Enable Barrel Length Simulation";
|
||||
description = "Muzzle velocity varies with barrel length";
|
||||
displayName = CSTRING(barrelLengthInfluenceEnabled_DisplayName);
|
||||
description = CSTRING(barrelLengthInfluenceEnabled_Description);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(bulletTraceEnabled) {
|
||||
displayName = "Enable Bullet Trace Effect";
|
||||
description = "Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics)";
|
||||
displayName = CSTRING(bulletTraceEnabled_DisplayName);
|
||||
description = CSTRING(bulletTraceEnabled_Description);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(simulationInterval) {
|
||||
displayName = "Simulation Interval";
|
||||
description = "Defines the interval between every calculation step";
|
||||
displayName = CSTRING(simulationInterval_DisplayName);
|
||||
description = CSTRING(simulationInterval_Description);
|
||||
typeName = "SCALAR";
|
||||
value = 0.0;
|
||||
};
|
||||
class GVAR(simulationRadius) {
|
||||
displayName = "Simulation Radius";
|
||||
description = "Defines the radius around the player (in meters) at which advanced ballistics are applied to projectiles";
|
||||
displayName = CSTRING(simulationRadius_DisplayName);
|
||||
description = CSTRING(simulationRadius_Description);
|
||||
typeName = "SCALAR";
|
||||
value = 3000;
|
||||
};
|
||||
|
@ -3,8 +3,9 @@ ace_advanced_ballistics
|
||||
|
||||
The Advanced Ballistics module introduces advanced external- and internal ballistics to the game.
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [Ruthberg] (http://github.com/Ulteq)
|
||||
- [Ruthberg](http://github.com/Ulteq)
|
||||
|
@ -6,9 +6,8 @@ GVAR(currentbulletID) = -1;
|
||||
|
||||
GVAR(Protractor) = false;
|
||||
GVAR(ProtractorStart) = ACE_time;
|
||||
|
||||
GVAR(allBullets) = [];
|
||||
GVAR(currentGrid) = 0;
|
||||
GVAR(initMessageEnabled) = false;
|
||||
|
||||
GVAR(extensionAvailable) = true;
|
||||
/* @TODO: Remove this until versioning is in sync with cmake/build versioning
|
||||
|
@ -13,5 +13,5 @@ PREP(initializeTerrainExtension);
|
||||
PREP(initModuleSettings);
|
||||
PREP(readAmmoDataFromConfig);
|
||||
PREP(readWeaponDataFromConfig);
|
||||
|
||||
PREP(handleFirePFH);
|
||||
ADDON = true;
|
||||
|
@ -8,29 +8,29 @@
|
||||
* 1: temperature - degrees celcius <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: muzzle velocity shift - m/s <NUMBER>
|
||||
* muzzle velocity shift - m/s <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_muzzleVelocityShiftTable", "_temperature", "_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"];
|
||||
_muzzleVelocityShiftTable = _this select 0;
|
||||
_temperature = _this select 1;
|
||||
private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
|
||||
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
|
||||
params["_muzzleVelocityShiftTable", "_temperature"];
|
||||
|
||||
if (count _muzzleVelocityShiftTable != 11) exitWith { 0 };
|
||||
// Check if muzzleVelocityShiftTable is Larger Than 11 Entrys
|
||||
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
|
||||
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
|
||||
|
||||
_temperatureIndexA = floor((_temperature + 15) / 5);
|
||||
_temperatureIndexA = 0 max _temperatureIndexA;
|
||||
_temperatureIndexA = _temperatureIndexA min 10;
|
||||
// Find exact data index required for given temperature
|
||||
_temperatureIndexFunction = (_temperature + 15) / 5;
|
||||
|
||||
_temperatureIndexB = ceil((_temperature + 15) / 5);
|
||||
_temperatureIndexB = 0 max _temperatureIndexB;
|
||||
_temperatureIndexB = _temperatureIndexB min 10;
|
||||
// lower and upper data index used for interpolation
|
||||
_temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
|
||||
_temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
|
||||
|
||||
_temperatureRatio = ((_temperature + 15) / 5) - floor((_temperature + 15) / 5);
|
||||
// Interpolation ratio
|
||||
_interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
|
||||
|
||||
_muzzleVelocityShift = (_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _temperatureRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _temperatureRatio;
|
||||
|
||||
_muzzleVelocityShift
|
||||
// Interpolation
|
||||
(_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _interpolationRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _interpolationRatio // Return
|
||||
|
@ -17,12 +17,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ballisticCoefficient", "_temperature", "_pressure", "_relativeHumidity", "_atmosphereModel", "_airDensity"];
|
||||
_ballisticCoefficient = _this select 0;
|
||||
_temperature = _this select 1; // in C
|
||||
_pressure = _this select 2; // in hPa
|
||||
_relativeHumidity = _this select 3; // as ratio 0-1
|
||||
_atmosphereModel = _this select 4; // "ICAO" or "ASM"
|
||||
private "_airDensity";
|
||||
|
||||
params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/];
|
||||
|
||||
_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Author: Ruthberg, MikeMatrix, joko // Jonas
|
||||
*
|
||||
* Calculates the muzzle velocity shift caused by different barrel lengths
|
||||
*
|
||||
@ -10,46 +10,61 @@
|
||||
* 3: muzzle velocity - m/s <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: muzzle velocity shift - m/s <NUMBER>
|
||||
* muzzle velocity shift - m/s <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity", "_lowerIndex", "_upperIndex", "_barrelLengthRatio", "_muzzleVelocityNew"];
|
||||
_barrelLength = _this select 0;
|
||||
_muzzleVelocityTable = _this select 1;
|
||||
_barrelLengthTable = _this select 2;
|
||||
_muzzleVelocity = _this select 3;
|
||||
scopeName "main";
|
||||
|
||||
private ["_muzzleVelocityTableCount", "_barrelLengthTableCount", "_lowerDataIndex",
|
||||
"_upperDataIndex", "_lowerBarrelLength", "_upperBarrelLength", "_lowerMuzzleVelocity",
|
||||
"_upperMuzzleVelocity", "_interpolationRatio"];
|
||||
params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"];
|
||||
|
||||
// If barrel length is not defined, then there is no point in calculating muzzle velocity
|
||||
if (_barrelLength == 0) exitWith { 0 };
|
||||
if (count _muzzleVelocityTable != count _barrelLengthTable) exitWith { 0 };
|
||||
if (count _muzzleVelocityTable == 0 || count _barrelLengthTable == 0) exitWith { 0 };
|
||||
if (count _muzzleVelocityTable == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
|
||||
|
||||
_lowerIndex = 0;
|
||||
_upperIndex = (count _barrelLengthTable) - 1;
|
||||
_muzzleVelocityTableCount = count _muzzleVelocityTable;
|
||||
_barrelLengthTableCount = count _barrelLengthTable;
|
||||
|
||||
if (_barrelLength <= (_barrelLengthTable select _lowerIndex)) exitWith { (_muzzleVelocityTable select _lowerIndex) - _muzzleVelocity };
|
||||
if (_barrelLength >= (_barrelLengthTable select _upperIndex)) exitWith { (_muzzleVelocityTable select _upperIndex) - _muzzleVelocity };
|
||||
// Exit if tables are different sizes, have no elements or have only one element
|
||||
if (_muzzleVelocityTableCount != _barrelLengthTableCount || _muzzleVelocityTableCount == 0 || _barrelLengthTableCount == 0) exitWith { 0 };
|
||||
if (_muzzleVelocityTableCount == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
|
||||
|
||||
for "_i" from 0 to (count _barrelLengthTable) - 1 do {
|
||||
if (_barrelLength >= _barrelLengthTable select _i) then {
|
||||
_lowerIndex = _i;
|
||||
};
|
||||
};
|
||||
for "_i" from (count _barrelLengthTable) - 1 to 0 step -1 do {
|
||||
if (_barrelLength <= _barrelLengthTable select _i) then {
|
||||
_upperIndex = _i;
|
||||
// If we have the precise barrel length value, return result immediately
|
||||
if (_barrelLength in _barrelLengthTable) exitWith {
|
||||
(_muzzleVelocityTable select (_barrelLengthTable find _barrelLength)) - _muzzleVelocity
|
||||
};
|
||||
|
||||
// Limit values to lower and upper bound of data we have available
|
||||
if (_barrelLength <= (_barrelLengthTable select 0)) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
|
||||
if (_barrelLength >= (_barrelLengthTable select _barrelLengthTableCount - 1)) exitWith { (_muzzleVelocityTable select _barrelLengthTableCount - 1) - _muzzleVelocity };
|
||||
|
||||
// Find closest bordering values for barrel length
|
||||
{
|
||||
if (_barrelLength <= _x) then {
|
||||
_upperDataIndex = _forEachIndex;
|
||||
_lowerDataIndex = _upperDataIndex - 1;
|
||||
breakTo "main";
|
||||
};
|
||||
} forEach _barrelLengthTable;
|
||||
|
||||
// Worst case scenario
|
||||
if (isNil "_lowerDataIndex" || isNil "_upperDataIndex") exitWith {0};
|
||||
|
||||
_lowerBarrelLength = _barrelLengthTable select _lowerDataIndex;
|
||||
_upperBarrelLength = _barrelLengthTable select _upperDataIndex;
|
||||
_lowerMuzzleVelocity = _muzzleVelocityTable select _lowerDataIndex;
|
||||
_upperMuzzleVelocity = _muzzleVelocityTable select _upperDataIndex;
|
||||
|
||||
// Calculate interpolation ratio
|
||||
_interpolationRatio = if (abs (_lowerBarrelLength - _upperBarrelLength) > 0) then {
|
||||
(_upperBarrelLength - _barrelLength) / (_upperBarrelLength - _lowerBarrelLength)
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
_barrelLengthRatio = 0;
|
||||
if ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex) > 0) then {
|
||||
_barrelLengthRatio = ((_barrelLengthTable select _upperIndex) - _barrelLength) / ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex));
|
||||
};
|
||||
|
||||
_muzzleVelocityNew = (_muzzleVelocityTable select _lowerIndex) + ((_muzzleVelocityTable select _upperIndex) - (_muzzleVelocityTable select _lowerIndex)) * (1 - _barrelLengthRatio);
|
||||
|
||||
_muzzleVelocityNew - _muzzleVelocity
|
||||
// Calculate interpolated muzzle velocity shift
|
||||
(_lowerMuzzleVelocity + ((_upperMuzzleVelocity - _lowerMuzzleVelocity) * (1 - _interpolationRatio))) - _muzzleVelocity // Return
|
||||
|
@ -4,142 +4,129 @@
|
||||
* Calculates the retardation of the bullet
|
||||
*
|
||||
* Arguments:
|
||||
* 0: drag model - 1-7 <integer>
|
||||
* 0: drag model - integer 1-7 <NUMBER>
|
||||
* 1: drag coefficient - bc <NUMBER>
|
||||
* 2: velocity - m/s <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: retardation - m/(s^2) <NUMBER>
|
||||
* retardation - m/(s^2) <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Source: GNU Exterior Ballistics
|
||||
|
||||
private ["_dragModel", "_dragCoefficient", "_velocity", "_A", "_M", "_result"];
|
||||
_dragModel = _this select 0;
|
||||
_dragCoefficient = _this select 1;
|
||||
_velocity = (_this select 2) * 3.2808399;
|
||||
|
||||
_A = -1;
|
||||
_M = -1;
|
||||
_result = 0;
|
||||
private ["_A", "_M"];
|
||||
params ["_dragModel", "_dragCoefficient", "_velocity"];
|
||||
_velocity = _velocity * 3.2808399;
|
||||
|
||||
switch _dragModel do {
|
||||
case 1:
|
||||
{
|
||||
switch true do {
|
||||
case (_velocity > 4230) : { _A = 0.0001477404177730177; _M = 1.9565; };
|
||||
case (_velocity > 3680) : { _A = 0.0001920339268755614; _M = 1.925 ; };
|
||||
case (_velocity > 3450) : { _A = 0.0002894751026819746; _M = 1.875 ; };
|
||||
case (_velocity > 3295) : { _A = 0.0004349905111115636; _M = 1.825 ; };
|
||||
case (_velocity > 3130) : { _A = 0.0006520421871892662; _M = 1.775 ; };
|
||||
case (_velocity > 2960) : { _A = 0.0009748073694078696; _M = 1.725 ; };
|
||||
case (_velocity > 2830) : { _A = 0.001453721560187286; _M = 1.675 ; };
|
||||
case (_velocity > 2680) : { _A = 0.002162887202930376; _M = 1.625 ; };
|
||||
case (_velocity > 2460) : { _A = 0.003209559783129881; _M = 1.575 ; };
|
||||
case (_velocity > 2225) : { _A = 0.003904368218691249; _M = 1.55 ; };
|
||||
case (_velocity > 2015) : { _A = 0.003222942271262336; _M = 1.575 ; };
|
||||
case (_velocity > 1890) : { _A = 0.002203329542297809; _M = 1.625 ; };
|
||||
case (_velocity > 1810) : { _A = 0.001511001028891904; _M = 1.675 ; };
|
||||
case (_velocity > 1730) : { _A = 0.0008609957592468259; _M = 1.75 ; };
|
||||
case (_velocity > 1595) : { _A = 0.0004086146797305117; _M = 1.85 ; };
|
||||
case (_velocity > 1520) : { _A = 0.0001954473210037398; _M = 1.95 ; };
|
||||
case (_velocity > 1420) : { _A = 0.00005431896266462351; _M = 2.125 ; };
|
||||
case (_velocity > 1360) : { _A = 0.000008847742581674416; _M = 2.375 ; };
|
||||
case (_velocity > 1315) : { _A = 0.000001456922328720298; _M = 2.625 ; };
|
||||
case (_velocity > 1280) : { _A = 0.0000002419485191895565; _M = 2.875 ; };
|
||||
case (_velocity > 1220) : { _A = 0.00000001657956321067612; _M = 3.25 ; };
|
||||
case (_velocity > 1185) : { _A = 0.0000000004745469537157371; _M = 3.75 ; };
|
||||
case (_velocity > 1150) : { _A = 0.00000000001379746590025088; _M = 4.25 ; };
|
||||
case (_velocity > 1100) : { _A = 0.0000000000004070157961147882; _M = 4.75 ; };
|
||||
case (_velocity > 1060) : { _A = 0.00000000000002938236954847331; _M = 5.125 ; };
|
||||
case (_velocity > 1025) : { _A = 0.00000000000001228597370774746; _M = 5.25 ; };
|
||||
case (_velocity > 980) : { _A = 0.00000000000002916938264100495; _M = 5.125 ; };
|
||||
case (_velocity > 945) : { _A = 0.0000000000003855099424807451; _M = 4.75 ; };
|
||||
case (_velocity > 905) : { _A = 0.00000000001185097045689854; _M = 4.25 ; };
|
||||
case (_velocity > 860) : { _A = 0.0000000003566129470974951; _M = 3.75 ; };
|
||||
case (_velocity > 810) : { _A = 0.00000001045513263966272; _M = 3.25 ; };
|
||||
case (_velocity > 780) : { _A = 0.0000001291159200846216; _M = 2.875 ; };
|
||||
case (_velocity > 750) : { _A = 0.0000006824429329105383; _M = 2.625 ; };
|
||||
case (_velocity > 700) : { _A = 0.000003569169672385163; _M = 2.375 ; };
|
||||
case (_velocity > 640) : { _A = 0.00001839015095899579; _M = 2.125 ; };
|
||||
case (_velocity > 600) : { _A = 0.00005711174688734240; _M = 1.950 ; };
|
||||
case (_velocity > 550) : { _A = 0.00009226557091973427; _M = 1.875 ; };
|
||||
case (_velocity > 250) : { _A = 0.00009337991957131389; _M = 1.875 ; };
|
||||
case (_velocity > 100) : { _A = 0.00007225247327590413; _M = 1.925 ; };
|
||||
case (_velocity > 65) : { _A = 0.00005792684957074546; _M = 1.975 ; };
|
||||
case (_velocity > 0) : { _A = 0.00005206214107320588; _M = 2.000 ; };
|
||||
case 1: {
|
||||
call {
|
||||
if (_velocity > 4230) exitWith { _A = 0.0001477404177730177; _M = 1.9565; };
|
||||
if (_velocity > 3680) exitWith { _A = 0.0001920339268755614; _M = 1.925; };
|
||||
if (_velocity > 3450) exitWith { _A = 0.0002894751026819746; _M = 1.875; };
|
||||
if (_velocity > 3295) exitWith { _A = 0.0004349905111115636; _M = 1.825; };
|
||||
if (_velocity > 3130) exitWith { _A = 0.0006520421871892662; _M = 1.775; };
|
||||
if (_velocity > 2960) exitWith { _A = 0.0009748073694078696; _M = 1.725; };
|
||||
if (_velocity > 2830) exitWith { _A = 0.001453721560187286; _M = 1.675; };
|
||||
if (_velocity > 2680) exitWith { _A = 0.002162887202930376; _M = 1.625; };
|
||||
if (_velocity > 2460) exitWith { _A = 0.003209559783129881; _M = 1.575; };
|
||||
if (_velocity > 2225) exitWith { _A = 0.003904368218691249; _M = 1.55; };
|
||||
if (_velocity > 2015) exitWith { _A = 0.003222942271262336; _M = 1.575; };
|
||||
if (_velocity > 1890) exitWith { _A = 0.002203329542297809; _M = 1.625; };
|
||||
if (_velocity > 1810) exitWith { _A = 0.001511001028891904; _M = 1.675; };
|
||||
if (_velocity > 1730) exitWith { _A = 0.0008609957592468259; _M = 1.75; };
|
||||
if (_velocity > 1595) exitWith { _A = 0.0004086146797305117; _M = 1.85; };
|
||||
if (_velocity > 1520) exitWith { _A = 0.0001954473210037398; _M = 1.95; };
|
||||
if (_velocity > 1420) exitWith { _A = 0.00005431896266462351; _M = 2.125; };
|
||||
if (_velocity > 1360) exitWith { _A = 0.000008847742581674416; _M = 2.375; };
|
||||
if (_velocity > 1315) exitWith { _A = 0.000001456922328720298; _M = 2.625; };
|
||||
if (_velocity > 1280) exitWith { _A = 0.0000002419485191895565; _M = 2.875; };
|
||||
if (_velocity > 1220) exitWith { _A = 0.00000001657956321067612; _M = 3.25; };
|
||||
if (_velocity > 1185) exitWith { _A = 0.0000000004745469537157371; _M = 3.75; };
|
||||
if (_velocity > 1150) exitWith { _A = 0.00000000001379746590025088; _M = 4.25; };
|
||||
if (_velocity > 1100) exitWith { _A = 0.0000000000004070157961147882; _M = 4.75; };
|
||||
if (_velocity > 1060) exitWith { _A = 0.00000000000002938236954847331; _M = 5.125; };
|
||||
if (_velocity > 1025) exitWith { _A = 0.00000000000001228597370774746; _M = 5.25; };
|
||||
if (_velocity > 980) exitWith { _A = 0.00000000000002916938264100495; _M = 5.125; };
|
||||
if (_velocity > 945) exitWith { _A = 0.0000000000003855099424807451; _M = 4.75; };
|
||||
if (_velocity > 905) exitWith { _A = 0.00000000001185097045689854; _M = 4.25; };
|
||||
if (_velocity > 860) exitWith { _A = 0.0000000003566129470974951; _M = 3.75; };
|
||||
if (_velocity > 810) exitWith { _A = 0.00000001045513263966272; _M = 3.25; };
|
||||
if (_velocity > 780) exitWith { _A = 0.0000001291159200846216; _M = 2.875; };
|
||||
if (_velocity > 750) exitWith { _A = 0.0000006824429329105383; _M = 2.625; };
|
||||
if (_velocity > 700) exitWith { _A = 0.000003569169672385163; _M = 2.375; };
|
||||
if (_velocity > 640) exitWith { _A = 0.00001839015095899579; _M = 2.125; };
|
||||
if (_velocity > 600) exitWith { _A = 0.00005711174688734240; _M = 1.950; };
|
||||
if (_velocity > 550) exitWith { _A = 0.00009226557091973427; _M = 1.875; };
|
||||
if (_velocity > 250) exitWith { _A = 0.00009337991957131389; _M = 1.875; };
|
||||
if (_velocity > 100) exitWith { _A = 0.00007225247327590413; _M = 1.925; };
|
||||
if (_velocity > 65) exitWith { _A = 0.00005792684957074546; _M = 1.975; };
|
||||
if (_velocity > 0) exitWith { _A = 0.00005206214107320588; _M = 2.000; };
|
||||
};
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
switch true do {
|
||||
case (_velocity > 1674) : { _A = 0.0079470052136733; _M = 1.36999902851493; };
|
||||
case (_velocity > 1172) : { _A = 0.00100419763721974; _M = 1.65392237010294; };
|
||||
case (_velocity > 1060) : { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; };
|
||||
case (_velocity > 949) : { _A = 0.000000000139589807205091; _M = 3.81439537623717; };
|
||||
case (_velocity > 670) : { _A = 0.000234364342818625; _M = 1.71869536324748; };
|
||||
case (_velocity > 335) : { _A = 0.000177962438921838; _M = 1.76877550388679; };
|
||||
case (_velocity > 0) : { _A = 0.0000518033561289704; _M = 1.98160270524632; };
|
||||
case 2: {
|
||||
call {
|
||||
if (_velocity > 1674) exitWith { _A = 0.0079470052136733; _M = 1.36999902851493; };
|
||||
if (_velocity > 1172) exitWith { _A = 0.00100419763721974; _M = 1.65392237010294; };
|
||||
if (_velocity > 1060) exitWith { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; };
|
||||
if (_velocity > 949) exitWith { _A = 0.000000000139589807205091; _M = 3.81439537623717; };
|
||||
if (_velocity > 670) exitWith { _A = 0.000234364342818625; _M = 1.71869536324748; };
|
||||
if (_velocity > 335) exitWith { _A = 0.000177962438921838; _M = 1.76877550388679; };
|
||||
if (_velocity > 0) exitWith { _A = 0.0000518033561289704; _M = 1.98160270524632; };
|
||||
};
|
||||
};
|
||||
case 5:
|
||||
{
|
||||
switch true do {
|
||||
case (_velocity > 1730) : { _A = 0.00724854775171929; _M = 1.41538574492812; };
|
||||
case (_velocity > 1228) : { _A = 0.0000350563361516117; _M = 2.13077307854948; };
|
||||
case (_velocity > 1116) : { _A = 0.000000000000184029481181151; _M = 4.81927320350395; };
|
||||
case (_velocity > 1004) : { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422 ; };
|
||||
case (_velocity > 837) : { _A = 0.000000103965974081168; _M = 2.84204791809926; };
|
||||
case (_velocity > 335) : { _A = 0.0001093015938698234; _M = 1.81096361579504; };
|
||||
case (_velocity > 0) : { _A = 0.0000351963178524273; _M = 2.00477856801111; };
|
||||
case 5: {
|
||||
call {
|
||||
if (_velocity > 1730) exitWith { _A = 0.00724854775171929; _M = 1.41538574492812; };
|
||||
if (_velocity > 1228) exitWith { _A = 0.0000350563361516117; _M = 2.13077307854948; };
|
||||
if (_velocity > 1116) exitWith { _A = 0.000000000000184029481181151; _M = 4.81927320350395; };
|
||||
if (_velocity > 1004) exitWith { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422; };
|
||||
if (_velocity > 837) exitWith { _A = 0.000000103965974081168; _M = 2.84204791809926; };
|
||||
if (_velocity > 335) exitWith { _A = 0.0001093015938698234; _M = 1.81096361579504; };
|
||||
if (_velocity > 0) exitWith { _A = 0.0000351963178524273; _M = 2.00477856801111; };
|
||||
};
|
||||
};
|
||||
case 6:
|
||||
{
|
||||
switch true do {
|
||||
case (_velocity > 3236) : { _A = 0.0455384883480781; _M = 1.15997674041274; };
|
||||
case (_velocity > 2065) : { _A = 0.07167261849653769; _M = 1.10704436538885; };
|
||||
case (_velocity > 1311) : { _A = 0.00166676386084348; _M = 1.60085100195952; };
|
||||
case (_velocity > 1144) : { _A = 0.000000101482730119215; _M = 2.9569674731838 ; };
|
||||
case (_velocity > 1004) : { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; };
|
||||
case (_velocity > 670) : { _A = 0.0000204835650496866; _M = 2.11688446325998; };
|
||||
case (_velocity > 0) : { _A = 0.0000750912466084823; _M = 1.92031057847052; };
|
||||
case 6: {
|
||||
call {
|
||||
if (_velocity > 3236) exitWith { _A = 0.0455384883480781; _M = 1.15997674041274; };
|
||||
if (_velocity > 2065) exitWith { _A = 0.07167261849653769; _M = 1.10704436538885; };
|
||||
if (_velocity > 1311) exitWith { _A = 0.00166676386084348; _M = 1.60085100195952; };
|
||||
if (_velocity > 1144) exitWith { _A = 0.000000101482730119215; _M = 2.9569674731838; };
|
||||
if (_velocity > 1004) exitWith { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; };
|
||||
if (_velocity > 670) exitWith { _A = 0.0000204835650496866; _M = 2.11688446325998; };
|
||||
if (_velocity > 0) exitWith { _A = 0.0000750912466084823; _M = 1.92031057847052; };
|
||||
};
|
||||
};
|
||||
case 7:
|
||||
{
|
||||
switch true do {
|
||||
case (_velocity > 4200) : { _A = 0.00000000129081656775919; _M = 3.24121295355962; };
|
||||
case (_velocity > 3000) : { _A = 0.0171422231434847; _M = 1.27907168025204; };
|
||||
case (_velocity > 1470) : { _A = 0.00233355948302505; _M = 1.52693913274526; };
|
||||
case (_velocity > 1260) : { _A = 0.000797592111627665; _M = 1.67688974440324; };
|
||||
case (_velocity > 1110) : { _A = 0.00000000000571086414289273; _M = 4.3212826264889 ; };
|
||||
case (_velocity > 960) : { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; };
|
||||
case (_velocity > 670) : { _A = 0.00000752285155782535; _M = 2.1738019851075 ; };
|
||||
case (_velocity > 540) : { _A = 0.0000131766281225189; _M = 2.08774690257991; };
|
||||
case (_velocity > 0) : { _A = 0.0000134504843776525; _M = 2.08702306738884; };
|
||||
case 7: {
|
||||
call {
|
||||
if (_velocity > 4200) exitWith { _A = 0.00000000129081656775919; _M = 3.24121295355962; };
|
||||
if (_velocity > 3000) exitWith { _A = 0.0171422231434847; _M = 1.27907168025204; };
|
||||
if (_velocity > 1470) exitWith { _A = 0.00233355948302505; _M = 1.52693913274526; };
|
||||
if (_velocity > 1260) exitWith { _A = 0.000797592111627665; _M = 1.67688974440324; };
|
||||
if (_velocity > 1110) exitWith { _A = 0.00000000000571086414289273; _M = 4.3212826264889; };
|
||||
if (_velocity > 960) exitWith { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; };
|
||||
if (_velocity > 670) exitWith { _A = 0.00000752285155782535; _M = 2.1738019851075; };
|
||||
if (_velocity > 540) exitWith { _A = 0.0000131766281225189; _M = 2.08774690257991; };
|
||||
if (_velocity > 0) exitWith { _A = 0.0000134504843776525; _M = 2.08702306738884; };
|
||||
};
|
||||
};
|
||||
case 8:
|
||||
{
|
||||
switch true do {
|
||||
case (_velocity > 3571) : { _A = 0.0112263766252305; _M = 1.33207346655961; };
|
||||
case (_velocity > 1841) : { _A = 0.0167252613732636; _M = 1.28662041261785; };
|
||||
case (_velocity > 1120) : { _A = 0.00220172456619625; _M = 1.55636358091189; };
|
||||
case (_velocity > 1088) : { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; };
|
||||
case (_velocity > 976) : { _A = 0.00000000000592182174254121; _M = 4.29275576134191; };
|
||||
case (_velocity > 0) : { _A = 0.000043917343795117; _M = 1.99978116283334; };
|
||||
case 8: {
|
||||
call {
|
||||
if (_velocity > 3571) exitWith { _A = 0.0112263766252305; _M = 1.33207346655961; };
|
||||
if (_velocity > 1841) exitWith { _A = 0.0167252613732636; _M = 1.28662041261785; };
|
||||
if (_velocity > 1120) exitWith { _A = 0.00220172456619625; _M = 1.55636358091189; };
|
||||
if (_velocity > 1088) exitWith { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; };
|
||||
if (_velocity > 976) exitWith { _A = 0.00000000000592182174254121; _M = 4.29275576134191; };
|
||||
if (_velocity > 0) exitWith { _A = 0.000043917343795117; _M = 1.99978116283334; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_A != -1 && _M != -1 && _velocity > 0 && _velocity < 10000) then {
|
||||
_result = _A * (_velocity ^ _M) / _dragCoefficient;
|
||||
_result = _result / 3.2808399;
|
||||
if (!isNil "_A" && !isNil "_M" && _velocity > 0 && _velocity < 10000) then {
|
||||
(_A * (_velocity ^ _M) / _dragCoefficient) / 3.2808399
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
_result
|
||||
|
@ -13,33 +13,23 @@
|
||||
* 6: barometric Pressure - hPA <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: stability factor <NUMBER>
|
||||
* stability factor <NUMBER>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure", "_l", "_t", "_stabilityFactor"];
|
||||
_caliber = _this select 0;
|
||||
_bulletLength = _this select 1;
|
||||
_bulletMass = _this select 2;
|
||||
_barrelTwist = _this select 3;
|
||||
_muzzleVelocity = _this select 4;
|
||||
_temperature = _this select 5;
|
||||
_barometricPressure = _this select 6;
|
||||
private ["_twist", "_length", "_stabilityFactor"];
|
||||
params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"];
|
||||
|
||||
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
|
||||
_t = _barrelTwist / _caliber;
|
||||
_l = _bulletLength / _caliber;
|
||||
_twist = _barrelTwist / _caliber;
|
||||
_length = _bulletLength / _caliber;
|
||||
|
||||
_stabilityFactor = 7587000 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2));
|
||||
_stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
|
||||
|
||||
if (_muzzleVelocity > 341.376) then {
|
||||
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3);
|
||||
(_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
|
||||
} else {
|
||||
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3);
|
||||
(_stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
|
||||
};
|
||||
|
||||
_stabilityFactor = _stabilityFactor * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure;
|
||||
|
||||
_stabilityFactor
|
||||
|
@ -8,6 +8,8 @@
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -15,8 +17,6 @@
|
||||
#define __ctrl1 (__dsp displayCtrl 132950)
|
||||
#define __ctrl2 (__dsp displayCtrl 132951)
|
||||
|
||||
private ["_inclinationAngle", "_refPosition"];
|
||||
|
||||
if (GVAR(Protractor)) exitWith {
|
||||
GVAR(Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
@ -32,30 +32,26 @@ EGVAR(weather,WindInfo) = false;
|
||||
GVAR(Protractor) = true;
|
||||
|
||||
[{
|
||||
params ["","_idPFH"];
|
||||
if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith {
|
||||
GVAR(Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
[_idPFH] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
_refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3];
|
||||
|
||||
_inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2);
|
||||
_inclinationAngle = -58 max _inclinationAngle min 58;
|
||||
|
||||
|
||||
1 cutRsc ["RscProtractor", "PLAIN", 1, false];
|
||||
|
||||
|
||||
__ctrl1 ctrlSetScale 1;
|
||||
__ctrl1 ctrlCommit 0;
|
||||
__ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa));
|
||||
__ctrl1 ctrlSetTextColor [1, 1, 1, 1];
|
||||
|
||||
|
||||
__ctrl2 ctrlSetScale 1;
|
||||
__ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)];
|
||||
__ctrl2 ctrlSetPosition [SafeZoneX + 0.001, SafeZoneY + 0.001 - 0.0012 * (-58 max (asin((ACE_player weaponDirection currentWeapon ACE_player) select 2)) min 58), 0.2, 0.2 * 4/3];
|
||||
__ctrl2 ctrlCommit 0;
|
||||
__ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa));
|
||||
__ctrl2 ctrlSetTextColor [1, 1, 1, 1];
|
||||
|
||||
|
||||
}, 0.1, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
true
|
||||
|
47
addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
Normal file
47
addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
Normal 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;
|
||||
};
|
@ -13,28 +13,28 @@
|
||||
* 6: projectile - Object of the projectile that was shot <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"];
|
||||
_unit = _this select 0;
|
||||
_weapon = _this select 1;
|
||||
_mode = _this select 3;
|
||||
_ammo = _this select 4;
|
||||
_magazine = _this select 5;
|
||||
_bullet = _this select 6;
|
||||
// Early Quiting
|
||||
if (!hasInterface) exitWith {};
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
|
||||
// Parameterization
|
||||
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"];
|
||||
params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"];
|
||||
|
||||
_abort = false;
|
||||
if (!hasInterface) exitWith {};
|
||||
if (!alive _bullet) exitWith {};
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
||||
if (underwater _unit) exitWith {};
|
||||
|
||||
|
||||
if (!(_ammo isKindOf "BulletBase")) exitWith {};
|
||||
if (!alive _bullet) exitWith {};
|
||||
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
||||
if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {};
|
||||
if (underwater _unit) exitWith {};
|
||||
if (!GVAR(simulateForEveryone) && !(local _unit)) then {
|
||||
// The shooter is non local
|
||||
_abort = true;
|
||||
@ -56,34 +56,41 @@ if (_abort || !(GVAR(extensionAvailable))) exitWith {
|
||||
[_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH);
|
||||
};
|
||||
|
||||
// Get Weapon and Ammo Configurations
|
||||
_AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo];
|
||||
if (isNil {_AmmoCacheEntry}) then {
|
||||
if (isNil "_AmmoCacheEntry") then {
|
||||
_AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig);
|
||||
};
|
||||
_WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon];
|
||||
if (isNil {_WeaponCacheEntry}) then {
|
||||
if (isNil "_WeaponCacheEntry") then {
|
||||
_WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig);
|
||||
};
|
||||
|
||||
_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable"];
|
||||
_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
|
||||
|
||||
|
||||
_bulletVelocity = velocity _bullet;
|
||||
_muzzleVelocity = vectorMagnitude _bulletVelocity;
|
||||
|
||||
if (GVAR(barrelLengthInfluenceEnabled)) then {
|
||||
_muzzleVelocityShift = [_WeaponCacheEntry select 2, _AmmoCacheEntry select 10, _AmmoCacheEntry select 11, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
|
||||
if (_muzzleVelocityShift != 0) then {
|
||||
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
|
||||
_bullet setVelocity _bulletVelocity;
|
||||
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
|
||||
_barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil];
|
||||
if (isNil "_barrelVelocityShift") then {
|
||||
_barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
|
||||
uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift];
|
||||
};
|
||||
};
|
||||
|
||||
if (GVAR(ammoTemperatureEnabled)) then {
|
||||
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
|
||||
_muzzleVelocityShift = [_AmmoCacheEntry select 9, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift);
|
||||
_temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
|
||||
};
|
||||
|
||||
if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
|
||||
if (_muzzleVelocityShift != 0) then {
|
||||
_muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift);
|
||||
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
|
||||
_bullet setVelocity _bulletVelocity;
|
||||
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
|
||||
};
|
||||
};
|
||||
|
||||
@ -100,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;
|
||||
|
||||
if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
|
||||
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
|
||||
if (isNil "_temperature") then {
|
||||
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
|
||||
};
|
||||
_barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure);
|
||||
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor);
|
||||
};
|
||||
|
||||
GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000;
|
||||
|
||||
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _AmmoCacheEntry select 0, _AmmoCacheEntry select 6, _AmmoCacheEntry select 7, _AmmoCacheEntry select 8, _AmmoCacheEntry select 5, _stabilityFactor, _WeaponCacheEntry select 1, _muzzleVelocity, _AmmoCacheEntry select 4, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, floor(ACE_time), ACE_time - floor(ACE_time)];
|
||||
_aceTimeSecond = floor ACE_time;
|
||||
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond];
|
||||
|
||||
[{
|
||||
private ["_args", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"];
|
||||
_args = _this select 0;
|
||||
_bullet = _args select 0;
|
||||
_caliber = _args select 1;
|
||||
_bulletTraceVisible = _args select 2;
|
||||
_index = _args select 3;
|
||||
|
||||
_bulletVelocity = velocity _bullet;
|
||||
_bulletPosition = getPosASL _bullet;
|
||||
|
||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||
|
||||
if (!alive _bullet || _bulletSpeed < 100) exitWith {
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
if (_bulletTraceVisible && _bulletSpeed > 500) then {
|
||||
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];
|
||||
};
|
||||
GVAR(allBullets) pushBack [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)];
|
||||
|
||||
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, floor(ACE_time), ACE_time - floor(ACE_time)]);
|
||||
|
||||
}, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler;
|
||||
if (isNil QGVAR(BulletPFH)) then {
|
||||
GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
@ -8,17 +8,13 @@
|
||||
* 2: activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic", "_units", "_activated"];
|
||||
_logic = _this select 0;
|
||||
_units = _this select 1;
|
||||
_activated = _this select 2;
|
||||
params ["_logic","_units", "_activated"];
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
|
@ -3,10 +3,10 @@
|
||||
* Initializes the advanced ballistics dll extension with terrain data
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -22,9 +22,9 @@ _initStartTime = ACE_time;
|
||||
_mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
|
||||
|
||||
if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith {
|
||||
if (GVAR(initMessageEnabled)) then {
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
systemChat "AdvancedBallistics: Terrain already initialized";
|
||||
};
|
||||
#endIf
|
||||
};
|
||||
|
||||
_mapGrids = ceil(_mapSize / 50) + 1;
|
||||
@ -33,19 +33,16 @@ _gridCells = _mapGrids * _mapGrids;
|
||||
GVAR(currentGrid) = 0;
|
||||
|
||||
[{
|
||||
private ["_args", "_mapGrids", "_gridCells", "_initStartTime"];
|
||||
_args = _this select 0;
|
||||
_mapGrids = _args select 0;
|
||||
_gridCells = _args select 1;
|
||||
_initStartTime = _args select 2;
|
||||
|
||||
params ["_args","_idPFH"];
|
||||
_args params ["_mapGrids", "_gridCells", "_initStartTime"];
|
||||
|
||||
if (GVAR(currentGrid) >= _gridCells) exitWith {
|
||||
if (GVAR(initMessageEnabled)) then {
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)];
|
||||
};
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
#endif
|
||||
[_idPFH] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
|
||||
for "_i" from 1 to 50 do {
|
||||
_x = floor(GVAR(currentGrid) / _mapGrids) * 50;
|
||||
_y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50;
|
||||
@ -57,5 +54,5 @@ GVAR(currentGrid) = 0;
|
||||
GVAR(currentGrid) = GVAR(currentGrid) + 1;
|
||||
if (GVAR(currentGrid) >= _gridCells) exitWith {};
|
||||
};
|
||||
|
||||
|
||||
}, 0, [_mapGrids, _gridCells, _initStartTime]] call CBA_fnc_addPerFrameHandler
|
||||
|
@ -4,61 +4,53 @@
|
||||
* Reads the ammo class config and updates the config cache
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ammo - classname <string>
|
||||
* ammo - classname <STRING>
|
||||
*
|
||||
* 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:
|
||||
* None
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ammo", "_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_result"];
|
||||
_ammo = _this;
|
||||
_ammoConfig = configFile >> "CfgAmmo" >> _this;
|
||||
|
||||
_airFriction = getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction");
|
||||
_caliber = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber");
|
||||
_bulletLength = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletLength");
|
||||
_bulletMass = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletMass");
|
||||
_transonicStabilityCoef = 0.5;
|
||||
if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef")) then {
|
||||
_transonicStabilityCoef = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef");
|
||||
_airFriction = getNumber(_ammoConfig >> "airFriction");
|
||||
_caliber = getNumber(_ammoConfig >> "ACE_caliber");
|
||||
_bulletLength = getNumber(_ammoConfig >> "ACE_bulletLength");
|
||||
_bulletMass = getNumber(_ammoConfig >> "ACE_bulletMass");
|
||||
_transonicStabilityCoef = getNumber(_ammoConfig >> "ACE_transonicStabilityCoef");
|
||||
if (_transonicStabilityCoef == 0) then {
|
||||
_transonicStabilityCoef = 0.5;
|
||||
};
|
||||
_dragModel = 1;
|
||||
_ballisticCoefficients = [];
|
||||
_velocityBoundaries = [];
|
||||
_atmosphereModel = "ICAO";
|
||||
if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel")) then {
|
||||
_dragModel = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel");
|
||||
if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then {
|
||||
_dragModel = 1;
|
||||
};
|
||||
_dragModel = getNumber(_ammoConfig >> "ACE_dragModel");
|
||||
if (_dragModel == 0 || !(_dragModel in [1, 2, 5, 6, 7, 8])) then {
|
||||
_dragModel = 1;
|
||||
};
|
||||
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then {
|
||||
_ballisticCoefficients = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients");
|
||||
};
|
||||
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then {
|
||||
_velocityBoundaries = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries");
|
||||
};
|
||||
if (isText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then {
|
||||
_atmosphereModel = getText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere");
|
||||
};
|
||||
_ammoTempMuzzleVelocityShifts = [];
|
||||
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts")) then {
|
||||
_ammoTempMuzzleVelocityShifts = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts");
|
||||
};
|
||||
_muzzleVelocityTable = [];
|
||||
_barrelLengthTable = [];
|
||||
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities")) then {
|
||||
_muzzleVelocityTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities");
|
||||
};
|
||||
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths")) then {
|
||||
_barrelLengthTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths");
|
||||
_ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients");
|
||||
_velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries");
|
||||
_atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere");
|
||||
if (_atmosphereModel isEqualTo "") then {
|
||||
_atmosphereModel = "ICAO";
|
||||
};
|
||||
_ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVelocityShifts");
|
||||
_muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities");
|
||||
_barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths");
|
||||
|
||||
_result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable];
|
||||
|
||||
uiNamespace setVariable [format[QGVAR(%1), _ammo], _result];
|
||||
uiNamespace setVariable [format[QGVAR(%1), _this], _result];
|
||||
|
||||
_result
|
||||
|
@ -4,28 +4,28 @@
|
||||
* Reads the weapon class config and updates the config cache
|
||||
*
|
||||
* Arguments:
|
||||
* 0: weapon - classname <string>
|
||||
* weapon - classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: [_barrelTwist, _twistDirection, _barrelLength] <ARRAY>
|
||||
* 0: _barrelTwist
|
||||
* 1: _twistDirection
|
||||
* 2: _barrelLength
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_weapon", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"];
|
||||
_weapon = _this;
|
||||
private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"];
|
||||
_weaponConfig = (configFile >> "CfgWeapons" >> _this);
|
||||
|
||||
_barrelTwist = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelTwist");
|
||||
_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
|
||||
_twistDirection = 1;
|
||||
if (isNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection")) then {
|
||||
_twistDirection = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection");
|
||||
if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then {
|
||||
_twistDirection = 1;
|
||||
};
|
||||
_twistDirection = getNumber(_weaponConfig >> "ACE_twistDirection");
|
||||
if !(_twistDirection in [-1, 0, 1]) then {
|
||||
_twistDirection = 1;
|
||||
};
|
||||
_barrelLength = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelLength");
|
||||
|
||||
_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
|
||||
|
||||
_result = [_barrelTwist, _twistDirection, _barrelLength];
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
ace_aircraft
|
||||
============
|
||||
|
||||
Changes to air weaponry, flightmodels and HUDs.
|
||||
Changes to air weaponry, flight models and HUDs.
|
||||
|
||||
- Contributions by Kimi (geraldbolso1899) for HUD updates
|
||||
|
||||
* Contributations by Kimi (geraldbolso1899) for HUD updates
|
||||
|
||||
## Maintainers
|
||||
|
||||
@ -11,4 +12,4 @@ The people responsible for merging changes to this component or answering potent
|
||||
|
||||
- [KoffeinFlummi](https://github.com/KoffeinFlummi)
|
||||
- [commy2](https://github.com/commy2)
|
||||
- [jaynus](https://github.com/walterpearce)
|
||||
- [jaynus](https://github.com/walterpearce)
|
||||
|
11
addons/apl/README.md
Normal file
11
addons/apl/README.md
Normal 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
|
@ -21,7 +21,7 @@ class CfgVehicles {
|
||||
author = "Ruthberg";
|
||||
scope = 2;
|
||||
scopeCurator = 2;
|
||||
displayName = "ATragMX";
|
||||
displayName = CSTRING(Name);
|
||||
vehicleClass = "Items";
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_ATragMX,1);
|
||||
|
@ -3,8 +3,9 @@ ace_atragmx
|
||||
|
||||
ATragMX - Handheld ballistics calculator
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [Ruthberg] (http://github.com/Ulteq)
|
||||
- [Ruthberg](http://github.com/Ulteq)
|
||||
|
@ -57,6 +57,6 @@ GVAR(DialogPFH) = [{
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
__ctrlBackground ctrlSetText format [QUOTE(PATHTOF(UI\ATRAG_%1.paa)), ["N", "D"] select (call EFUNC(common,ambientBrightness))];
|
||||
}, 60, []] call cba_fnc_addPerFrameHandler;
|
||||
}, 60, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
true
|
||||
|
@ -2,7 +2,9 @@ ace_attach
|
||||
==========
|
||||
|
||||
Introducing the ability to attach various throwables to yourself or vehicles, to mark your position and assist in IFF.
|
||||
Adds item `ACE_IR_Strobe_Item`.
|
||||
|
||||
#### Items Added:
|
||||
`ACE_IR_Strobe_Item`
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
@ -17,10 +17,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_itemClassname", "_itemVehClass", "_onAtachText", "_selfAttachPosition", "_attachedItem", "_tempObject", "_actionID", "_model"];
|
||||
|
||||
PARAMS_3(_attachToVehicle,_unit,_args);
|
||||
_itemClassname = [_args, 0, ""] call CBA_fnc_defaultParam;
|
||||
private ["_itemVehClass", "_onAtachText", "_selfAttachPosition", "_attachedItem", "_tempObject", "_actionID", "_model"];
|
||||
params ["_attachToVehicle","_unit","_args"];
|
||||
_args params [["_itemClassname","", [""]]];
|
||||
TRACE_3("params",_attachToVehicle,_unit,_itemClassname);
|
||||
|
||||
//Sanity Check (_unit has item in inventory, not over attach limit)
|
||||
if ((_itemClassname == "") || {!(_this call FUNC(canAttach))}) exitWith {ERROR("Tried to attach, but check failed");};
|
||||
@ -69,9 +69,8 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
|
||||
[{
|
||||
private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"];
|
||||
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_6_PVT(_args,_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_actionID);
|
||||
params ["_args","_idPFH"];
|
||||
_args params ["_unit","_attachToVehicle","_itemClassname","_itemVehClass","_onAtachText","_actionID"];
|
||||
|
||||
_virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]);
|
||||
if (cameraView == "EXTERNAL") then {
|
||||
@ -88,7 +87,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
{!([_unit, _attachToVehicle, []] call EFUNC(common,canInteractWith))} ||
|
||||
{!([_attachToVehicle, _unit, _itemClassname] call FUNC(canAttach))}) then {
|
||||
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
||||
[] call EFUNC(interaction,hideMouseHint);
|
||||
[_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler);
|
||||
|
@ -17,14 +17,14 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_attachToVehicle,_player,_args);
|
||||
private ["_attachLimit", "_attachedObjects","_playerPos"];
|
||||
params ["_attachToVehicle","_player","_args"];
|
||||
_args params [["_itemClassname","", [""]]];
|
||||
TRACE_3("params",_attachToVehicle,_unit,_itemClassname);
|
||||
|
||||
private ["_itemName", "_attachLimit", "_attachedObjects","_playerPos"];
|
||||
|
||||
_itemName = [_args, 0, ""] call CBA_fnc_defaultParam;
|
||||
_attachLimit = [6, 1] select (_player == _attachToVehicle);
|
||||
_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []];
|
||||
|
||||
_playerPos = (ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"));
|
||||
|
||||
(canStand _player) && {(_attachToVehicle distance _player) < 7} && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_itemName in ((itemsWithMagazines _player) + [""])};
|
||||
(canStand _player) && {(_attachToVehicle distance _player) < 7} && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_itemClassname in ((itemsWithMagazines _player) + [""])};
|
||||
|
@ -16,9 +16,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_attachToVehicle,_unit);
|
||||
|
||||
private ["_attachedObjects", "_inRange"];
|
||||
params ["_attachToVehicle", "_unit"];
|
||||
TRACE_2("params",_attachToVehicle,_unit);
|
||||
|
||||
_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []];
|
||||
|
||||
|
@ -16,15 +16,16 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_attachToVehicle,_unit);
|
||||
|
||||
private ["_attachedObjects", "_attachedItems", "_itemDisplayName"];
|
||||
private ["_attachedObjects", "_attachedItems", "_itemDisplayName",
|
||||
"_attachedObject", "_attachedIndex", "_itemName", "_minDistance",
|
||||
"_unitPos", "_objectPos"
|
||||
];
|
||||
params ["_attachToVehicle","_unit"],
|
||||
TRACE_2("params",_attachToVehicle,_unit);
|
||||
|
||||
_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []];
|
||||
_attachedItems = _attachToVehicle getVariable [QGVAR(ItemNames), []];
|
||||
|
||||
private ["_attachedObject", "_attachedIndex", "_itemName", "_minDistance", "_unitPos", "_objectPos"];
|
||||
|
||||
_attachedObject = objNull;
|
||||
_attachedIndex = -1;
|
||||
_itemName = "";
|
||||
|
@ -18,7 +18,8 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_listed", "_actions", "_item", "_displayName", "_picture", "_action"];
|
||||
PARAMS_2(_target,_player);
|
||||
params ["_target","_player"];
|
||||
TRACE_2("params",_target,_player);
|
||||
|
||||
_listed = [];
|
||||
_actions = [];
|
||||
@ -30,7 +31,7 @@ _actions = [];
|
||||
if (getText (_item >> "ACE_Attachable") != "") then {
|
||||
_displayName = getText(_item >> "displayName");
|
||||
_picture = getText(_item >> "picture");
|
||||
_action = [_x, _displayName, _picture, {_this call FUNC(attach)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction);
|
||||
_action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call EFUNC(common,execNextFrame)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction);
|
||||
_actions pushBack [_action, [], _target];
|
||||
};
|
||||
};
|
||||
@ -43,7 +44,7 @@ _actions = [];
|
||||
if (getText (_item >> "ACE_Attachable") != "") then {
|
||||
_displayName = getText(_item >> "displayName");
|
||||
_picture = getText(_item >> "picture");
|
||||
_action = [_x, _displayName, _picture, {_this call FUNC(attach)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction);
|
||||
_action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call EFUNC(common,execNextFrame)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction);
|
||||
_actions pushBack [_action, [], _target];
|
||||
};
|
||||
};
|
||||
|
@ -27,7 +27,8 @@
|
||||
|
||||
private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_currentObjects", "_currentItemNames"];
|
||||
|
||||
PARAMS_6(_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_startingPosition);
|
||||
params ["_unit", "_attachToVehicle", "_itemClassname", "_itemVehClass", "_onAtachText", "_startingPosition"];
|
||||
TRACE_6("params",_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_startingPosition);
|
||||
|
||||
_startingOffset = _attachToVehicle worldToModel _startingPosition;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<English>Attach item >></English>
|
||||
<German>Gegenstand befestigen >></German>
|
||||
<Spanish>Acoplar objeto >></Spanish>
|
||||
<Polish>Przyczep przedmiot >></Polish>
|
||||
<Polish>Przyczep >></Polish>
|
||||
<French>Attacher l'objet >></French>
|
||||
<Czech>Připnout předmět >></Czech>
|
||||
<Portuguese>Fixar item >></Portuguese>
|
||||
@ -185,7 +185,7 @@
|
||||
<English>%1<br/>Attached</English>
|
||||
<German>%1<br/>befestigt</German>
|
||||
<Spanish>%1<br/>acoplada</Spanish>
|
||||
<Polish>%1<br/>przyczepiono</Polish>
|
||||
<Polish>Przyczepiono<br/>%1</Polish>
|
||||
<French>%1<br/>attachée</French>
|
||||
<Czech>%1<br/>Připnutý</Czech>
|
||||
<Portuguese>%1<br/>Fixada</Portuguese>
|
||||
@ -197,7 +197,7 @@
|
||||
<English>%1<br/>Detached</English>
|
||||
<German>%1<br/>entfernt</German>
|
||||
<Spanish>%1<br/>quitada</Spanish>
|
||||
<Polish>%1<br/>odczepiono</Polish>
|
||||
<Polish>Odczepiono<br/>%1</Polish>
|
||||
<French>%1<br/>détachée</French>
|
||||
<Czech>%1<br/>Odepnutý</Czech>
|
||||
<Portuguese>%1<br/>Separada</Portuguese>
|
||||
@ -206,4 +206,4 @@
|
||||
<Russian>%1<br/>отсоединен(-а)</Russian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
@ -1,7 +1,8 @@
|
||||
ace_backpacks
|
||||
=================
|
||||
|
||||
Adds indication when someone else opens your backpack (soundeffect / camShake).
|
||||
Adds indication when someone else opens your backpack (sound effect and camera shake).
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler);
|
||||
["backpackOpened", DFUNC(backpackOpened)] call EFUNC(common,addEventHandler);
|
||||
|
@ -2,18 +2,18 @@
|
||||
* Author: commy2
|
||||
*
|
||||
* Someone opened your backpack. Execute locally.
|
||||
*
|
||||
*
|
||||
* Argument:
|
||||
* 0: Who accessed your inventory? (Object)
|
||||
* 1: Unit that wields the backpack (Object)
|
||||
* 2: The backpack object (Object)
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
* None.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_unit,_target,_backpack);
|
||||
private ["_sounds", "_position"];
|
||||
params ["_target", "_backpack"];
|
||||
|
||||
// do cam shake if the target is the player
|
||||
if ([_target] call EFUNC(common,isPlayer)) then {
|
||||
@ -21,7 +21,6 @@ if ([_target] call EFUNC(common,isPlayer)) then {
|
||||
};
|
||||
|
||||
// play a rustling sound
|
||||
private ["_sounds", "_position"];
|
||||
|
||||
_sounds = [
|
||||
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
|
||||
|
@ -2,21 +2,21 @@
|
||||
* Author: commy2
|
||||
*
|
||||
* Returns the unit that has the given backpack object equipped.
|
||||
*
|
||||
*
|
||||
* Argument:
|
||||
* 0: A backpack object (Object)
|
||||
*
|
||||
* 0: Executing Unit (Object)
|
||||
* 1: A backpack object (Object)
|
||||
*
|
||||
* Return value:
|
||||
* Unit that has the backpack equipped. (Object)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
scopeName "main";
|
||||
|
||||
private ["_backpack", "_unit"];
|
||||
|
||||
_backpack = _this select 0;
|
||||
|
||||
_unit = objNull;
|
||||
params ["_unit","_backpack"];
|
||||
_target = objNull;
|
||||
{
|
||||
if (backpackContainer _x == _backpack) exitWith {_unit = _x};
|
||||
} forEach (allUnits + allDeadMen);
|
||||
_unit
|
||||
if (backpackContainer _x == _backpack) then {_target = _x; breakTo "main"};
|
||||
} count nearestObjects [_unit, ["Man"], 5];
|
||||
if (isNull _target) exitWith {ACE_Player};
|
||||
_target
|
||||
|
@ -11,9 +11,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_backpack", "_config"];
|
||||
|
||||
_backpack = _this select 0;
|
||||
private ["_config"];
|
||||
params ["_backpack"];
|
||||
|
||||
if (typeName _backpack == "OBJECT") then {
|
||||
_backpack = typeOf _backpack;
|
||||
|
@ -2,29 +2,27 @@
|
||||
* Author: commy2
|
||||
*
|
||||
* Handle the open inventory event. Display message on traget client.
|
||||
*
|
||||
*
|
||||
* Argument:
|
||||
* Input from "InventoryOpened" eventhandler
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
* false. Always open the inventory dialog. (Bool)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_backpack"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_backpack = _this select 1;
|
||||
private "_target";
|
||||
params ["","_backpack"];
|
||||
|
||||
// exit if the target is not a backpack
|
||||
if !([_backpack] call FUNC(isBackpack)) exitWith {};
|
||||
|
||||
// get the unit that wears the backpack object
|
||||
private "_target";
|
||||
_target = [_backpack] call FUNC(getBackpackAssignedUnit);
|
||||
_target = _this call FUNC(getBackpackAssignedUnit);
|
||||
|
||||
if (isNull _target) exitWith {false};
|
||||
// raise event on target unit
|
||||
["backpackOpened", _target, [_unit, _target, _backpack]] call EFUNC(common,targetEvent);
|
||||
["backpackOpened", _target, [_target, _backpack]] call EFUNC(common,targetEvent);
|
||||
|
||||
// return false to open inventory as usual
|
||||
false
|
||||
|
@ -3,10 +3,11 @@ ace_ballistics
|
||||
|
||||
Changes to weapon, magazine and ammunition values.
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [Ruthberg] (http://github.com/Ulteq)
|
||||
- [Ruthberg](http://github.com/Ulteq)
|
||||
- [KoffeinFlummi](https://github.com/KoffeinFlummi)
|
||||
- [commy2](https://github.com/commy2)
|
||||
|
@ -1,9 +1,9 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_wall", "_paper"];
|
||||
private "_paper";
|
||||
|
||||
_wall = _this select 0;
|
||||
params ["_wall"];
|
||||
|
||||
if (local _wall) then {
|
||||
_paper = "UserTexture_1x2_F" createVehicle position _wall;
|
||||
|
@ -5,6 +5,13 @@ class ACE_Settings {
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(requireSurrender) {
|
||||
displayName = CSTRING(ModuleSettings_requireSurrender_name);
|
||||
description = CSTRING(ModuleSettings_requireSurrender_description);
|
||||
typeName = "SCALAR";
|
||||
values[] = {ECSTRING(common,Disabled), CSTRING(SurrenderOnly), CSTRING(SurrenderOrNoWeapon)};
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(allowSurrender) {
|
||||
displayName = CSTRING(ModuleSettings_allowSurrender_name);
|
||||
description = CSTRING(ModuleSettings_allowSurrender_description);
|
||||
|
@ -189,6 +189,26 @@ class CfgVehicles {
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class requireSurrender {
|
||||
displayName = CSTRING(ModuleSettings_requireSurrender_name);
|
||||
description = CSTRING(ModuleSettings_requireSurrender_description);
|
||||
typeName = "NUMBER";
|
||||
class values {
|
||||
class disable {
|
||||
name = ECSTRING(common,No);
|
||||
value = 0;
|
||||
};
|
||||
class Surrender {
|
||||
name = CSTRING(SurrenderOnly);
|
||||
value = 1;
|
||||
default = 1;
|
||||
};
|
||||
class SurrenderOrNoWeapon {
|
||||
name = CSTRING(SurrenderOrNoWeapon);
|
||||
value = 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
class ModuleDescription: ModuleDescription {
|
||||
description = CSTRING(ModuleSettings_Description);
|
||||
|
@ -1,10 +1,10 @@
|
||||
ace_captives
|
||||
============
|
||||
|
||||
Allows taking people captive/handcuffed
|
||||
Adds ability to handcuff and surrender.
|
||||
|
||||
####Items:
|
||||
`ACE_CableTie` - adds ability to take someone captive
|
||||
#### Items Added:
|
||||
`ACE_CableTie`
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
@ -16,11 +16,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
|
||||
params ["_unit", "_target"];
|
||||
//Check sides, Player has cableTie, target is alive and not already handcuffed
|
||||
|
||||
(GVAR(allowHandcuffOwnSide) || {(side _unit) != (side _target)}) &&
|
||||
("ACE_CableTie" in (items _unit)) &&
|
||||
{alive _target} &&
|
||||
{!(_target getVariable [QGVAR(isHandcuffed), false])}
|
||||
{!(_target getVariable [QGVAR(isHandcuffed), false])} &&
|
||||
(GVAR(requireSurrender) == 0 || ((_target getVariable [QGVAR(isSurrendering), false]) || (currentWeapon _target == "" && GVAR(requireSurrender) == 2)))
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
|
||||
params ["_unit", "_target"];
|
||||
//Alive, handcuffed, not being escored, and not unconscious
|
||||
|
||||
(_target getVariable [QGVAR(isHandcuffed), false]) &&
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
params ["_unit", "_target"];
|
||||
|
||||
_target getVariable [QGVAR(isHandcuffed), false]
|
||||
|| {_target getVariable [QGVAR(isSurrendering), false]}
|
||||
|
@ -18,8 +18,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_objects"];
|
||||
|
||||
PARAMS_3(_unit,_target,_vehicle);
|
||||
params ["_unit", "_target","_vehicle"];
|
||||
|
||||
if (isNull _target) then {
|
||||
_objects = attachedObjects _unit;
|
||||
@ -28,7 +27,7 @@ if (isNull _target) 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;};
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
params ["_unit", "_target"];
|
||||
|
||||
//Unit is handcuffed and not currently being escorted
|
||||
_target getVariable [QGVAR(isHandcuffed), false] &&
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
DEFAULT_PARAM(1,_target,objNull);
|
||||
params ["_unit", ["_target", objNull]];
|
||||
|
||||
if (isNull _target) then {
|
||||
_target = _unit getVariable [QGVAR(escortedUnit), objNull];
|
||||
|
@ -16,12 +16,12 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_newSurrenderState);
|
||||
|
||||
private "_returnValue";
|
||||
|
||||
params ["_unit", "_newSurrenderState"];
|
||||
|
||||
_returnValue = if (_newSurrenderState) then {
|
||||
//no weapon equiped AND not currently surrendering and
|
||||
//no weapon equiped AND not currently surrendering and
|
||||
GVAR(allowSurrender) && {(currentWeapon _unit) == ""} && {!(_unit getVariable [QGVAR(isSurrendering), false])}
|
||||
} else {
|
||||
//is Surrendering
|
||||
|
@ -18,6 +18,6 @@
|
||||
|
||||
private ["_cargo"];
|
||||
|
||||
PARAMS_2(_player,_unit);
|
||||
params ["_player", "_unit"];
|
||||
|
||||
((vehicle _unit) != _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}
|
||||
|
@ -16,10 +16,11 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
|
||||
_unit removeItem "ACE_CableTie";
|
||||
params ["_unit", "_target"];
|
||||
|
||||
playSound3D [QUOTE(PATHTO_R(sounds\cable_tie_zipping.ogg)), objNull, false, (getPosASL _target), 1, 1, 10];
|
||||
|
||||
["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent);
|
||||
|
||||
_unit removeItem "ACE_CableTie";
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_unit,_target,_state);
|
||||
params ["_unit", "_target","_state"];
|
||||
|
||||
if (_state) then {
|
||||
if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {};
|
||||
|
@ -19,6 +19,7 @@
|
||||
private ["_weapon", "_listedItemClasses", "_actions", "_allGear"];
|
||||
|
||||
PARAMS_2(_player,_unit);
|
||||
params ["_player", "_unit"];
|
||||
|
||||
_weapon = currentWeapon _player;
|
||||
if (_weapon == primaryWeapon _player && {_weapon != ""}) then {
|
||||
|
@ -17,9 +17,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_unit,_target,_vehicle);
|
||||
private "_objects";
|
||||
|
||||
params ["_unit", "_target","_vehicle"];
|
||||
|
||||
if (isNull _target) then {
|
||||
_objects = attachedObjects _unit;
|
||||
_objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
|
||||
@ -28,7 +29,7 @@ if (isNull _target) then {
|
||||
if (isNull _target) exitWith {};
|
||||
|
||||
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 (isNull _vehicle) exitWith {};
|
||||
|
@ -15,6 +15,6 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
params ["_unit", "_target"];
|
||||
|
||||
["SetHandcuffed", [_target], [_target, false]] call EFUNC(common,targetEvent);
|
||||
|
@ -16,6 +16,6 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
params ["_unit", "_target"];
|
||||
|
||||
["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent);
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_vehicle,_dontcare,_unit);
|
||||
params ["_vehicle", "_dontcare","_unit"];
|
||||
|
||||
if (local _unit) then {
|
||||
if (_unit getVariable [QGVAR(isEscorting), false]) then {
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_vehicle,_dontcare,_unit);
|
||||
params ["_vehicle", "_dontcare","_unit"];
|
||||
|
||||
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
|
||||
private ["_cargoIndex"];
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_oldUnit);
|
||||
params ["_oldUnit"];
|
||||
|
||||
if (!local _oldUnit) exitWith {};
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_2_PVT(_this,_unit,_isUnconc);
|
||||
params ["_unit","_isUnconc"];
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_newUnit,_oldUnit);
|
||||
params ["_newUnit","_oldUnit"];
|
||||
|
||||
//set showHUD based on new unit status:
|
||||
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_dead);
|
||||
params ["_unit","_dead"];
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
|
||||
// prevent players from throwing grenades (added to all units)
|
||||
[_unit, "Throw", {((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}}, {}] call EFUNC(common,addActionEventhandler);
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_zeusIsOpen);
|
||||
params ["_unit","_zeusIsOpen"];
|
||||
|
||||
//set showHUD based on unit status:
|
||||
if (!_zeusIsOpen) then {
|
||||
|
@ -13,7 +13,8 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_logic);
|
||||
params ["_logic"];
|
||||
|
||||
[_logic, QGVAR(allowHandcuffOwnSide), "allowHandcuffOwnSide"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(allowSurrender), "allowSurrender"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(requireSurrender), "requireSurrender"] call EFUNC(common,readSettingFromModule);
|
||||
|
@ -17,9 +17,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
private ["_bisMouseOver", "_mouseOverObject"];
|
||||
|
||||
params ["_logic", "_units", "_activated"];
|
||||
|
||||
if (!_activated) exitWith {};
|
||||
|
||||
if (local _logic) then {
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_state);
|
||||
|
||||
params ["_unit","_state"];
|
||||
|
||||
if (!local _unit) exitwith {
|
||||
ERROR("running setHandcuffed on remote unit");
|
||||
@ -43,7 +42,7 @@ if (_state) then {
|
||||
|
||||
// fix anim on mission start (should work on dedicated servers)
|
||||
[{
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
|
||||
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_state);
|
||||
|
||||
params ["_unit","_state"];
|
||||
|
||||
if (!local _unit) exitwith {
|
||||
ERROR("running surrender on remote unit");
|
||||
|
@ -16,10 +16,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_target,_vehicle);
|
||||
|
||||
private ["_cargoIndex"];
|
||||
|
||||
params ["_target","_vehicle"];
|
||||
|
||||
_target moveInCargo _vehicle;
|
||||
_target assignAsCargo _vehicle;
|
||||
_cargoIndex = _vehicle getCargoIndex _target;
|
||||
|
@ -15,8 +15,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
|
||||
params ["_unit"];
|
||||
_unit setVariable [QGVAR(CargoIndex), -1, true];
|
||||
|
||||
moveOut _unit;
|
||||
|
@ -221,5 +221,21 @@
|
||||
<German>Spieler können kapitulieren, nachdem sie ihre Waffe geholstert haben</German>
|
||||
<Portuguese>Jogadores podem se render depois de guardar sua arma</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_name">
|
||||
<English>Require surrendering</English>
|
||||
<Polish>Wymagaj kapitulacji</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_description">
|
||||
<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 ID="STR_ACE_Captives_SurrenderOnly">
|
||||
<English>Surrendering only</English>
|
||||
<Polish>Tylko kapitulacja</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_SurrenderOrNoWeapon">
|
||||
<English>Surrendering or No weapon</English>
|
||||
<Polish>Kapitulacja lub brak broni</Polish>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
1
addons/cargo/$PBOPREFIX$
Normal file
1
addons/cargo/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\cargo
|
9
addons/cargo/ACE_Settings.hpp
Normal file
9
addons/cargo/ACE_Settings.hpp
Normal 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);
|
||||
};
|
||||
};
|
103
addons/cargo/CfgEventHandlers.hpp
Normal file
103
addons/cargo/CfgEventHandlers.hpp
Normal 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));
|
||||
};
|
||||
};
|
||||
};
|
294
addons/cargo/CfgVehicles.hpp
Normal file
294
addons/cargo/CfgVehicles.hpp
Normal 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
12
addons/cargo/README.md
Normal 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)
|
BIN
addons/cargo/UI/Icon_Module_Cargo_ca.paa
Normal file
BIN
addons/cargo/UI/Icon_Module_Cargo_ca.paa
Normal file
Binary file not shown.
BIN
addons/cargo/UI/Icon_load.paa
Normal file
BIN
addons/cargo/UI/Icon_load.paa
Normal file
Binary file not shown.
5
addons/cargo/XEH_postInit.sqf
Normal file
5
addons/cargo/XEH_postInit.sqf
Normal 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);
|
25
addons/cargo/XEH_preInit.sqf
Normal file
25
addons/cargo/XEH_preInit.sqf
Normal 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
18
addons/cargo/config.cpp
Normal 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"
|
38
addons/cargo/functions/fnc_addCargoItem.sqf
Normal file
38
addons/cargo/functions/fnc_addCargoItem.sqf
Normal 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);
|
||||
};
|
34
addons/cargo/functions/fnc_canLoad.sqf
Normal file
34
addons/cargo/functions/fnc_canLoad.sqf
Normal 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)
|
29
addons/cargo/functions/fnc_canLoadItemIn.sqf
Normal file
29
addons/cargo/functions/fnc_canLoadItemIn.sqf
Normal 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))}
|
44
addons/cargo/functions/fnc_canUnloadItem.sqf
Normal file
44
addons/cargo/functions/fnc_canUnloadItem.sqf
Normal 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)
|
37
addons/cargo/functions/fnc_findNearestVehicle.sqf
Normal file
37
addons/cargo/functions/fnc_findNearestVehicle.sqf
Normal 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
|
20
addons/cargo/functions/fnc_getCargoSpaceLeft.sqf
Normal file
20
addons/cargo/functions/fnc_getCargoSpaceLeft.sqf
Normal 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))]
|
28
addons/cargo/functions/fnc_getSizeItem.sqf
Normal file
28
addons/cargo/functions/fnc_getSizeItem.sqf
Normal 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
|
31
addons/cargo/functions/fnc_handleDestroyed.sqf
Normal file
31
addons/cargo/functions/fnc_handleDestroyed.sqf
Normal 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);
|
30
addons/cargo/functions/fnc_initObject.sqf
Normal file
30
addons/cargo/functions/fnc_initObject.sqf
Normal 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);
|
51
addons/cargo/functions/fnc_initVehicle.sqf
Normal file
51
addons/cargo/functions/fnc_initVehicle.sqf
Normal 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);
|
40
addons/cargo/functions/fnc_loadItem.sqf
Normal file
40
addons/cargo/functions/fnc_loadItem.sqf
Normal 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
|
28
addons/cargo/functions/fnc_moduleSettings.sqf
Normal file
28
addons/cargo/functions/fnc_moduleSettings.sqf
Normal 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.";
|
48
addons/cargo/functions/fnc_onMenuOpen.sqf
Normal file
48
addons/cargo/functions/fnc_onMenuOpen.sqf
Normal 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;
|
31
addons/cargo/functions/fnc_startLoadIn.sqf
Normal file
31
addons/cargo/functions/fnc_startLoadIn.sqf
Normal 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)
|
35
addons/cargo/functions/fnc_startUnload.sqf
Normal file
35
addons/cargo/functions/fnc_startUnload.sqf
Normal 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);
|
68
addons/cargo/functions/fnc_unloadItem.sqf
Normal file
68
addons/cargo/functions/fnc_unloadItem.sqf
Normal 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
|
38
addons/cargo/functions/fnc_validateCargoSpace.sqf
Normal file
38
addons/cargo/functions/fnc_validateCargoSpace.sqf
Normal 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];
|
1
addons/cargo/functions/script_component.hpp
Normal file
1
addons/cargo/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\cargo\script_component.hpp"
|
103
addons/cargo/menu.hpp
Normal file
103
addons/cargo/menu.hpp
Normal 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););
|
||||
};
|
||||
};
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user