mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into repairHitpointStrings
Conflicts: addons/repair/functions/fnc_addRepairActions.sqf
This commit is contained in:
commit
dc2e146e8b
@ -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>
|
||||
@ -68,8 +70,7 @@ Hamburger SV
|
||||
Harakhti <shadowdragonphd@gmail.com>
|
||||
havena <silveredenis@gmail.com>
|
||||
Hawkins
|
||||
Head
|
||||
jokoho482 <jokoho482@gmail.com>`
|
||||
Head <brobergsebastian@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,5 +108,3 @@ Valentin Torikian <valentin.torikian@gmail.com>
|
||||
VyMajoris(W-Cephei)<vycanismajoriscsa@gmail.com>
|
||||
Winter <simon@agius-muscat.net>
|
||||
zGuba
|
||||
Drill <drill87@gmail.com>
|
||||
MikeMatrix <m.braun92@gmail.com>
|
||||
|
@ -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;
|
||||
@ -53,39 +53,44 @@ if (!GVAR(simulateForEveryone) && !(local _unit)) then {
|
||||
if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; };
|
||||
|
||||
if (_abort || !(GVAR(extensionAvailable))) exitWith {
|
||||
if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then {
|
||||
EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")];
|
||||
};
|
||||
[_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;
|
||||
};
|
||||
};
|
||||
|
||||
@ -102,43 +107,22 @@ if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then {
|
||||
};
|
||||
};
|
||||
|
||||
_caliber = _AmmoCacheEntry select 1;
|
||||
_bulletLength = _AmmoCacheEntry select 2;
|
||||
_bulletMass = _AmmoCacheEntry select 3;
|
||||
_barrelTwist = _WeaponCacheEntry select 0;
|
||||
_stabilityFactor = 1.5;
|
||||
|
||||
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];
|
||||
|
||||
|
@ -4,6 +4,12 @@ class Extended_PreInit_EventHandlers {
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Killed_EventHandlers {
|
||||
class All {
|
||||
init = QUOTE(call FUNC(handleDestroyed));
|
||||
|
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);
|
@ -2,6 +2,7 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(addCargoItem);
|
||||
PREP(canLoad);
|
||||
PREP(canLoadItemIn);
|
||||
PREP(canUnloadItem);
|
||||
@ -21,8 +22,4 @@ PREP(validateCargoSpace);
|
||||
|
||||
GVAR(initializedItemClasses) = [];
|
||||
|
||||
if (isServer) then {
|
||||
["cargo_hideItem", {params ["_object", "_status"]; _object hideObjectGlobal _status;}] call EFUNC(common,addEventHandler);
|
||||
};
|
||||
|
||||
ADDON = true;
|
||||
|
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);
|
||||
};
|
@ -19,7 +19,7 @@ private "_config";
|
||||
|
||||
params ["_item"];
|
||||
|
||||
_config = (configFile >> "CfgVehicles" >> typeof _item >> QGVAR(size));
|
||||
_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
|
||||
|
||||
if (isNumber (_config)) exitWith {
|
||||
_item getVariable [QGVAR(size), getNumber (_config)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Initializes vehicle, adds open caro menu action if available.
|
||||
* Initializes vehicle, adds open cargo menu action if available.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
@ -25,20 +25,8 @@ _initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
|
||||
if (isServer) then {
|
||||
{
|
||||
if (isClass _x) then {
|
||||
private ["_className", "_amount","_position","_object"];
|
||||
_className = getText (_x >> "type");
|
||||
_amount = getNumber (_x >> "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 {
|
||||
_object = createVehicle [_className, _position, [], 0, "CAN_COLLIDE"];
|
||||
if !([_object, _vehicle] call FUNC(loadItem)) exitWith {
|
||||
deleteVehicle _object;
|
||||
};
|
||||
};
|
||||
["AddCargoByClass", [getText (_x >> "type"), _vehicle, getNumber (_x >> "amount")]] call EFUNC(common,localEvent);
|
||||
};
|
||||
nil
|
||||
} count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,9 @@ _vehicle setVariable [QGVAR(space), _space - _itemSize, true];
|
||||
|
||||
detach _item;
|
||||
_item attachTo [_vehicle,[0,0,100]];
|
||||
["cargo_hideItem", [_item, true]] call EFUNC(common,serverEvent);
|
||||
["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent);
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
|
||||
true
|
||||
|
@ -58,8 +58,11 @@ _vehicle setVariable [QGVAR(space), (_space + _itemSize), true];
|
||||
|
||||
detach _item;
|
||||
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
|
||||
["cargo_hideItem", [_item, false]] call EFUNC(common,serverEvent);
|
||||
["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
|
||||
|
@ -111,6 +111,7 @@ if(!isServer) then {
|
||||
if (isServer) then {
|
||||
[FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
call FUNC(checkFiles);
|
||||
|
||||
|
||||
@ -203,10 +204,11 @@ GVAR(OldCameraView) = cameraView;
|
||||
GVAR(OldPlayerVehicle) = vehicle ACE_player;
|
||||
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
||||
GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
||||
GVAR(OldVisibleMap) = false;
|
||||
|
||||
// PFH to raise varios events
|
||||
[{
|
||||
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen"];
|
||||
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen", "_newVisibleMap"];
|
||||
// "playerInventoryChanged" event
|
||||
_newPlayerInventory = [ACE_player] call FUNC(getAllGear);
|
||||
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
|
||||
@ -270,7 +272,15 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
||||
GVAR(OldPlayerWeapon) = _newPlayerWeapon;
|
||||
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
|
||||
// "visibleMapChanged" event
|
||||
_newVisibleMap = visibleMap;
|
||||
if (!_newVisibleMap isEqualTo GVAR(OldVisibleMap)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldVisibleMap) = _newVisibleMap;
|
||||
["visibleMapChanged", [ACE_player, _newVisibleMap]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// by PabstMirror, commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
[{_this call DFUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler);
|
||||
[DFUNC(handleScrollWheel)] call EFUNC(common,addScrollWheelEventHandler);
|
||||
|
||||
if (isNil "ACE_maxWeightDrag") then {
|
||||
ACE_maxWeightDrag = 800;
|
||||
@ -15,11 +15,11 @@ if (isNil "ACE_maxWeightCarry") then {
|
||||
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||
|
||||
// release object on player change. This does work when returning to lobby, but not when hard disconnecting.
|
||||
["playerChanged", {_this call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
|
||||
["playerChanged", DFUNC(handlePlayerChanged)] call EFUNC(common,addEventhandler);
|
||||
["playerVehicleChanged", {[ACE_player, objNull] call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
|
||||
["playerWeaponChanged", {_this call DFUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler);
|
||||
["playerWeaponChanged", DFUNC(handlePlayerWeaponChanged)] call EFUNC(common,addEventhandler);
|
||||
|
||||
// handle waking up dragged unit and falling unconscious while dragging
|
||||
["medical_onUnconscious", {_this call DFUNC(handleUnconscious)}] call EFUNC(common,addEventhandler);
|
||||
["medical_onUnconscious", DFUNC(handleUnconscious)] call EFUNC(common,addEventhandler);
|
||||
|
||||
//@todo Captivity?
|
||||
|
@ -2,4 +2,4 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
// release object on hard disconnection. Function is identical to killed
|
||||
addMissionEventHandler ["HandleDisconnect", {_this call DFUNC(handleKilled)}];
|
||||
addMissionEventHandler ["HandleDisconnect", DFUNC(handleKilled)];
|
||||
|
@ -3,19 +3,18 @@
|
||||
*
|
||||
* Check if unit can carry the object. Doesn't check weight.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the carrying (Object)
|
||||
* 1: Object to carry (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that should do the carrying <OBJECT>
|
||||
* 1: Object to carry <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Can the unit carry the object? (Bool)
|
||||
* Return Value:
|
||||
* Can the unit carry the object? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
params ["_unit", "_target"];
|
||||
|
||||
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
|
@ -3,12 +3,14 @@
|
||||
*
|
||||
* Check if unit can drag the object. Doesn't check weight.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the dragging (Object)
|
||||
* 1: Object to drag (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that should do the dragging <OBJECT>
|
||||
* 1: Object to drag <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Can the unit drag the object? (Bool)
|
||||
* Return Value:
|
||||
* Can the unit drag the object? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -22,4 +24,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// a static weapon has to be empty for dragging
|
||||
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
|
||||
|
||||
alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})};
|
||||
alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})};
|
||||
|
@ -3,19 +3,18 @@
|
||||
*
|
||||
* Check if unit can drop the object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that currently drags a object (Object)
|
||||
* 1: Object that is dragged (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that currently drags a object <OBJECT>
|
||||
* 1: Object that is dragged <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Can the unit drop the object? (Bool)
|
||||
* Return Value:
|
||||
* Can the unit drop the object? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
params ["_unit", "_target"];
|
||||
|
||||
if !([_unit, _target, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
|
@ -3,19 +3,18 @@
|
||||
*
|
||||
* Check if unit can drop the carried object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that currently carries a object (Object)
|
||||
* 1: Object that is carried (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that currently carries a object <OBJECT>
|
||||
* 1: Object that is carried <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Can the unit drop the object? (Bool)
|
||||
* Return Value:
|
||||
* Can the unit drop the object? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
params ["_unit", "_target"];
|
||||
|
||||
if !([_unit, _target, ["isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
|
@ -3,19 +3,18 @@
|
||||
*
|
||||
* Carry an object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the carrying (Object)
|
||||
* 1: Object to carry (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that should do the carrying <OBJECT>
|
||||
* 1: Object to carry <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
params ["_unit", "_target"];
|
||||
|
||||
// get attachTo offset and direction.
|
||||
private ["_position", "_direction"];
|
||||
|
@ -1,21 +1,31 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* PFH for Carry Object
|
||||
*
|
||||
* Arguments:
|
||||
* ?
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_DRAGGING
|
||||
systemChat format ["%1 carryObjectPFH running", ACE_time];
|
||||
#endif
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0 select 0;
|
||||
_target = _this select 0 select 1;
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_unit","_target"];
|
||||
|
||||
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
// drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled))
|
||||
if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then {
|
||||
[_unit, _target] call FUNC(dropObject_carry);
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
@ -3,28 +3,25 @@
|
||||
*
|
||||
* Drag an object. Called from ace_dragging_fnc_startDrag
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the dragging (Object)
|
||||
* 1: Object to drag (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that should do the dragging <OBJECT>
|
||||
* 1: Object to drag <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
private ["_position", "_direction", "_offset", "_actionID"];
|
||||
params ["_unit", "_target"];
|
||||
|
||||
// get attachTo offset and direction.
|
||||
private ["_position", "_direction"];
|
||||
|
||||
_position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]];
|
||||
_direction = _target getVariable [QGVAR(dragDirection), 0];
|
||||
|
||||
// add height offset of model
|
||||
private "_offset";
|
||||
_offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);
|
||||
|
||||
_position = _position vectorAdd [0, 0, _offset];
|
||||
@ -41,7 +38,6 @@ _unit setVariable [QGVAR(isDragging), true, true];
|
||||
_unit setVariable [QGVAR(draggedObject), _target, true];
|
||||
|
||||
// add scrollwheel action to release object
|
||||
private "_actionID";
|
||||
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
|
||||
|
||||
if (_actionID != -1) then {
|
||||
|
@ -1,21 +1,31 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* PFH for Drag Object
|
||||
*
|
||||
* Arguments:
|
||||
* ?
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_DRAGGING
|
||||
systemChat format ["%1 dragObjectPFH running", ACE_time];
|
||||
#endif
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0 select 0;
|
||||
_target = _this select 0 select 1;
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_unit", "_target"];
|
||||
|
||||
if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
// drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled))
|
||||
if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then {
|
||||
[_unit, _target] call FUNC(dropObject);
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
@ -3,19 +3,18 @@
|
||||
*
|
||||
* Drop a dragged object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that drags the other object (Object)
|
||||
* 1: Dragged object to drop (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that drags the other object <OBJECT>
|
||||
* 1: Dragged object to drop <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
params ["_unit", "_target"];
|
||||
|
||||
// remove scroll wheel action
|
||||
_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]);
|
||||
|
@ -3,19 +3,18 @@
|
||||
*
|
||||
* Drop a carried object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that carries the other object (Object)
|
||||
* 1: Carried object to drop (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that carries the other object <OBJECT>
|
||||
* 1: Carried object to drop <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
params ["_unit", "_target"];
|
||||
|
||||
// remove scroll wheel action
|
||||
_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]);
|
||||
|
@ -1,54 +1,45 @@
|
||||
/*
|
||||
Name: AGM_Drag_fnc_GetWeight
|
||||
|
||||
Author(s):
|
||||
L-H, edited by commy2
|
||||
|
||||
Description:
|
||||
Returns the weight of a crate.
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - Crate to get weight of
|
||||
|
||||
Returns:
|
||||
NUMBER - Weight
|
||||
|
||||
Example:
|
||||
_weight = Crate1 call AGM_Drag_fnc_GetWeight;
|
||||
* Author: L-H, edited by commy2, rewritten by joko // Jonas
|
||||
*
|
||||
* Returns the weight of a crate.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Crate to get weight of <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Total Weight <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* _weight = Crate1 call ace_dragging_fnc_getweight;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_object";
|
||||
|
||||
_object = _this select 0;
|
||||
|
||||
private ["_totalWeight", "_fnc","_fnc_Extra"];
|
||||
private "_totalWeight";
|
||||
params ["_object"];
|
||||
// Initialize the total weight.
|
||||
_totalWeight = 0;
|
||||
_fnc_Extra = {
|
||||
private ["_weight", "_items"];
|
||||
_items = _this select 0;
|
||||
_weight = 0;
|
||||
{
|
||||
_weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> (_this select 2) >> "mass") * ((_items select 1) select _foreachIndex));
|
||||
} foreach (_items select 0);
|
||||
|
||||
_weight
|
||||
};
|
||||
_fnc = {
|
||||
private ["_weight", "_items"];
|
||||
_items = _this select 0;
|
||||
_weight = 0;
|
||||
{
|
||||
_weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> "mass") * ((_items select 1) select _foreachIndex));
|
||||
} foreach (_items select 0);
|
||||
|
||||
_weight
|
||||
};
|
||||
_totalWeight = ([getMagazineCargo _object, "CfgMagazines"] call _fnc);
|
||||
_totalWeight = _totalWeight + ([getItemCargo _object, "CfgWeapons", "ItemInfo"] call _fnc_Extra);
|
||||
_totalWeight = _totalWeight + ([getWeaponCargo _object, "CfgWeapons", "WeaponSlotsInfo"] call _fnc_Extra);
|
||||
_totalWeight = _totalWeight + ([getBackpackCargo _object, "CfgVehicles"] call _fnc);
|
||||
|
||||
_totalWeight = _totalWeight * 0.5; // Mass in Arma isn't an exact amount but rather a volume/weight value. This attempts to work around that by making it a usable value. (sort of).
|
||||
// Cycle through all item types with their assigned config paths.
|
||||
{
|
||||
_x params["_items","_getConfigCode"];
|
||||
_items params ["_item", "_count"];
|
||||
// Cycle through all items and read their mass out of the config.
|
||||
{
|
||||
// Multiply mass with amount of items and add the mass to the total weight.
|
||||
_totalWeight = _totalWeight + (getNumber ((call _getConfigCode) >> "mass") * (_count select _forEachIndex));
|
||||
} forEach _item;
|
||||
true
|
||||
} count [
|
||||
[getMagazineCargo _object, {configFile >> "CfgMagazines" >> _x}],
|
||||
[getBackpackCargo _object, {configFile >> "CfgVehicles" >> _x}],
|
||||
[getItemCargo _object, {configFile >> "CfgWeapons" >> _x >> "ItemInfo"}],
|
||||
[getWeaponCargo _object, {configFile >> "CfgWeapons" >> _x >> "WeaponSlotsInfo"}]
|
||||
];
|
||||
|
||||
_totalWeight
|
||||
// add Weight of create to totalWeight
|
||||
_totalWeight = _totalWeight + (getNumber (configFile >> "CfgVehicles" >> typeof _object >> "mass"));
|
||||
|
||||
// Mass in Arma isn't an exact amount but rather a volume/weight value. This attempts to work around that by making it a usable value. (sort of).
|
||||
_totalWeight * 0.5
|
||||
|
@ -1,4 +1,20 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Handle the animaion for a Unit for Dragging Module
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: animaion <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit, "amovpercmstpsnonwnondnon"] call ace_dragging_fnc_handleAnimChanged;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_anim"];
|
||||
|
@ -1,9 +1,22 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Handle death of the dragger
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit] call ace_dragging_fnc_handleKilled;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_unit";
|
||||
|
||||
_unit = _this select 0;
|
||||
params ["_unit"];
|
||||
|
||||
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||
private "_draggedObject";
|
||||
|
@ -1,10 +1,23 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Handle player changes.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: New Player Unit <OBJECT>
|
||||
* 1: Old Player Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unitNew, _unitOld] call ace_dragging_fnc_handlePlayerChanged;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_newPlayer", "_oldPlayer"];
|
||||
|
||||
_newPlayer = _this select 0;
|
||||
_oldPlayer = _this select 1;
|
||||
params ["_newPlayer", "_oldPlayer"];
|
||||
|
||||
{
|
||||
if (_x getVariable [QGVAR(isDragging), false]) then {
|
||||
|
@ -1,10 +1,23 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Handle the Weapon Changed Event
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Weapon <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit, _currentWeapon] call ace_dragging_fnc_handlePlayerWeaponChanged;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_weapon"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_weapon = _this select 1;
|
||||
params ["_unit", "_weapon"];
|
||||
|
||||
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||
|
||||
|
@ -3,38 +3,38 @@
|
||||
*
|
||||
* Handles raising and lowering the dragged weapon to be able to place it on top of objects.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Scroll amount (Number)
|
||||
* Arguments:
|
||||
* 0: Scroll amount <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* Handled or not. (Bool)
|
||||
* Return Value:
|
||||
* Handled or not. <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// requires modifier key to be hold down
|
||||
if (GETMVAR(ACE_Modifier,0) == 0) exitWith {false};
|
||||
private ["_unit", "_carriedItem", "_position", "_maxHeight"];
|
||||
|
||||
params ["_scrollAmount"];
|
||||
|
||||
// requires modifier key to be hold down
|
||||
if (missionNamespace getVariable ["ACE_Modifier", 0] == 0) exitWith {false};
|
||||
|
||||
private "_unit";
|
||||
_unit = ACE_player;
|
||||
|
||||
// EH is always assigned. Exit and don't overwrite input if not carrying
|
||||
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false};
|
||||
|
||||
private "_scrollAmount";
|
||||
|
||||
_scrollAmount = _this select 0;
|
||||
|
||||
// move carried item 15 cm per scroll interval
|
||||
_scrollAmount = _scrollAmount * 0.15;
|
||||
|
||||
private "_carriedItem";
|
||||
_carriedItem = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
//disabled for persons
|
||||
if (_carriedItem isKindOf "CAManBase") exitWith {false};
|
||||
|
||||
private ["_position", "_maxHeight"];
|
||||
|
||||
_position = getPosATL _carriedItem;
|
||||
_maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2;
|
||||
|
||||
|
@ -1,17 +1,29 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Handle the Unconscious of a Unit while Dragging
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit] call ace_dragging_fnc_handleUnconscious;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_isUnconscious"];
|
||||
private ["_player", "_draggedObject", "_carriedObject"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_isUnconscious = _this select 1;
|
||||
params ["_unit"];
|
||||
|
||||
private "_player";
|
||||
_player = ACE_player;
|
||||
|
||||
if (_player getVariable [QGVAR(isDragging), false]) then {
|
||||
|
||||
private "_draggedObject";
|
||||
_draggedObject = _player getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
// handle falling unconscious
|
||||
@ -28,7 +40,6 @@ if (_player getVariable [QGVAR(isDragging), false]) then {
|
||||
|
||||
if (_player getVariable [QGVAR(isCarrying), false]) then {
|
||||
|
||||
private "_carriedObject";
|
||||
_carriedObject = _player getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
// handle falling unconscious
|
||||
|
@ -4,23 +4,22 @@
|
||||
* Initialize variables for drag or carryable objects. Called from init EH.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Any object (Object)
|
||||
* 0: Any object <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_object";
|
||||
private ["_position", "_direction", "_config"];
|
||||
|
||||
_object = _this select 0;
|
||||
params ["_object"];
|
||||
|
||||
private "_config";
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _object;
|
||||
|
||||
if (getNumber (_config >> QGVAR(canDrag)) == 1) then {
|
||||
private ["_position", "_direction"];
|
||||
|
||||
_position = getArray (_config >> QGVAR(dragPosition));
|
||||
_direction = getNumber (_config >> QGVAR(dragDirection));
|
||||
|
||||
@ -28,8 +27,6 @@ if (getNumber (_config >> QGVAR(canDrag)) == 1) then {
|
||||
};
|
||||
|
||||
if (getNumber (_config >> QGVAR(canCarry)) == 1) then {
|
||||
private ["_position", "_direction"];
|
||||
|
||||
_position = getArray (_config >> QGVAR(carryPosition));
|
||||
_direction = getNumber (_config >> QGVAR(carryDirection));
|
||||
|
||||
|
@ -4,16 +4,16 @@
|
||||
* Initialize variables for drag or carryable persons. Called from init EH.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Any Unit (Object)
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_unit";
|
||||
|
||||
_unit = _this select 0;
|
||||
params ["_unit"];
|
||||
|
||||
[_unit, true, [0,1.1,0.092], 180] call FUNC(setDraggable);
|
||||
[_unit, true, [0.4,-0.1,-1.25], 195] call FUNC(setCarryable); // hard-coded selection: "LeftShoulder"
|
||||
|
@ -1,6 +1,16 @@
|
||||
// by commy2
|
||||
|
||||
private "_object";
|
||||
_object = _this select 0;
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Check if Object is Overlapping
|
||||
*
|
||||
* Argument:
|
||||
* 0: Object <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
params ["_object"];
|
||||
|
||||
(getPosATL _object select 2) - (getPos _object select 2) > 1E-5
|
||||
|
@ -4,25 +4,21 @@
|
||||
* Enable the object to be carried.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Any object (Object)
|
||||
* 1: true to enable carrying, false to disable (Bool)
|
||||
* 2: Position offset for attachTo command (Array, optinal; default: [0,1,1])
|
||||
* 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0)
|
||||
* 0: Any object <OBJECT>
|
||||
* 1: true to enable carrying, false to disable <BOOL>
|
||||
* 2: Position offset for attachTo command <ARRAY> (default: [0,1,1])
|
||||
* 3: Direction in degree to rotate the object after attachTo <NUMBER> (default: 0)
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_carryAction", "_dropAction", "_object", "_enableCarry", "_position", "_direction"];
|
||||
//IGNORE_PRIVATE_WARNING("_player", "_target");
|
||||
private ["_carryAction", "_dropAction", "_type", "_initializedClasses"];
|
||||
|
||||
_this resize 4;
|
||||
|
||||
_object = _this select 0;
|
||||
_enableCarry = _this select 1;
|
||||
_position = _this select 2;
|
||||
_direction = _this select 3;
|
||||
params ["_object", "_enableCarry", "_position", "_direction"];
|
||||
|
||||
if (isNil "_position") then {
|
||||
_position = _object getVariable [QGVAR(carryPosition), [0,1,1]];
|
||||
@ -38,8 +34,6 @@ _object setVariable [QGVAR(carryPosition), _position];
|
||||
_object setVariable [QGVAR(carryDirection), _direction];
|
||||
|
||||
// add action to class if it is not already present
|
||||
private ["_type", "_initializedClasses"];
|
||||
|
||||
_type = typeOf _object;
|
||||
_initializedClasses = GETGVAR(initializedClasses_carry,[]);
|
||||
|
||||
|
@ -10,19 +10,15 @@
|
||||
* 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0)
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_dragAction", "_dropAction", "_object", "_enableDrag", "_position", "_direction"];
|
||||
private ["_dragAction", "_dropAction", "_type", "_initializedClasses"];
|
||||
//IGNORE_PRIVATE_WARNING("_player", "_target");
|
||||
|
||||
_this resize 4;
|
||||
|
||||
_object = _this select 0;
|
||||
_enableDrag = _this select 1;
|
||||
_position = _this select 2;
|
||||
_direction = _this select 3;
|
||||
params ["_object", "_enableDrag", "_position", "_direction"];
|
||||
|
||||
if (isNil "_position") then {
|
||||
_position = _object getVariable [QGVAR(dragPosition), [0,0,0]];
|
||||
@ -38,8 +34,6 @@ _object setVariable [QGVAR(dragPosition), _position];
|
||||
_object setVariable [QGVAR(dragDirection), _direction];
|
||||
|
||||
// add action to class if it is not already present
|
||||
private ["_type", "_initializedClasses"];
|
||||
|
||||
_type = typeOf _object;
|
||||
_initializedClasses = GETGVAR(initializedClasses,[]);
|
||||
|
||||
|
@ -3,29 +3,28 @@
|
||||
*
|
||||
* Start the carrying process.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the carrying (Object)
|
||||
* 1: Object to carry (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that should do the carrying <OBJECT>
|
||||
* 1: Object to carry <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
private ["_weight", "_timer"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
params ["_unit", "_target"];
|
||||
|
||||
// check weight
|
||||
private "_weight";
|
||||
_weight = [_target] call FUNC(getWeight);
|
||||
|
||||
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
|
||||
if (_weight > missionNamespace getVariable ["ACE_maxWeightCarry", 1E11]) exitWith {
|
||||
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
private "_timer";
|
||||
_timer = ACE_time + 5;
|
||||
|
||||
// handle objects vs persons
|
||||
|
@ -1,25 +1,34 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Carry PFH
|
||||
*
|
||||
* Arguments:
|
||||
* ?
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_DRAGGING
|
||||
systemChat format ["%1 startCarryPFH running", ACE_time];
|
||||
#endif
|
||||
|
||||
private ["_unit", "_target", "_timeOut"];
|
||||
|
||||
_unit = _this select 0 select 0;
|
||||
_target = _this select 0 select 1;
|
||||
_timeOut = _this select 0 select 2;
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_unit", "_target", "_timeOut"];
|
||||
|
||||
// handle aborting carry
|
||||
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
// same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled))
|
||||
if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then {
|
||||
[_unit, _target] call FUNC(dropObject);
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
// handle persons vs objects
|
||||
@ -27,11 +36,11 @@ if (_target isKindOf "CAManBase") then {
|
||||
if (ACE_time > _timeOut) exitWith {
|
||||
[_unit, _target] call FUNC(carryObject);
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
} else {
|
||||
if (ACE_time > _timeOut) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
// drop if in timeout
|
||||
private "_draggedObject";
|
||||
@ -43,7 +52,7 @@ if (_target isKindOf "CAManBase") then {
|
||||
if (stance _unit == "STAND") exitWith {
|
||||
[_unit, _target] call FUNC(carryObject);
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -4,24 +4,21 @@
|
||||
* Start the dragging process.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the dragging (Object)
|
||||
* 1: Object to drag (Object)
|
||||
* 0: Unit that should do the dragging <OBJECT>
|
||||
* 1: Object to drag <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
params ["_unit", "_target"];
|
||||
|
||||
// check weight
|
||||
private "_weight";
|
||||
_weight = [_target] call FUNC(getWeight);
|
||||
|
||||
if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith {
|
||||
if (_weight > missionNamespace getVariable ["ACE_maxWeightDrag", 1E11]) exitWith {
|
||||
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
|
@ -1,30 +1,39 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Drag PFH
|
||||
*
|
||||
* Arguments:
|
||||
* ?
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_DRAGGING
|
||||
systemChat format ["%1 startDragPFH running", ACE_time];
|
||||
#endif
|
||||
|
||||
private ["_unit", "_target", "_timeOut"];
|
||||
|
||||
_unit = _this select 0 select 0;
|
||||
_target = _this select 0 select 1;
|
||||
_timeOut = _this select 0 select 2;
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_unit", "_target", "_timeOut"];
|
||||
|
||||
// handle aborting drag
|
||||
if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
// same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled))
|
||||
if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then {
|
||||
[_unit, _target] call FUNC(dropObject);
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
// timeout. Do nothing. Quit. ACE_time, because anim length is linked to ingame ACE_time.
|
||||
if (ACE_time > _timeOut) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
// drop if in timeout
|
||||
private "_draggedObject";
|
||||
@ -36,5 +45,5 @@ if (ACE_time > _timeOut) exitWith {
|
||||
if (animationState _unit in DRAG_ANIMATIONS) exitWith {
|
||||
[_unit, _target] call FUNC(dragObject);
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
class ACE_Triggers {
|
||||
/* onPlace parameters:
|
||||
/* onPlace parameters:
|
||||
0: OBJECT - unit placing
|
||||
1: OBJECT - Placed explosive
|
||||
2: STRING - Magazine classname
|
||||
@ -7,46 +7,54 @@ class ACE_Triggers {
|
||||
Last Index: ACE_Triggers config of trigger type.
|
||||
onSetup parameters:
|
||||
0: STRING - Magazine Classname
|
||||
*/
|
||||
*/
|
||||
class Command {
|
||||
isAttachable = 1;
|
||||
displayName = CSTRING(clacker_displayName);
|
||||
picture = PATHTOF(Data\UI\Clacker.paa);
|
||||
onPlace = QUOTE(_this call FUNC(AddClacker);false);
|
||||
requires[] = {"ACE_Clacker"};
|
||||
};
|
||||
class MK16_Transmitter:Command {
|
||||
isAttachable = 1;
|
||||
displayName = CSTRING(MK16_displayName);
|
||||
picture = PATHTOF(Data\UI\MK16_Reciever_ca.paa);
|
||||
requires[] = {"ACE_M26_Clacker"};
|
||||
};
|
||||
class DeadManSwitch:Command {
|
||||
isAttachable = 1;
|
||||
displayName = CSTRING(DeadManSwitch_displayName);
|
||||
picture = PATHTOF(Data\UI\DeadmanSwitch.paa);
|
||||
requires[] = {"ACE_DeadManSwitch"};
|
||||
};
|
||||
class Cellphone:Command {
|
||||
isAttachable = 1;
|
||||
displayName = CSTRING(cellphone_displayName);
|
||||
picture = PATHTOF(Data\UI\Cellphone_UI.paa);
|
||||
onPlace = QUOTE(_this call FUNC(addCellphoneIED);false);
|
||||
requires[] = {"ACE_Cellphone"};
|
||||
};
|
||||
class PressurePlate {
|
||||
isAttachable = 0;
|
||||
displayName = CSTRING(PressurePlate);
|
||||
picture = PATHTOF(Data\UI\PressurePlate.paa);
|
||||
onPlace = "_dist=GetNumber(ConfigFile >> 'CfgMagazines' >> (_this select 2) >> 'ACE_Triggers' >> 'PressurePlate' >> 'digDistance');_ex=_this select 1;_ex setPosATL ((getPosATL _ex) vectorDiff ((VectorUp _ex) vectorCrossProduct [0,0,_dist]));false";
|
||||
onPlace = QUOTE(false);
|
||||
};
|
||||
class IRSensor {
|
||||
isAttachable = 0;
|
||||
displayName = CSTRING(IRSensor);
|
||||
picture = PATHTOF(Data\UI\PressurePlate.paa);
|
||||
onPlace = "false";
|
||||
};
|
||||
class Timer {
|
||||
isAttachable = 1;
|
||||
displayName = CSTRING(timerName);
|
||||
picture = PATHTOF(data\UI\Timer.paa);
|
||||
onPlace = QUOTE([ARR_2(_this select 1,(_this select 3) select 0)] call FUNC(startTimer);false);
|
||||
onSetup = QUOTE(_this call FUNC(openTimerSetUI);true);
|
||||
};
|
||||
class Tripwire {
|
||||
isAttachable = 0;
|
||||
displayName = CSTRING(TripWire);
|
||||
picture = PATHTOF(Data\UI\Tripwire.paa);
|
||||
onPlace = "false";
|
||||
|
@ -11,7 +11,7 @@ class Extended_PostInit_EventHandlers {
|
||||
|
||||
class Extended_Killed_EventHandlers {
|
||||
class CAManBase {
|
||||
GVAR(killedHandler) = QUOTE(_this call FUNC(onKilled));
|
||||
GVAR(killedHandler) = QUOTE(_this call FUNC(onIncapacitated));
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,7 @@ class CfgMagazines {
|
||||
class ACE_Triggers {
|
||||
SupportedTriggers[] = {"PressurePlate"};
|
||||
class PressurePlate {
|
||||
digDistance = 0.1;
|
||||
digDistance = 0.06;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -17,7 +17,7 @@ class CfgMagazines {
|
||||
class ACE_Triggers {
|
||||
SupportedTriggers[] = {"PressurePlate"};
|
||||
class PressurePlate {
|
||||
digDistance = 0.075;
|
||||
digDistance = 0.08;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -26,7 +26,7 @@ class CfgMagazines {
|
||||
class ACE_Triggers {
|
||||
SupportedTriggers[] = {"PressurePlate"};
|
||||
class PressurePlate {
|
||||
digDistance = 0.05;
|
||||
digDistance = 0.02;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -96,7 +96,7 @@ class CfgMagazines {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class IEDUrbanBig_Remote_Mag: DemoCharge_Remote_Mag {
|
||||
ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanBig";
|
||||
class ACE_Triggers {
|
||||
@ -113,9 +113,9 @@ class CfgMagazines {
|
||||
ammo = "IEDUrbanBig_Range_Ammo";
|
||||
pitch = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag {
|
||||
ACE_SetupObject = "ACE_Explosives_Place_IEDLandBig";
|
||||
class ACE_Triggers: ACE_Triggers {
|
||||
|
30
addons/explosives/GUI_VirtualAmmo.hpp
Normal file
30
addons/explosives/GUI_VirtualAmmo.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
class RscTitles {
|
||||
class GVAR(virtualAmmo) {
|
||||
idd = -1;
|
||||
movingEnable = 1;
|
||||
duration = 9999999;
|
||||
fadein = 0;
|
||||
fadeout = 0;
|
||||
onLoad = "uiNamespace setVariable ['ACE_explosives_virtualAmmoDisplay', (_this select 0)];";
|
||||
class controls {};
|
||||
class objects {
|
||||
class TheObject {
|
||||
idc = 800851;
|
||||
type = 82;
|
||||
model = "\a3\weapons_f\Ammo\Handgrenade.p3d"; //dummy value, cannot be "" !!!
|
||||
scale = 1;
|
||||
direction[] = {0, 0, 1};
|
||||
up[] = {0, 1, 0};
|
||||
x = 0.5;
|
||||
y = 0.5;
|
||||
z = 1;
|
||||
xBack = 0.5;
|
||||
yBack = 0.5;
|
||||
zBack = 0.5;
|
||||
inBack = 0;
|
||||
enableZoom = 0;
|
||||
zoomDuration = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -15,20 +15,37 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if !(hasInterface) exitWith {};
|
||||
//Event for setting explosive placement angle/pitch:
|
||||
[QGVAR(place), {_this call FUNC(setPosition)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
["interactMenuOpened", {_this call FUNC(interactEH)}] call EFUNC(common,addEventHandler);
|
||||
//When getting knocked out in medical, trigger deadman explosives:
|
||||
//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious)
|
||||
if (isServer) then {
|
||||
["medical_onUnconscious", {
|
||||
params ["_unit", "_isUnconscious"];
|
||||
if (!_isUnconscious) exitWith {};
|
||||
TRACE_1("Knocked Out, Doing Deadman", _unit);
|
||||
[_unit] call FUNC(onIncapacitated);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
};
|
||||
|
||||
if !(hasInterface) exitWith {};
|
||||
|
||||
GVAR(PlacedCount) = 0;
|
||||
GVAR(Setup) = objNull;
|
||||
GVAR(pfeh_running) = false;
|
||||
GVAR(CurrentSpeedDial) = 0;
|
||||
|
||||
//Cancel placement if interact menu opened
|
||||
|
||||
["interactMenuOpened", {
|
||||
if (GVAR(pfeh_running) && {!isNull (GVAR(Setup))}) then {
|
||||
call FUNC(place_Cancel)
|
||||
//Cancel placement if interact menu opened
|
||||
if (GVAR(pfeh_running)) then {
|
||||
GVAR(placeAction) = PLACE_CANCEL;
|
||||
};
|
||||
|
||||
//Show defuse actions on cfgAmmos (allMines):
|
||||
_this call FUNC(interactEH);
|
||||
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler);
|
||||
[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(common,addScrollWheelEventHandler);
|
||||
|
@ -44,15 +44,11 @@ PREP(getSpeedDialExplosive);
|
||||
|
||||
PREP(module);
|
||||
|
||||
PREP(onIncapacitated);
|
||||
PREP(onInventoryChanged);
|
||||
PREP(onKilled);
|
||||
PREP(onLanded);
|
||||
|
||||
PREP(openTimerSetUI);
|
||||
|
||||
PREP(place_Approve);
|
||||
PREP(place_Cancel);
|
||||
|
||||
PREP(placeExplosive);
|
||||
PREP(removeFromSpeedDial);
|
||||
|
||||
|
@ -12,6 +12,8 @@ class CfgPatches {
|
||||
};
|
||||
};
|
||||
|
||||
#include "ACE_Settings.hpp"
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
|
||||
#include "CfgAmmo.hpp"
|
||||
@ -21,6 +23,7 @@ class CfgPatches {
|
||||
|
||||
#include "ACE_Triggers.hpp"
|
||||
#include "ExplosivesUI.hpp"
|
||||
#include "GUI_VirtualAmmo.hpp"
|
||||
|
||||
class CfgActions {
|
||||
class None;
|
||||
@ -39,5 +42,3 @@ class CfgMineTriggers {
|
||||
mineTriggerRange = 1;
|
||||
};
|
||||
};
|
||||
|
||||
#include "ACE_Settings.hpp"
|
||||
|
@ -18,7 +18,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_4_PVT(_this,_unit,_explosive,_magazineClass,_extra);
|
||||
params ["_unit", "_explosive", "_magazineClass", "_extra"];
|
||||
TRACE_4("params",_unit,_explosive,_magazineClass,_extra);
|
||||
|
||||
private["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"];
|
||||
|
||||
@ -50,6 +51,9 @@ if (isNil QGVAR(CellphoneIEDs)) then {
|
||||
_count = GVAR(CellphoneIEDs) pushBack [_explosive,_code,GetNumber(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> "Cellphone" >> "FuseTime")];
|
||||
_count = _count + 1;
|
||||
publicVariable QGVAR(CellphoneIEDs);
|
||||
_unit sideChat format ["IED %1 code: %2", _count,_code];
|
||||
|
||||
//display IED number message:
|
||||
[format ["IED %1 code: %2", _count,_code]] call EFUNC(common,displayTextStructured);
|
||||
|
||||
if !(_hasRequired) exitWith {};
|
||||
[format ["IED %1", _count],_code] call FUNC(addToSpeedDial);
|
||||
|
@ -17,8 +17,12 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_explosive", "_magazineClass"];
|
||||
TRACE_3("params",_unit,_explosive,_magazineClass);
|
||||
|
||||
private ["_clacker", "_config", "_requiredItems", "_hasRequired", "_detonators"];
|
||||
EXPLODE_3_PVT(_this,_unit,_explosive,_magazineClass);
|
||||
|
||||
// Config is the last item in the list of passed in items.
|
||||
_config = (_this select 3) select (count (_this select 3) - 1);
|
||||
|
||||
@ -41,4 +45,6 @@ _clacker pushBack [_explosive, getNumber(_config >> "FuseTime"), format [localiz
|
||||
GVAR(PlacedCount)], _magazineClass, configName ((_this select 3) select (count (_this select 3) - 1))];
|
||||
|
||||
_unit setVariable [QGVAR(Clackers), _clacker, true];
|
||||
_unit sideChat format [localize LSTRING(DetonateCode), GVAR(PlacedCount)];
|
||||
|
||||
//display clacker code message:
|
||||
[format [localize LSTRING(DetonateCode), GVAR(PlacedCount)]] call EFUNC(common,displayTextStructured);
|
||||
|
@ -15,10 +15,13 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_detonator"];
|
||||
TRACE_2("params",_unit,_detonator);
|
||||
|
||||
private ["_result", "_item", "_children", "_range", "_required"];
|
||||
|
||||
EXPLODE_2_PVT(_this,_unit,_detonator);
|
||||
_range = GetNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range");
|
||||
_range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range");
|
||||
|
||||
_result = [_unit] call FUNC(getPlacedExplosives);
|
||||
_children = [];
|
||||
@ -44,6 +47,6 @@ _children = [];
|
||||
];
|
||||
};
|
||||
};
|
||||
} foreach _result;
|
||||
} forEach _result;
|
||||
|
||||
_children
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Garth 'L-H' de Wet and CAA-Picard
|
||||
*
|
||||
* Adds sub actions for all explosive magazines (from insertChildren)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
@ -11,9 +11,11 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"];
|
||||
|
||||
EXPLODE_1_PVT(_this,_unit);
|
||||
params ["_unit"];
|
||||
TRACE_1("params",_unit);
|
||||
|
||||
private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"];
|
||||
|
||||
_mags = magazines _unit;
|
||||
_list = [];
|
||||
@ -41,16 +43,16 @@ _children = [];
|
||||
[
|
||||
[
|
||||
format ["Explosive_%1", _forEachIndex],
|
||||
format [_name + " (%1)", _itemCount select _foreachIndex],
|
||||
format [_name + " (%1)", _itemCount select _forEachIndex],
|
||||
getText(_x >> "picture"),
|
||||
{(_this select 2) call FUNC(setupExplosive);},
|
||||
{_this call FUNC(setupExplosive);},
|
||||
{true},
|
||||
{},
|
||||
[_unit, configName _x]
|
||||
(configName _x)
|
||||
] call EFUNC(interact_menu,createAction),
|
||||
[],
|
||||
_unit
|
||||
];
|
||||
} foreach _list;
|
||||
} forEach _list;
|
||||
|
||||
_children
|
||||
|
@ -15,13 +15,16 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_name", "_code"];
|
||||
TRACE_2("params",_name,_code);
|
||||
|
||||
private ["_speedDial", "_found"];
|
||||
|
||||
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
|
||||
_found = false;
|
||||
|
||||
EXPLODE_2_PVT(_this,_name,_code);
|
||||
|
||||
if ((_code) == "") ExitWith {
|
||||
if ((_code) == "") exitWith {
|
||||
[_name] call FUNC(removeFromSpeedDial);
|
||||
};
|
||||
{
|
||||
@ -29,7 +32,7 @@ if ((_code) == "") ExitWith {
|
||||
_speedDial set [_foreachindex, _this];
|
||||
_found = true;
|
||||
};
|
||||
} foreach _speedDial;
|
||||
} forEach _speedDial;
|
||||
if (!_found) then {
|
||||
_speedDial pushBack _this;
|
||||
};
|
||||
|
@ -14,8 +14,12 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_unit", "_children", "_config", "_detonators"];
|
||||
_unit = _this select 0;
|
||||
|
||||
params ["_unit"];
|
||||
TRACE_1("params",_unit);
|
||||
|
||||
private ["_children", "_config", "_detonators"];
|
||||
|
||||
_detonators = [_unit] call FUNC(getDetonators);
|
||||
_children = [];
|
||||
{
|
||||
@ -34,6 +38,6 @@ _children = [];
|
||||
[],
|
||||
ACE_Player
|
||||
];
|
||||
} foreach _detonators;
|
||||
} forEach _detonators;
|
||||
|
||||
_children
|
||||
|
@ -15,10 +15,14 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers"];
|
||||
EXPLODE_2_PVT(_this,_magazine,_explosive);
|
||||
_detonators = [ACE_player] call FUNC(getDetonators);
|
||||
|
||||
params ["_magazine", "_explosive"];
|
||||
TRACE_2("params",_magazine,_explosive);
|
||||
|
||||
private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers", "_isAttached"];
|
||||
|
||||
_isAttached = !isNull (attachedTo _explosive);
|
||||
_detonators = [ACE_player] call FUNC(getDetonators);
|
||||
_triggerTypes = [_magazine] call FUNC(triggerType);
|
||||
_magTriggers = ConfigFile >> "CfgMagazines" >> _magazine >> "ACE_Triggers";
|
||||
_children = [];
|
||||
@ -30,7 +34,7 @@ _children = [];
|
||||
_hasRequiredItems = false;
|
||||
};
|
||||
} count _required;
|
||||
if (_hasRequiredItems) then {
|
||||
if (_hasRequiredItems && {(!_isAttached) || {(getNumber (_x >> "isAttachable")) == 1}}) then {
|
||||
_children pushBack
|
||||
[
|
||||
[
|
||||
@ -50,6 +54,6 @@ _children = [];
|
||||
ACE_Player
|
||||
];
|
||||
};
|
||||
} foreach _triggerTypes;
|
||||
} forEach _triggerTypes;
|
||||
|
||||
_children
|
||||
|
@ -4,6 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 0: Target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Able to defuse <BOOL>
|
||||
@ -14,8 +15,12 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_target"];
|
||||
TRACE_2("params",_unit,_target);
|
||||
|
||||
private ["_isSpecialist"];
|
||||
EXPLODE_2_PVT(_this,_unit,_target);
|
||||
|
||||
if (isNull(_target getVariable [QGVAR(Explosive),objNull])) exitWith {
|
||||
deleteVehicle _target;
|
||||
false
|
||||
|
@ -14,7 +14,7 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private "_unit";
|
||||
_unit = _this select 0;
|
||||
|
||||
[_unit] call FUNC(hasPlacedExplosives) and {count ([_unit] call FUNC(getDetonators)) > 0}
|
||||
params ["_unit"];
|
||||
|
||||
([_unit] call FUNC(hasPlacedExplosives)) && {(count ([_unit] call FUNC(getDetonators))) > 0}
|
||||
|
@ -15,9 +15,12 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
EXPLODE_2_PVT(_this,_unit,_explosive);
|
||||
|
||||
if (GVAR(ExplodeOnDefuse) && (random 1.0) < getNumber(ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse")) exitWith {
|
||||
params ["_unit", "_explosive"];
|
||||
TRACE_2("params",_unit,_explosive);
|
||||
|
||||
if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse"))}) exitWith {
|
||||
TRACE_1("exploding on defuse",_explosive);
|
||||
[_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive);
|
||||
};
|
||||
|
||||
|
@ -19,12 +19,16 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_result", "_ignoreRange", "_helpers", "_pos"];
|
||||
EXPLODE_3_PVT(_this,_unit,_range,_item);
|
||||
|
||||
params ["_unit", "_range", "_item"];
|
||||
TRACE_3("params",_unit,_range,_item);
|
||||
|
||||
private ["_result", "_ignoreRange", "_pos"];
|
||||
|
||||
_ignoreRange = (_range == -1);
|
||||
_result = true;
|
||||
|
||||
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {false};
|
||||
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRACE_1("out of range",_range); false};
|
||||
|
||||
if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhenDestroyed") == 0) then {
|
||||
private ["_exp", "_previousExp"];
|
||||
@ -40,11 +44,11 @@ if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhe
|
||||
};
|
||||
};
|
||||
[{
|
||||
private ["_explosive"];
|
||||
_explosive = _this;
|
||||
params ["_explosive"];
|
||||
TRACE_1("exploding",_explosive);
|
||||
if (!isNull _explosive) then {
|
||||
_explosive setDamage 1;
|
||||
};
|
||||
}, _item select 0, _item select 1, 0] call EFUNC(common,waitAndExecute);
|
||||
}, [_item select 0], (_item select 1)] call EFUNC(common,waitAndExecute);
|
||||
|
||||
_result
|
||||
|
@ -15,8 +15,12 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_code"];
|
||||
TRACE_2("params",_unit,_code);
|
||||
|
||||
private ["_arr", "_ran", "_i"];
|
||||
EXPLODE_2_PVT(_this,_unit,_code);
|
||||
|
||||
if (_unit getVariable [QGVAR(Dialing),false]) exitWith {};
|
||||
if !(alive _unit) exitWith {};
|
||||
_unit setVariable [QGVAR(Dialing), true, true];
|
||||
@ -36,7 +40,7 @@ if (_unit == ace_player) then {
|
||||
[{
|
||||
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75];
|
||||
(_this select 0) setVariable [QGVAR(Dialing), false, true];
|
||||
}, [_unit,_explosive select 0], 0.25 * (count _arr - 4), 0] call EFUNC(common,waitAndExecute);
|
||||
}, [_unit,_explosive select 0], 0.25 * (count _arr - 4)] call EFUNC(common,waitAndExecute);
|
||||
[_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2)] call FUNC(startTimer);
|
||||
};
|
||||
};
|
||||
|
@ -17,7 +17,10 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code);
|
||||
|
||||
params ["_args", "_pfID"];
|
||||
_args params ["_unit", "_i", "_arr", "_code"];
|
||||
|
||||
if ((_i mod 4) == 0) then {
|
||||
playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit modelToWorldVisual [0,0.2,2]), 15,1,2.5];
|
||||
};
|
||||
@ -27,7 +30,7 @@ private "_explosive";
|
||||
_explosive = [_code] call FUNC(getSpeedDialExplosive);
|
||||
|
||||
if (_i >= (count _arr + 2)) then {
|
||||
[_this select 1] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
||||
[_pfID] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
||||
if ((count _explosive) > 0) then {
|
||||
[_unit, -1, [_explosive select 0, _explosive select 2]] call FUNC(detonateExplosive);
|
||||
};
|
||||
@ -41,4 +44,4 @@ if (_i == (count _arr)) then {
|
||||
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_explosive select 0),3.16228,1,75];
|
||||
};
|
||||
};
|
||||
(_this select 0) set [1, _i + 1];
|
||||
_args set [1, _i + 1];
|
||||
|
@ -16,8 +16,11 @@
|
||||
#include "script_component.hpp"
|
||||
// IGNORE_PRIVATE_WARNING(_detonators);
|
||||
|
||||
private ["_unit", "_items", "_result", "_config"];
|
||||
_unit = _this select 0;
|
||||
params ["_unit"];
|
||||
TRACE_1("params",_unit);
|
||||
|
||||
private ["_items", "_result", "_config"];
|
||||
|
||||
_items = (items _unit);
|
||||
_result = [];
|
||||
|
||||
|
@ -18,8 +18,11 @@
|
||||
#include "script_component.hpp"
|
||||
// IGNORE_PRIVATE_WARNING(_allExplosives,_deadmanExplosives);
|
||||
|
||||
private ["_unit", "_clackerList", "_adjustedList", "_list", "_filter"];
|
||||
_unit = _this select 0;
|
||||
params ["_unit"];
|
||||
TRACE_1("params",_unit);
|
||||
|
||||
private ["_clackerList", "_adjustedList", "_list", "_filter"];
|
||||
|
||||
_filter = nil;
|
||||
if (count _this > 1) then {
|
||||
_filter = ConfigFile >> "ACE_Triggers" >> (_this select 1);
|
||||
@ -30,14 +33,14 @@ _clackerList = _unit getVariable [QGVAR(Clackers), []];
|
||||
_list = [];
|
||||
{
|
||||
if (isNull (_x select 0)) then {
|
||||
_clackerList set [_foreachIndex, "X"];
|
||||
_clackerList set [_forEachIndex, "X"];
|
||||
_adjustedList = true;
|
||||
} else {
|
||||
if (isNil "_filter" || {(ConfigFile >> "ACE_Triggers" >> (_x select 4)) == _filter}) then {
|
||||
_list pushBack _x;
|
||||
};
|
||||
};
|
||||
} foreach _clackerList;
|
||||
} forEach _clackerList;
|
||||
if (_adjustedList) then {
|
||||
_clackerList = _clackerList - ["X"];
|
||||
if (count _clackerList == 0) then {
|
||||
|
@ -14,8 +14,12 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
EXPLODE_1_PVT(_this,_code);
|
||||
|
||||
params ["_code"];
|
||||
TRACE_1("params",_code);
|
||||
|
||||
private ["_explosive"];
|
||||
|
||||
if (isNil QGVAR(CellphoneIEDs)) exitWith {[]};
|
||||
_explosive = [];
|
||||
{
|
||||
@ -24,4 +28,5 @@ _explosive = [];
|
||||
};
|
||||
false
|
||||
} count GVAR(CellphoneIEDs);
|
||||
|
||||
_explosive
|
||||
|
@ -14,9 +14,9 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
if (isNull(GVAR(Setup)) || {ACE_Modifier == 0} || !GVAR(pfeh_running)) exitWith {false};
|
||||
_this = _this * 5;
|
||||
GVAR(Setup) setDir ((getDir GVAR(Setup)) + _this);
|
||||
GVAR(TweakedAngle) = GVAR(TweakedAngle) + _this;
|
||||
|
||||
if ((!GVAR(pfeh_running)) || {ACE_Modifier == 0}) exitWith {false};
|
||||
|
||||
GVAR(TweakedAngle) = ((GVAR(TweakedAngle) + 7.2 * _this) + 360) % 360;
|
||||
|
||||
true
|
||||
|
@ -9,16 +9,18 @@
|
||||
* The unit has explosives <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* _hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives;
|
||||
* hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives;
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
// IGNORE_PRIVATE_WARNING(_hasExplosives);
|
||||
|
||||
private ["_unit", "_result", "_magazines"];
|
||||
params ["_unit"];
|
||||
TRACE_1("params",_unit);
|
||||
|
||||
private ["_result", "_magazines"];
|
||||
|
||||
_result = false;
|
||||
_unit = _this select 0;
|
||||
_magazines = magazines _unit;
|
||||
{
|
||||
if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> "ACE_Placeable") == 1) exitWith {
|
||||
|
@ -16,7 +16,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_interactionType);
|
||||
params ["_interactionType"];
|
||||
TRACE_1("params",_interactionType);
|
||||
|
||||
//Ignore self-interaction menu
|
||||
if (_interactionType != 0) exitWith {};
|
||||
@ -26,8 +27,8 @@ if ((vehicle ACE_player) != ACE_player) exitWith {};
|
||||
if (!("ACE_DefusalKit" in (items ACE_player))) exitWith {};
|
||||
|
||||
[{
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_3_PVT(_args,_setPosition,_addedDefuseHelpers,_minesHelped);
|
||||
params ["_args", "_pfID"];
|
||||
_args params ["_setPosition", "_addedDefuseHelpers", "_minesHelped"];
|
||||
|
||||
if (!EGVAR(interact_menu,keyDown)) then {
|
||||
TRACE_1("Cleaning Defuse Helpers",(count _addedDefuseHelpers));
|
||||
|
@ -14,20 +14,13 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if !(isServer) exitWith {};
|
||||
|
||||
private["_activated", "_logic"];
|
||||
params ["_logic"];
|
||||
|
||||
_logic = _this select 0;
|
||||
_activated = _this select 2;
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(RequireSpecialist), "RequireSpecialist"]
|
||||
call EFUNC(Common,readSettingFromModule);
|
||||
[_logic, QGVAR(PunishNonSpecialists),"PunishNonSpecialists"]
|
||||
call EFUNC(Common,readSettingFromModule);
|
||||
[_logic, QGVAR(ExplodeOnDefuse),"ExplodeOnDefuse"]
|
||||
call EFUNC(Common,readSettingFromModule);
|
||||
[_logic, QGVAR(RequireSpecialist), "RequireSpecialist"] call EFUNC(Common,readSettingFromModule);
|
||||
[_logic, QGVAR(PunishNonSpecialists),"PunishNonSpecialists"] call EFUNC(Common,readSettingFromModule);
|
||||
[_logic, QGVAR(ExplodeOnDefuse),"ExplodeOnDefuse"] call EFUNC(Common,readSettingFromModule);
|
||||
|
||||
diag_log text "[ACE]: Explosive Module Initialized.";
|
||||
|
@ -14,13 +14,14 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
//NOTE: Extended_Killed_EventHandlers runs only where _unit is local
|
||||
params ["_unit"];
|
||||
TRACE_1("params",_unit);
|
||||
|
||||
private ["_deadman"];
|
||||
_unit = _this select 0;
|
||||
if (_unit == ACE_player) then {
|
||||
call FUNC(place_Cancel);
|
||||
};
|
||||
if (!isServer) exitWith{};
|
||||
|
||||
_deadman = [_unit, "DeadManSwitch"] call FUNC(getPlacedExplosives);
|
||||
{
|
||||
[_unit, -1, _x, true] call FUNC(detonateExplosive);
|
||||
} foreach _deadman;
|
||||
} forEach _deadman;
|
@ -17,8 +17,11 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_receiver", "_giver", "_item"];
|
||||
TRACE_3("params",_receiver,_giver,_item);
|
||||
|
||||
private ["_config", "_detonators"];
|
||||
PARAMS_3(_receiver,_giver,_item);
|
||||
|
||||
if (_receiver != ace_player) exitWith {};
|
||||
|
||||
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Author: Garth 'L-H' de Wet
|
||||
* Handles the "EpeContactStart" event when placing the explosive.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Explosive Placing Object <OBJECT>
|
||||
* 1: Colliding Object <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* object addEventHandler ["EpeContactStart", ACE_explosive_fnc_onLanded];
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
EXPLODE_2_PVT(_this,_explosive,_hitTarget);
|
||||
|
||||
TRACE_2("Explosive EpeContactStart",_explosive,_hitTarget);
|
||||
|
||||
if ((_explosive getVariable [QGVAR(Handled), false])) exitWith {};
|
||||
|
||||
_explosive setVariable [QGVAR(Handled), true];
|
||||
if (!isNull _hitTarget && {_hitTarget isKindOf "AllVehicles"}) then {
|
||||
TRACE_1("Attaching to",_hitTarget);
|
||||
_explosive attachTo [_hitTarget];
|
||||
private "_dir";
|
||||
_dir = _explosive getVariable [QGVAR(Direction), 0];
|
||||
_dir = _dir - (getDir _hitTarget);
|
||||
[[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc);
|
||||
} else {
|
||||
[{
|
||||
EXPLODE_2_PVT(_this,_player,_explosive);
|
||||
private "_pos";
|
||||
_pos = getPosASL _explosive;
|
||||
if (surfaceIsWater _pos) then {
|
||||
_pos = getPosASL _explosive;
|
||||
_explosive setPosASL _pos;
|
||||
}else{
|
||||
_pos = getPosATL _explosive;
|
||||
_explosive setPosATL _pos;
|
||||
};
|
||||
}, [ACE_player, _explosive], 0.5, 0.1] call EFUNC(common,waitAndExecute);
|
||||
};
|
@ -15,7 +15,10 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
EXPLODE_2_PVT(_this,_explosive,_mag);
|
||||
|
||||
params ["_explosive", "_mag"];
|
||||
TRACE_2("params",_explosive,_mag);
|
||||
|
||||
createDialog "RscACE_SelectTimeUI";
|
||||
sliderSetRange [8845, 5, 900]; // 5seconds - 15minutes
|
||||
sliderSetPosition [8845, 30];
|
||||
|
@ -21,9 +21,11 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_ammo", "_explosive", "_attachedTo", "_expPos", "_magazineTrigger"];
|
||||
EXPLODE_6_PVT(_this,_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars);
|
||||
DEFAULT_PARAM(6,_setupPlaceholderObject,objNull);
|
||||
|
||||
params ["_unit", "_pos", "_dir", "_magazineClass", "_triggerConfig", "_triggerSpecificVars", ["_setupPlaceholderObject", objNull]];
|
||||
TRACE_7("params",_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars,_setupPlaceholderObject);
|
||||
|
||||
private ["_ammo", "_explosive", "_attachedTo", "_magazineTrigger", "_pitch", "_digDistance", "_canDigDown", "_soundEnviron", "_surfaceType"];
|
||||
|
||||
_unit playActionNow "PutDown";
|
||||
|
||||
@ -52,6 +54,28 @@ if (isText(_magazineTrigger >> "ammo")) then {
|
||||
};
|
||||
_triggerSpecificVars pushBack _triggerConfig;
|
||||
|
||||
//Dig the explosive down into the ground (usually on "pressurePlate")
|
||||
if (isNumber (_magazineTrigger >> "digDistance")) then {
|
||||
_digDistance = getNumber (_magazineTrigger >> "digDistance");
|
||||
|
||||
//Get Surface Type:
|
||||
_canDigDown = true;
|
||||
_surfaceType = surfaceType _pos;
|
||||
if ((_surfaceType select [0,1]) == "#") then {_surfaceType = _surfaceType select [1, 99];};
|
||||
if ((_surfaceType != "") || {isClass (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron")}) then {
|
||||
_soundEnviron = getText (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron");
|
||||
TRACE_2("Dig Down Surface",_surfaceType,_soundEnviron);
|
||||
_canDigDown = !(_soundEnviron in ["road", "tarmac", "concrete", "concrete_int", "int_concrete", "concrete_ext"]);
|
||||
};
|
||||
//Don't dig down if pos ATL is high (in a building or A2 road)
|
||||
if (_canDigDown && {(_pos select 2) < 0.1}) then {
|
||||
TRACE_2("Can Dig Down",_digDistance,_pos);
|
||||
_pos = _pos vectorAdd [0,0, (-1 * _digDistance)];
|
||||
} else {
|
||||
TRACE_2("Can NOT Dig Down",_digDistance,_pos);
|
||||
};
|
||||
};
|
||||
|
||||
_explosive = createVehicle [_ammo, _pos, [], 0, "NONE"];
|
||||
_explosive setPosATL _pos;
|
||||
|
||||
@ -60,7 +84,17 @@ if (!isNull _attachedTo) then {
|
||||
_explosive attachTo [_attachedTo];
|
||||
};
|
||||
|
||||
if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars]
|
||||
call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive};
|
||||
[[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc);
|
||||
//If trigger has "onPlace" and it returns true, just exitWith the explosive
|
||||
if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars] call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {
|
||||
TRACE_1("onPlace returns true",_explosive);
|
||||
_explosive
|
||||
};
|
||||
|
||||
//TODO: placing explosives on hills looks funny
|
||||
|
||||
_pitch = getNumber (_magazineTrigger >> "pitch");
|
||||
|
||||
//Globaly set the position angle:
|
||||
[QGVAR(place), [_explosive, _dir, _pitch]] call EFUNC(common,globalEvent);
|
||||
|
||||
_explosive
|
||||
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Author: Garth 'L-H' de Wet
|
||||
* Approves placement of the explosive, releases the placement object for it
|
||||
* to settle in a location suitable for the explosive to be created.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* call ACE_Explosives_fnc_place_Approve;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
if (GVAR(pfeh_running)) then {
|
||||
[QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler);
|
||||
GVAR(pfeh_running) = false;
|
||||
};
|
||||
private ["_setup", "_player", "_dir"];
|
||||
_setup = GVAR(Setup);
|
||||
GVAR(Setup) = objNull;
|
||||
[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus);
|
||||
[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler);
|
||||
[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler);
|
||||
GVAR(placer) = objNull;
|
||||
_player = ACE_player;
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
if ((_setup getVariable [QGVAR(Class), ""]) == "") exitWith {
|
||||
deleteVehicle _setup;
|
||||
};
|
||||
_dir = (getDir _setup);
|
||||
if (_dir > 180) then {
|
||||
_dir = _dir - 180;
|
||||
} else {
|
||||
_dir = 180 + _dir;
|
||||
};
|
||||
_setup setVariable [QGVAR(Direction), _dir, true];
|
||||
_player setVariable [QGVAR(PlantingExplosive), true];
|
||||
[{_this setVariable [QGVAR(PlantingExplosive), false]}, _player, 1.5, 0.5] call EFUNC(common,waitAndExecute);
|
||||
_setup addEventHandler ["EpeContactStart", FUNC(onLanded)];
|
||||
_setup enableSimulationGlobal true;
|
||||
_player playActionNow "PutDown";
|
||||
_player removeMagazine (_setup getVariable [QGVAR(Class), ""]);
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Author: Garth 'L-H' de Wet
|
||||
* Cancels placement of the explosive
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* call ACE_Explosives_fnc_place_Cancel;
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
if (GVAR(pfeh_running)) then {
|
||||
[QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler);
|
||||
GVAR(pfeh_running) = false;
|
||||
};
|
||||
if (!isNull (GVAR(Setup))) then {
|
||||
deleteVehicle GVAR(Setup);
|
||||
};
|
||||
GVAR(Setup) = objNull;
|
||||
if (isNil {GVAR(placer)}) then {
|
||||
GVAR(placer) = objNull;
|
||||
};
|
||||
[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus);
|
||||
GVAR(placer) = objNull;
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler);
|
||||
[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler);
|
@ -14,13 +14,15 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_speedDial";
|
||||
|
||||
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
|
||||
if (count _speedDial == 0) exitWith {};
|
||||
{
|
||||
if ((_x select 0) == (_this select 0)) exitWith {
|
||||
_speedDial set [_foreachIndex, "x"];
|
||||
_speedDial set [_forEachIndex, "x"];
|
||||
_speedDial = _speedDial - ["x"];
|
||||
ace_player setVariable [QGVAR(SpeedDial),_speedDial];
|
||||
};
|
||||
} foreach _speedDial;
|
||||
} forEach _speedDial;
|
||||
|
@ -16,12 +16,17 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_explosive", "_magazine", "_trigger"];
|
||||
TRACE_3("params",_explosive,_magazine,_trigger);
|
||||
|
||||
private ["_config"];
|
||||
|
||||
EXPLODE_3_PVT(_this,_explosive,_magazine,_trigger);
|
||||
_config = ConfigFile >> "ACE_Triggers" >> _trigger;
|
||||
|
||||
// If the onSetup function returns true, it is handled elsewhere
|
||||
if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {};
|
||||
if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {
|
||||
TRACE_2("onSetup returned true",_explosive,_trigger);
|
||||
};
|
||||
|
||||
[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call ACE_Explosives_fnc_placeExplosive;
|
||||
[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call FUNC(placeExplosive);
|
||||
|
@ -11,13 +11,21 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_explosive, 150, 90] call ACE_Explosives_fnc_SetPos;
|
||||
* [_explosive, 150, 90] call ACE_Explosives_fnc_setPosition;
|
||||
*
|
||||
* Public: Yes
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
EXPLODE_3_PVT(_this,_explosive,_direction,_pitch);
|
||||
_explosive setDir _direction;
|
||||
if (_pitch != 0) then {
|
||||
[_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank);
|
||||
|
||||
params ["_explosive", "_direction", "_pitch"];
|
||||
TRACE_3("params",_explosive,_direction,_pitch);
|
||||
|
||||
if (isNull (attachedTo _explosive)) then {
|
||||
_explosive setDir _direction;
|
||||
if (_pitch != 0) then {
|
||||
[_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank);
|
||||
};
|
||||
} else {
|
||||
//Attaching to a vehicle (dirAndUp based on vehicle)
|
||||
_explosive setVectorDirAndUp [[0,0,1],[(sin _direction),(cos _direction),0]];
|
||||
};
|
||||
|
@ -15,7 +15,9 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_speedDial", "_amount"];
|
||||
|
||||
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
|
||||
if (count _speedDial == 0) exitWith {};
|
||||
_amount = if((_this select 0))then{1}else{-1};
|
||||
|
@ -3,8 +3,9 @@
|
||||
* Starts the setup process for the passed explosive. Player only.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Classname of explosive to place. (CfgMagazine class) <STRING>
|
||||
* 0: Vehicle <OBJECT>
|
||||
* 1: Player Unit <OBJECT>
|
||||
* 2: Classname of explosive to place. (CfgMagazine class) <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -14,36 +15,203 @@
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
#include "script_component.hpp"
|
||||
closeDialog 0;
|
||||
EXPLODE_2_PVT(_this,_unit,_class);
|
||||
GVAR(placer) = _unit;
|
||||
// TODO: check MP performance and MP compatible.
|
||||
GVAR(Setup) = createVehicle [getText(ConfigFile >> "CfgMagazines" >> _class >> "ACE_SetupObject"),[0,0,-10000],[], 0, "NONE"];
|
||||
|
||||
GVAR(Setup) enableSimulationGlobal false;
|
||||
GVAR(Setup) setVariable [QGVAR(class), _class, true];
|
||||
#define PLACE_RANGE_MAX 1
|
||||
#define PLACE_RANGE_MIN 0.025
|
||||
|
||||
params ["_vehicle", "_unit", "_magClassname"];
|
||||
TRACE_3("params",_vehicle,_unit,_magClassname);
|
||||
|
||||
private["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"];
|
||||
|
||||
//Get setup object vehicle and model:
|
||||
_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> "ACE_SetupObject");
|
||||
if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR("Bad Vehicle");};
|
||||
_p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model");
|
||||
if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game!
|
||||
|
||||
[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus);
|
||||
GVAR(TweakedAngle) = 180;
|
||||
|
||||
[QGVAR(Placement),"OnEachFrame", {
|
||||
private ["_player", "_pos"];
|
||||
_player = ACE_player;
|
||||
if (GVAR(placer) != _player) exitWith {
|
||||
call FUNC(place_Cancel);
|
||||
};
|
||||
GVAR(pfeh_running) = true;
|
||||
_pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]);
|
||||
GVAR(Setup) setPosATL _pos;
|
||||
if (ACE_Modifier == 0) then {
|
||||
GVAR(Setup) setDir (GVAR(TweakedAngle) + getDir _player);
|
||||
};
|
||||
}] call CALLSTACK(BIS_fnc_addStackedEventHandler);
|
||||
//Show mouse buttons:
|
||||
[localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint);
|
||||
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)];
|
||||
_unit setVariable [QGVAR(cancelActionEH), [_unit, "zoomtemp", {true}, {GVAR(placeAction) = PLACE_CANCEL;}] call EFUNC(common,AddActionEventHandler)];
|
||||
|
||||
[localize LSTRING(PlaceAction), localize LSTRING(CancelAction),
|
||||
localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint);
|
||||
_unit setVariable [QGVAR(Place), [_unit, "DefaultAction",
|
||||
{GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Approve);}] call EFUNC(common,AddActionEventHandler)];
|
||||
_unit setVariable [QGVAR(Cancel), [_unit, "zoomtemp",
|
||||
{GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Cancel);}] call EFUNC(common,AddActionEventHandler)];
|
||||
//Display to show virtual object:
|
||||
(QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutRsc [QGVAR(virtualAmmo), "PLAIN", 0, false];
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _p3dModel;
|
||||
|
||||
//Make sure it has a trigger that works when attached (eg, no tripwires that only do pressurePlate)
|
||||
_isAttachable = false;
|
||||
_supportedTriggers = getArray (configFile >> "CfgMagazines" >> _magClassname >> "ACE_Triggers" >> "SupportedTriggers");
|
||||
{
|
||||
if ((getNumber (configFile >> "ACE_Triggers" >> _x >> "isAttachable")) == 1) exitWith {_isAttachable = true;};
|
||||
} forEach _supportedTriggers;
|
||||
|
||||
|
||||
GVAR(pfeh_running) = true;
|
||||
GVAR(placeAction) = PLACE_WAITING;
|
||||
GVAR(TweakedAngle) = 0;
|
||||
|
||||
|
||||
[{
|
||||
BEGIN_COUNTER(pfeh);
|
||||
|
||||
params ["_args", "_pfID"];
|
||||
_args params ["_unit", "_magClassname", "_setupObjectClass", "_isAttachable"];
|
||||
|
||||
private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"];
|
||||
|
||||
_lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL));
|
||||
_basePosASL = (eyePos _unit);
|
||||
if (cameraView == "EXTERNAL") then { //If external, show explosive over the right shoulder
|
||||
_basePosASL = _basePosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0]));
|
||||
};
|
||||
if ((stance _unit) == "PRONE") then {
|
||||
//If prone, lower base and increase up angle of look - Makes it much easier to attach to underside of vehicles
|
||||
_basePosASL set [2, ((_basePosASL select 2) - 0.3)];
|
||||
_lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,3,10]) call EFUNC(common,positionToASL));
|
||||
};
|
||||
_cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1);
|
||||
|
||||
_testPositionIsValid = {
|
||||
_testBase = _basePosASL vectorAdd (_lookDirVector vectorMultiply (_this select 0));
|
||||
_return = true;
|
||||
{
|
||||
_testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)];
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
drawLine3d [(eyePos _unit) call EFUNC(common,ASLToPosition), (_testPos) call EFUNC(common,ASLToPosition), [1,0,0,1]];
|
||||
#endif
|
||||
if (lineIntersects [eyePos _unit, _testPos, _unit]) exitWith {_return = false;};
|
||||
} forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]];
|
||||
_return
|
||||
};
|
||||
|
||||
_distanceFromBase = PLACE_RANGE_MAX;
|
||||
_badPosition = !([_distanceFromBase] call _testPositionIsValid);
|
||||
_attachVehicle = objNull;
|
||||
|
||||
if (_isAttachable && _badPosition) then {
|
||||
_attachVehicle = objNull;
|
||||
_testBase = _basePosASL vectorAdd _lookDirVector;
|
||||
{
|
||||
_testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)];
|
||||
_intersectsWith = lineIntersectsWith [eyePos _unit, _testPos, _unit];
|
||||
if (count _intersectsWith == 1) exitWith {_attachVehicle = (_intersectsWith select 0);};
|
||||
} forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]];
|
||||
if ((!isNull _attachVehicle) && {[PLACE_RANGE_MIN] call _testPositionIsValid} &&
|
||||
{(_attachVehicle isKindOf "Car") || {_attachVehicle isKindOf "Tank"} || {_attachVehicle isKindOf "Air"} || {_attachVehicle isKindOf "Ship"}}) then {
|
||||
_min = PLACE_RANGE_MIN;
|
||||
_max = PLACE_RANGE_MAX;
|
||||
for "_index" from 0 to 6 do {
|
||||
_distanceFromBase = (_min + _max) / 2;
|
||||
if ([_distanceFromBase] call _testPositionIsValid) then {
|
||||
_min = _distanceFromBase;
|
||||
} else {
|
||||
_max = _distanceFromBase;
|
||||
};
|
||||
};
|
||||
_badPosition = false;
|
||||
_distanceFromBase = ((_min + _max) / 2 + 0.075) min 1;
|
||||
} else {
|
||||
_attachVehicle = objNull;
|
||||
};
|
||||
};
|
||||
|
||||
_virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase);
|
||||
|
||||
//Update mouse hint:
|
||||
if (_badPosition) then {
|
||||
((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(BlockedAction);
|
||||
} else {
|
||||
if (isNull _attachVehicle) then {
|
||||
((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(PlaceAction);
|
||||
} else {
|
||||
((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(AttachAction);
|
||||
};
|
||||
};
|
||||
|
||||
//Don't allow Placing bellow terrain
|
||||
if ((getTerrainHeightASL _virtualPosASL) > (_virtualPosASL select 2)) then {
|
||||
_virtualPosASL set [2, (getTerrainHeightASL _virtualPosASL)];
|
||||
};
|
||||
|
||||
//Don't allow placing in a bad position:
|
||||
if (_badPosition && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;};
|
||||
|
||||
if (((inputAction "zoomTemp") > 0) || //Cancel on RMB, For some reason this works (when held) but AddActionEventHandler doesn't
|
||||
{_unit != ACE_player} ||
|
||||
{!([_unit, objNull, ["isNotSwimming"]] call EFUNC(common,canInteractWith))} ||
|
||||
{!(_magClassname in (magazines _unit))}) then {
|
||||
GVAR(placeAction) = PLACE_CANCEL;
|
||||
};
|
||||
|
||||
if (GVAR(placeAction) != PLACE_WAITING) then {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
GVAR(pfeh_running) = false;
|
||||
|
||||
[_unit, "ACE_Explosives", false] call EFUNC(common,setForceWalkStatus);
|
||||
[] call EFUNC(interaction,hideMouseHint);
|
||||
[_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler);
|
||||
[_unit, "zoomtemp", (_unit getVariable [QGVAR(cancelActionEH), -1])] call EFUNC(common,removeActionEventHandler);
|
||||
|
||||
(QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
||||
|
||||
if (GVAR(placeAction) == PLACE_APPROVE) then {
|
||||
_placeAngle = 0;
|
||||
_expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition));
|
||||
|
||||
TRACE_1("Planting Mass", (getMass _expSetupVehicle));
|
||||
//If the object is too heavy, it can kill a player if it colides
|
||||
if ((getMass _expSetupVehicle) > 5) then {_expSetupVehicle setMass 5;};
|
||||
|
||||
if (isNull _attachVehicle) then {
|
||||
_placeAngle = _cameraAngle - GVAR(TweakedAngle) + 180;
|
||||
_expSetupVehicle setPosAsl _virtualPosASL;
|
||||
_expSetupVehicle setDir _placeAngle;
|
||||
_placeAngle = _placeAngle + 180; //CfgAmmos seem to be 180 for some reason
|
||||
} else {
|
||||
_modelOffset = _attachVehicle worldToModel (_virtualPosASL call EFUNC(common,ASLToPosition));
|
||||
_placeAngle = _cameraAngle - (getDir _attachVehicle) + 180;
|
||||
_expSetupVehicle attachTo [_attachVehicle, _modelOffset];
|
||||
_expSetupVehicle setVectorDirAndUp [[0,0,-1],[(sin _placeAngle),(cos _placeAngle),0]];
|
||||
};
|
||||
|
||||
TRACE_1("Place angel",_placeAngle);
|
||||
|
||||
_expSetupVehicle setVariable [QGVAR(class), _magClassname, true];
|
||||
_expSetupVehicle setVariable [QGVAR(Direction), _placeAngle, true];
|
||||
|
||||
_unit removeMagazine _magClassname;
|
||||
_unit playActionNow "PutDown";
|
||||
_unit setVariable [QGVAR(PlantingExplosive), true];
|
||||
[{_this setVariable [QGVAR(PlantingExplosive), false]}, _unit, 1.5] call EFUNC(common,waitAndExecute);
|
||||
|
||||
};
|
||||
} else {
|
||||
_screenPos = worldToScreen (_virtualPosASL call EFUNC(common,ASLToPosition));
|
||||
if (_badPosition || {_screenPos isEqualTo []}) then {
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false;
|
||||
} else {
|
||||
//Show the model on the hud in aprox the same size/location as it will be placed:
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true;
|
||||
|
||||
_realDistance = ((_virtualPosASL call EFUNC(common,ASLToPosition)) distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1);
|
||||
_screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)];
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos;
|
||||
|
||||
_modelDir = [0,0,-1];
|
||||
_modelUp = [0,-1,0];
|
||||
if (isNull _attachVehicle) then {
|
||||
_angle = acos (_lookDirVector select 2);
|
||||
_modelUp = [0, (cos _angle), (sin _angle)];
|
||||
_modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp;
|
||||
};
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [_modelDir, _modelUp];
|
||||
};
|
||||
};
|
||||
|
||||
END_COUNTER(pfeh);
|
||||
}, 0, [_unit, _magClassname, _setupObjectClass, _isAttachable]] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -15,14 +15,17 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
EXPLODE_2_PVT(_this,_unit,_target);
|
||||
|
||||
params ["_unit", "_target"];
|
||||
TRACE_2("params",_unit,_target);
|
||||
|
||||
private["_actionToPlay", "_defuseTime", "_isEOD"];
|
||||
|
||||
_target = attachedTo (_target);
|
||||
|
||||
_fnc_DefuseTime = {
|
||||
EXPLODE_2_PVT(_this,_specialist,_target);
|
||||
params ["_specialist", "_target"];
|
||||
TRACE_2("defuseTime",_specialist,_target);
|
||||
private ["_defuseTime"];
|
||||
_defuseTime = 5;
|
||||
if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then {
|
||||
@ -48,11 +51,12 @@ if (ACE_player != _unit) then {
|
||||
_unit disableAI "TARGET";
|
||||
_defuseTime = [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime;
|
||||
[{
|
||||
PARAMS_2(_unit,_target);
|
||||
params ["_unit", "_target"];
|
||||
TRACE_2("defuse finished",_unit,_target);
|
||||
[_unit, _target] call FUNC(defuseExplosive);
|
||||
_unit enableAI "MOVE";
|
||||
_unit enableAI "TARGET";
|
||||
}, [_unit, _target], _defuseTime, 0] call EFUNC(common,waitAndExecute);
|
||||
}, [_unit, _target], _defuseTime] call EFUNC(common,waitAndExecute);
|
||||
};
|
||||
} else {
|
||||
_unit playActionNow _actionToPlay;
|
||||
|
@ -16,12 +16,13 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_2_PVT(_this,_explosive,_delay);
|
||||
params ["_explosive", "_delay"];
|
||||
TRACE_2("params",_explosive,_delay);
|
||||
|
||||
[{
|
||||
private ["_explosive"];
|
||||
_explosive = _this;
|
||||
params ["_explosive"];
|
||||
TRACE_1("Explosive Going Boom",_explosive);
|
||||
if (!isNull _explosive) then {
|
||||
[_explosive, -1, [_explosive, 0]] call FUNC(detonateExplosive);
|
||||
};
|
||||
}, _explosive, _delay, 0] call EFUNC(common,waitAndExecute);
|
||||
}, [_explosive], _delay] call EFUNC(common,waitAndExecute);
|
||||
|
@ -9,17 +9,19 @@
|
||||
* Supported triggers as ACE_Triggers config entries <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* _supports = ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType
|
||||
* ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private["_result", "_config", "_count", "_index", "_supports"];
|
||||
// IGNORE_PRIVATE_WARNING(_supports);
|
||||
params ["_magazineClassname"];
|
||||
TRACE_1("params",_magazineClassname);
|
||||
|
||||
private["_result", "_config", "_count", "_index"];
|
||||
|
||||
_result = [];
|
||||
_config = getArray (ConfigFile >> "CfgMagazines" >> (_this select 0) >> "ACE_Triggers" >> "SupportedTriggers");
|
||||
_config = getArray (ConfigFile >> "CfgMagazines" >> _magazineClassname >> "ACE_Triggers" >> "SupportedTriggers");
|
||||
_count = count _config;
|
||||
|
||||
for "_index" from 0 to (_count - 1) do {
|
||||
|
@ -12,3 +12,7 @@
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
#define PLACE_WAITING -1
|
||||
#define PLACE_CANCEL 0
|
||||
#define PLACE_APPROVE 1
|
||||
|
@ -61,6 +61,22 @@
|
||||
<Portuguese>Colocar</Portuguese>
|
||||
<Russian>Установить</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Explosives_AttachAction">
|
||||
<English>Attach</English>
|
||||
<German>Befestigen</German>
|
||||
<Spanish>Acoplar</Spanish>
|
||||
<Polish>Przyczep</Polish>
|
||||
<French>Attacher</French>
|
||||
<Czech>Připnout</Czech>
|
||||
<Portuguese>Fixar</Portuguese>
|
||||
<Italian>Attacca</Italian>
|
||||
<Hungarian>Hozzácsatolás</Hungarian>
|
||||
<Russian>Прикрепить</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Explosives_BlockedAction">
|
||||
<English>Blocked</English>
|
||||
<Spanish>Obstruido</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Explosives_CancelAction">
|
||||
<English>Cancel</English>
|
||||
<German>Abbrechen</German>
|
||||
|
1
addons/flashlights/$PBOPREFIX$
Normal file
1
addons/flashlights/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\flashlights
|
5
addons/flashlights/CfgEventHandlers.hpp
Normal file
5
addons/flashlights/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,5 @@
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) );
|
||||
};
|
||||
};
|
7
addons/flashlights/CfgSounds.hpp
Normal file
7
addons/flashlights/CfgSounds.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
class CfgSounds {
|
||||
class ACE_flashlights_flashlightClick {
|
||||
name = "ACE_flashlights_flashlightClick";
|
||||
sound[] = {"\a3\sounds_f\weapons\Other\dry4.wss", 0.2, 2};
|
||||
titles[] = {};
|
||||
};
|
||||
};
|
89
addons/flashlights/CfgVehicles.hpp
Normal file
89
addons/flashlights/CfgVehicles.hpp
Normal file
@ -0,0 +1,89 @@
|
||||
class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
//todo: add flashlight attach actions
|
||||
};
|
||||
};
|
||||
|
||||
class Item_Base_F;
|
||||
|
||||
class ACE_Flashlight_MX991Item: Item_Base_F {
|
||||
scope = 2;
|
||||
scopeCurator = 2;
|
||||
displayName = CSTRING(MX991_DisplayName);
|
||||
author = ECSTRING(common,ACETeam);
|
||||
vehicleClass = "WeaponAccessories";
|
||||
class TransportItems {
|
||||
class ACE_Flashlight_MX991 {
|
||||
name = "ACE_Flashlight_MX991";
|
||||
count = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Flashlight_KSF1Item: Item_Base_F {
|
||||
scope = 2;
|
||||
scopeCurator = 2;
|
||||
displayName = CSTRING(KSF1_DisplayName);
|
||||
author = ECSTRING(common,ACETeam);
|
||||
vehicleClass = "WeaponAccessories";
|
||||
class TransportItems {
|
||||
class ACE_Flashlight_KSF1 {
|
||||
name = "ACE_Flashlight_KSF1";
|
||||
count = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Flashlight_XL50Item: Item_Base_F {
|
||||
scope = 2;
|
||||
scopeCurator = 2;
|
||||
displayName = CSTRING(XL50_DisplayName);
|
||||
author = ECSTRING(common,ACETeam);
|
||||
vehicleClass = "WeaponAccessories";
|
||||
class TransportItems {
|
||||
class ACE_Flashlight_XL50 {
|
||||
name = "ACE_Flashlight_XL50";
|
||||
count = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class NATO_Box_Base;
|
||||
class EAST_Box_Base;
|
||||
class IND_Box_Base;
|
||||
class FIA_Box_Base_F;
|
||||
|
||||
class Box_NATO_Support_F: NATO_Box_Base {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_Flashlight_MX991,12);
|
||||
};
|
||||
};
|
||||
|
||||
class Box_East_Support_F: EAST_Box_Base {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_Flashlight_KSF1,12);
|
||||
};
|
||||
};
|
||||
|
||||
class Box_IND_Support_F: IND_Box_Base {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_Flashlight_XL50,12);
|
||||
};
|
||||
};
|
||||
|
||||
class Box_FIA_Support_F: FIA_Box_Base_F {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_Flashlight_MX991,12);
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Box_Misc: Box_NATO_Support_F {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_Flashlight_MX991,12);
|
||||
MACRO_ADDITEM(ACE_Flashlight_KSF1,12);
|
||||
MACRO_ADDITEM(ACE_Flashlight_XL50,12);
|
||||
};
|
||||
};
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user