Merge branch 'master' into disarmingTest

This commit is contained in:
PabstMirror 2015-03-20 19:05:54 -05:00
commit f8e758e136
102 changed files with 2917 additions and 129 deletions

View File

@ -17,7 +17,7 @@
</p> </p>
<p align="center"><sup><strong>Requires the latest version of <a href="http://www.armaholic.com/page.php?id=18767">CBA A3</a> | <a href="#">BIF thread</a></strong></sup></p> <p align="center"><sup><strong>Requires the latest version of <a href="http://www.armaholic.com/page.php?id=18767">CBA A3</a> | <a href="#">BIF thread</a></strong></sup></p>
**ACE 3** is a joint effort by the teams behind **ACE2**, **AGM** and **CSE** to improve the realism and authenticity of Arma 3. **ACE3** is a joint effort by the teams behind **ACE2**, **AGM** and **CSE** to improve the realism and authenticity of Arma 3.
This mod is entirely **open-source**, and everyone is free to propose changes or maintain their own, customized version as long as they make their changes open to the public in accordance with the GNU General Public License (for more information check the license file attached to this project). This mod is entirely **open-source**, and everyone is free to propose changes or maintain their own, customized version as long as they make their changes open to the public in accordance with the GNU General Public License (for more information check the license file attached to this project).

Binary file not shown.

View File

@ -0,0 +1,25 @@
// TMR: Optics initialization and functions
// (C) 2013 Ryan Schultz. See LICENSE.
// Request a resource layer from the game engine.
AGM_Optics_scopeRSC = ["AGM_Optics_Scope"] call BIS_fnc_rscLayer;
// Set global variables
AGM_Optics_inScope = false; // Is the scope up?
AGM_Optics_currentOptic = ""; // What optic is attached right now?
0 = 0 spawn {
waituntil {!isNull (findDisplay 46)};
[] call AGM_Optics_fnc_initScope;
// PiP technique by BadBenson
AGM_Optics_Camera = "camera" camCreate (positioncameratoworld [0,0,0]);
AGM_Optics_Camera camSetFov 0.7;
AGM_Optics_Camera camSetTarget player;
AGM_Optics_Camera camCommit 1;
"agm_optics_rendertarget0" setPiPEffect [2, 1.0, 1.0, 1.0, 0.0, [0.0, 1.0, 0.0, 0.25], [1.0, 0.0, 1.0, 1.0], [0.199, 0.587, 0.114, 0.0]];
AGM_Optics_Camera cameraEffect ["INTERNAL", "BACK","agm_optics_rendertarget0"];
waitUntil {[] call AGM_Optics_fnc_mainLoop; False};
};

View File

@ -0,0 +1,454 @@
class CfgPatches {
class AGM_Optics {
units[] = {};
weapons[] = {};
requiredVersion = 0.60;
requiredAddons[] = {AGM_Core};
version = 0.1;
author[] = {"Taosenai"};
authorUrl = "http://www.ryanschultz.org/tmr/";
};
};
class CfgFunctions {
class AGM_Optics {
class AGM_Optics {
file = "AGM_Optics\functions";
class firedEH;
class hideScope;
class initScope;
class mainLoop;
};
};
};
class Extended_PostInit_EventHandlers {
class AGM_Optics {
clientInit = "call compile preProcessFileLineNumbers '\AGM_Optics\clientInit.sqf'";
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class AGM_Optics {
clientFiredBIS = "_this call AGM_Optics_fnc_firedEH;";
};
};
};
class CfgOpticsEffect {
class AGM_OpticsRadBlur1 {
type = "radialblur";
params[] = {0.015, 0, 0.14, 0.2};
priority = 950;
};
};
class CfgWeapons {
class ItemCore;
class InventoryItem_Base_F;
class InventoryMuzzleItem_Base_F;
class InventoryOpticsItem_Base_F;
class optic_Hamr : ItemCore {
displayName = "HAMR 4x";
descriptionShort = "High Accuracy Multi-Range Optic<br />Magnification: 4x<br />Reticle: CM-RW 6.5mm";
scope = 2;
weaponInfoType = "AGM_RscWeapon";
AGM_Optics_enhanced = 1;
AGM_Optics_reticle = "\AGM_Optics\data\hamr\hamr-reticle65_ca.paa";
AGM_Optics_reticleIllum = "\AGM_Optics\data\hamr\hamr-reticle65Illum_ca.paa";
AGM_Optics_body = "\AGM_Optics\data\hamr\hamr-body_ca.paa";
AGM_Optics_bodyNight = "\AGM_Optics\data\hamr\hamr-bodyNight_ca.paa";
model = "\A3\weapons_f\acc\acco_hamr_F";
class ItemInfo : InventoryOpticsItem_Base_F {
mass = 4;
optics = 1;
optictype = 1;
rmbhint = "HAMR";
modeloptics = "\AGM_Optics\agm_optics_pip.p3d";
class OpticsModes {
class Hamr2Collimator {
AGM_Optics_enhanced = 0;
opticsID = 1;
useModelOptics = 0;
opticsppeffects[] = {};
opticsFlare = 0;
opticsDisablePeripherialVision = 0;
opticsZoomMin = 0.375;
opticsZoomMax = 1;
opticsZoomInit = 0.75;
memoryPointCamera = "eye";
visionMode[] = {};
distanceZoomMin = 300;
distanceZoomMax = 300;
};
class Hamr2Scope {
cameradir = "";
distanceZoomMin = 300;
distanceZoomMax = 300;
memorypointcamera = "opticView";
opticsdisableperipherialvision = 0;
opticsdisplayname = "IHAMR";
opticsflare = 1;
opticsid = 2;
opticsppeffects[] = {"OpticsCHAbera2", "OpticsBlur1", "AGM_OpticsRadBlur1"};
opticszoominit = 0.0872664626;
opticszoommax = 0.0872664626;
opticszoommin = 0.0872664626;
discretefov[] = {0.0872664626};
discreteinitindex = 0;
usemodeloptics = 1;
modeloptics = "\AGM_Optics\agm_optics_pip.p3d";
visionmode[] = {"Normal", "NVG"};
};
};
};
};
class optic_Arco : ItemCore {
descriptionshort = "Advanced Rifle Combat Optic<br />Magnification: 4x<br />Reticle: SpecterDR 6.5mm";
displayname = "ARCO 4x";
picture = "\A3\weapons_F\Data\UI\gear_acco_Arco_CA.paa";
scope = 2;
weaponInfoType = "AGM_RscWeapon";
model = "\A3\weapons_f\acc\acco_Arco_F";
AGM_Optics_enhanced = 1;
AGM_Optics_reticle = "\AGM_Optics\data\arco\arco-reticle65_ca.paa";
AGM_Optics_reticleIllum = "\AGM_Optics\data\arco\arco-reticle65Illum_ca.paa";
AGM_Optics_body = "\AGM_Optics\data\arco\arco-body_ca.paa";
AGM_Optics_bodyNight = "\AGM_Optics\data\arco\arco-bodyNight_ca.paa";
class ItemInfo: InventoryOpticsItem_Base_F {
mass = 4;
optics = 1;
optictype = 1;
rmbhint = "ARCO";
class OpticsModes {
class ARCO2collimator {
AGM_Optics_enhanced = 0;
cameradir = "";
distancezoommax = 300;
distancezoommin = 300;
memorypointcamera = "eye";
opticsdisableperipherialvision = 0;
opticsdisplayname = "CQB";
opticsflare = 0;
opticsid = 1;
opticsppeffects[] = {};
opticszoominit = 0.75;
opticszoommax = 1.1;
opticszoommin = 0.375;
usemodeloptics = 0;
visionmode[] = {};
};
class ARCO2scope: ARCO2collimator {
cameradir = "";
distanceZoomMin = 300;
distanceZoomMax = 300;
memorypointcamera = "opticView";
opticsdisableperipherialvision = 0;
opticsdisplayname = "ARCO";
opticsflare = 1;
opticsid = 2;
opticsppeffects[] = {"OpticsCHAbera2", "OpticsBlur1", "AGM_OpticsRadBlur1"};
opticszoominit = 0.0872664626; // 0.0872664626 rad = 5 degrees
opticszoommax = 0.0872664626; // SpecterDR 4x is 6 degrees
opticszoommin = 0.0872664626; // Scope graphic in game covers 1 degree
discretefov[] = {0.0872664626};
discreteinitindex = 0;
usemodeloptics = 1;
modeloptics = "\AGM_Optics\data\AGM_Optics_reticle90.p3d";
visionmode[] = {"Normal"};
};
};
};
};
class optic_MRCO : ItemCore {
displayName = "MRCO 1x/4x";
descriptionShort = "Medium Range Combat Optic<br />Magnification: 1x/4x<br />Reticle: Pitbull Gen II 5.56mm";
scope = 2;
weaponInfoType = "AGM_RscWeapon";
AGM_Optics_enhanced = 1;
AGM_Optics_reticle = "\AGM_Optics\data\mrco\mrco-reticle556_ca.paa";
AGM_Optics_reticleIllum = "\AGM_Optics\data\mrco\mrco-reticle556Illum_ca.paa";
AGM_Optics_body = "\AGM_Optics\data\mrco\mrco-body_ca.paa";
AGM_Optics_bodyNight = "\AGM_Optics\data\mrco\mrco-bodyNight_ca.paa";
class ItemInfo : InventoryOpticsItem_Base_F {
opticType = 1;
mass = 4;
optics = 1;
modelOptics = "\A3\Weapons_f_beta\acc\reticle_MRCO_F";
class OpticsModes {
class MRCOcq {
AGM_Optics_enhanced = 0;
opticsID = 1;
useModelOptics = 0;
opticsPPEffects[] = {};
opticsFlare = 0;
opticsDisablePeripherialVision = 0;
opticsZoomMin = 0.375;
opticsZoomMax = 1;
opticsZoomInit = 0.75;
memoryPointCamera = "eye";
visionMode[] = {};
distanceZoomMin = 100;
distanceZoomMax = 100;
};
class MRCOscope {
cameradir = "";
distanceZoomMin = 300;
distanceZoomMax = 300;
memorypointcamera = "eye";
opticsdisableperipherialvision = 0;
opticsdisplayname = "MRCO";
opticsflare = 1;
opticsid = 2;
opticsppeffects[] = {"OpticsCHAbera2", "OpticsBlur2", "AGM_OpticsRadBlur1"};
opticszoominit = 0.0872664626;
opticszoommax = 0.0872664626;
opticszoommin = 0.0872664626;
discretefov[] = {0.0872664626};
discreteinitindex = 0;
usemodeloptics = 1;
modeloptics = "\AGM_Optics\data\AGM_Optics_reticle90.p3d";
visionmode[] = {"Normal"};
};
};
};
};
class optic_Nightstalker : ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class NCTALKEP {};
class Iron : NCTALKEP {
opticsppeffects[] = {}; // Fix Arma 3 bug
};
};
};
};
class optic_SOS: ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
modelOptics = "\AGM_Optics\agm_optics_pip.p3d";
class OpticsModes {
class Snip {
visionMode[] = {"Normal","TI","NVG"};
thermalMode[] = {5,6};
opticsPPEffects[] = {"OpticsCHAbera1","radblur"};
modelOptics[] = {"\AGM_Optics\agm_optics_pip.p3d","\AGM_Optics\agm_optics_pip.p3d"};
};
};
};
};
class optic_DMS : ItemCore {
class ItemInfo: InventoryOpticsItem_Base_F {
class OpticsModes {
class Snip {};
class Iron : Snip {
opticsppeffects[] = {}; // Fix Arma 3 bug
};
};
};
};
class optic_LRPS : ItemCore {
descriptionshort = "Nightforce NXS Riflescope<br />Magnification: 5.5-22x";
displayname = "NXS 5.5-22x";
weaponinfotype = "AGM_RscWeapon";
AGM_Optics_enhanced = 1;
AGM_Optics_reticle = "\AGM_Optics\data\sos\sos-reticleMLR_ca.paa";
AGM_Optics_reticleIllum = "\AGM_Optics\data\sos\sos-reticleMLRIllum_ca.paa";
AGM_Optics_body = "\AGM_Optics\data\sos\sos-body_ca.paa";
AGM_Optics_bodyNight = "\AGM_Optics\data\sos\sos-bodyNight_ca.paa";
class ItemInfo: InventoryOpticsItem_Base_F {
modeloptics = "\AGM_Optics\data\AGM_Optics_reticle90.p3d";
weaponinfotype = "RscWeaponRangeZeroingFOV";
opticType = 2; // Sniper optics
class OpticsModes {
// Based on Nightforce NXS 5.5-22 scope
class Snip {
cameradir = "";
discretedistance[] = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300};
discretedistanceinitindex = 0;
discreteinitindex = 0;
distancezoommax = 2300;
distancezoommin = 100;
memorypointcamera = "opticView";
modeloptics = "\AGM_Optics\data\AGM_Optics_reticle90.p3d";
opticsdisableperipherialvision = 1;
opticsdisplayname = "SOS";
opticsflare = 1;
opticsid = 1;
opticsppeffects[] = {"OpticsCHAbera1", "OpticsBlur1", "AGM_OpticsRadBlur1"};
// How to determine opticszoom
// First do the basic math based on the listed FOV of the scope to
// get a baseline FOV
// 0.1 meter at 100 meters = 1 mrad
//
// 5.5x FOV -- 5.3 m at 100 m = 53 mrad
// = 0.053 rad = 3.037 deg FOV
// 22x FOV -- 1.4 m at 100m = 14 mrad
// = 0.014 rad = 0.802 deg
// The FOV you give the engine is based on a rather larger scope outline, so we
// have to do this extra work ourselves.
// At 1680x1050
// The width of a TMR optic viewfield is 864px
// The engine viewport width (which is what the below FOV is based on) is 980
// (864/980) = (FOV to give engine / true FOV of optic)
// 864/980 * 0.053 = 0.04673
// 864/980 * 0.014 = 0.01234
// Measured experimentally, these values seem quite right.
// Certainly they're close enough after you account for pixel density, etc.
opticszoominit = 0.01234;
opticszoommax = 0.04673;
opticszoommin = 0.01234;
discretefov[] = {};
usemodeloptics = 1;
visionmode[] = {"Normal"};
};
};
};
};
class optic_Yorris : ItemCore {
descriptionshort = "Burris FastFire II Red Dot Sight<br />Magnification: 1x";
displayname = "FastFire II";
};
class optic_MRD : ItemCore {
descriptionshort = "Eotech MRDS Red Dot Sight<br />Magnification: 1x";
displayname = "MRDS";
};
class optic_Holosight : ItemCore {
descriptionshort = "Eotech XPS3 Holographic Sight<br />Magnification: 1x";
displayname = "XPS3 Holo";
};
};
class RscOpticsText;
class RscOpticsValue;
class RscInGameUI {
class RscUnitInfo;
class RscWeaponZeroing;
class AGM_RscWeapon : RscWeaponZeroing {
idd = -1;
controls[] = {"CA_Zeroing", "CA_FOVMode"};
onLoad ="with uiNameSpace do { AGM_OpticsIGUI = _this select 0 }";
class CA_FOVMode : RscOpticsValue {
idc = 154;
style = 2;
colorText[] = {0, 0, 0, 0};
x = 0;
y = 0;
w = 0;
h = 0;
};
};
};
class RscTitles {
class AGM_Optics_Scope {
idd = -1;
onLoad = "with uiNameSpace do { AGM_Optics_Scope = _this select 0 };";
onUnload = "";
movingEnable = 1;
duration = 10000;
controls[] = {"Reticle", "ReticleNight", "BodyNight", "Body"};
class Reticle {
colorBackground[] = {0,0,0, 0};
colorText[] = {1,1,1, 1};
fade = 0;
font = "PuristaMedium";
h = SafeZoneH;
idc = 1;
lineSpacing = 1.0;
movingEnable = 1;
size = 0;
sizeEx = 1;
style = 48;
text = "";
type = 0;
w = SafeZoneWAbs / ((getResolution select 0) / (getResolution select 1));
x = (SafeZoneXAbs + SafeZoneWAbs/2 - (SafeZoneWAbs / ((getResolution select 0) / (getResolution select 1)))/2);
y = SafeZoneY;
};
class ReticleNight : Reticle {
idc = 2;
text = "";
};
class Body : Reticle {
idc = 6;
text = "";
x = (SafeZoneXAbs + SafeZoneWAbs/2 - (SafeZoneWAbs / ((getResolution select 0) / (getResolution select 1))));
y = SafeZoneY - (SafeZoneH/2);
w = SafeZoneWAbs / ((getResolution select 0) / (getResolution select 1)) * 2;
h = SafeZoneH * 2;
};
class BodyNight : Body {
idc = 5;
text = "";
};
};
};
class PreloadTextures {
class CfgWeapons {
class optic_hamr {
AGM_Optics_body= "*";
AGM_Optics_bodyNight = "*";
AGM_Optics_reticle = "*";
AGM_Optics_reticleIllum = "*";
};
class optic_arco {
AGM_Optics_body= "*";
AGM_Optics_bodyNight = "*";
AGM_Optics_reticle = "*";
AGM_Optics_reticleIllum = "*";
};
class optic_mrco {
AGM_Optics_body= "*";
AGM_Optics_bodyNight = "*";
AGM_Optics_reticle = "*";
AGM_Optics_reticleIllum = "*";
};
class optic_LRPS {
AGM_Optics_body= "*";
AGM_Optics_bodyNight = "*";
AGM_Optics_reticle = "*";
AGM_Optics_reticleIllum = "*";
};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
ambient[]={0,0,0,0.89999998};
diffuse[]={0,0,0,0.89999998};
forcedDiffuse[]={0,0,0,1};
emmisive[]={0,0,0,1};
specular[]={0,0,0,0};
specularPower=1;
PixelShaderID="Normal";
VertexShaderID="Basic";

View File

@ -0,0 +1,20 @@
ambient[]={1,1,1,1};
diffuse[]={1,1,1,1};
forcedDiffuse[]={0,0,0,0};
emmisive[]={1,1,1,1};
specular[]={1,0.99956858,1,1};
specularPower=1;
PixelShaderID="Normal";
VertexShaderID="Basic";
class Stage1
{
texture="#(argb,8,8,3)color(0.5,0.5,0.5,0.5,DT)";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,149 @@
/*
* Original Author: Taosenai
* Adapted By: KoffeinFlummi
*
* Animates the scope when firing.
*
* Arguments:
* 0: Unit
* 1: Weapon
* 2: Muzzle
* 3: Mode
* 4: Ammo
* 5: Magazine
* 6: Projectile
*
* Return Value:
* None
*/
if (_this select 0 != AGM_player) exitwith {}; // Sanity check
0 = _this spawn {
disableSerialization;
_weaponType = _this select 1;
_config = configFile >> "CfgWeapons" >> _weaponType;
_scope = uiNameSpace getVariable "AGM_Optics_Scope";
// @todo
_recoilMulti = getNumber (_config >> "tmr_smallarms_recoil_shakeMultiplier"); // Will be 0 if undefined
if (_recoilMulti == 0) then {
_recoilMulti = 1;
};
if (_recoilMulti > 2.6) then {
_recoilMulti = 2.6; // Don't get too high
};
// Reduce the reticle movement as the player drops into lower, supported stances.
_detectStance = (player selectionPosition "Neck" select 2);
if (_detectStance < 1.3) then {
_recoilMulti = _recoilMulti - 0.10;
};
if (_detectStance < 0.7) then {
_recoilMulti = _recoilMulti - 0.20;
};
// Reduce reticle movement if the player is rested (tmr_autorest).
if (player getVariable ["tmr_autorest_rested", false]) then {
_recoilMulti = _recoilMulti - 0.20;
};
// Reduce reticle movement if the player is deployed (tmr_autorest).
if (player getVariable ["tmr_autorest_deployed", false]) then {
_recoilMulti = _recoilMulti - 0.30;
};
_recoilMulti = 1;
// @endtodo
// Constants which determine how the scope recoils
_recoilScope = 0.03 * _recoilMulti + random 0.0015;
_recoilRing = 0.03 * _recoilMulti + random 0.0015;
_randomScopeShiftX = 0.005 * _recoilMulti - random 0.011;
_randomReticleShiftX = 0.0036 * _recoilMulti + random 0.0045; // Always tend up and right;
_randomReticleShiftY = -0.0046 * _recoilMulti - random 0.0055;
/////////
// Center everything
// getResolution select 4 should return the aspect ratio, but it's totally wrong
// for triple head displays. We'll compute it manually.
_aspectRatio = (getResolution select 0) / (getResolution select 1);
_reticleX = (SafeZoneXAbs + SafeZoneWAbs/2 - (SafeZoneWAbs / _aspectRatio)/2);
_reticleY = SafeZoneY;
_reticleW = SafeZoneWAbs / _aspectRatio;
_reticleH = SafeZoneH;
// Reticle
(_scope displayCtrl 1) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
// Reticle night (illum)
(_scope displayCtrl 2) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
_bodyX = (SafeZoneXAbs + SafeZoneWAbs/2 - (SafeZoneWAbs / _aspectRatio));
_bodyY = SafeZoneY - (SafeZoneH/2);
_bodyW = SafeZoneWAbs / _aspectRatio * 2;
_bodyH = SafeZoneH * 2;
// Body night
(_scope displayCtrl 5) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
// Body
(_scope displayCtrl 6) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
_centerDelay = 0.01;
(_scope displayCtrl 1) ctrlCommit _centerDelay;
(_scope displayCtrl 2) ctrlCommit _centerDelay;
(_scope displayCtrl 5) ctrlCommit _centerDelay;
(_scope displayCtrl 6) ctrlCommit _centerDelay;
/////////
// Create and commit recoil effect
// Move reticle
(_scope displayCtrl 1) ctrlSetPosition [_reticleX - (_recoilScope/2) + _randomReticleShiftX, _reticleY - (_recoilScope/2) + _randomReticleShiftY, _reticleW + _recoilScope, _reticleH + _recoilScope];
(_scope displayCtrl 2) ctrlSetPosition [_reticleX - (_recoilScope/2) + _randomReticleShiftX, _reticleY - (_recoilScope/2) + _randomReticleShiftY, _reticleW + _recoilScope, _reticleH + _recoilScope];
// Move body
(_scope displayCtrl 5) ctrlSetPosition [_bodyX - (_recoilScope/2) + _randomScopeShiftX, _bodyY - (_recoilScope/2), _bodyW + _recoilScope, _bodyH + _recoilScope];
(_scope displayCtrl 6) ctrlSetPosition [_bodyX - (_recoilScope/2) + _randomScopeShiftX, _bodyY - (_recoilScope/2), _bodyW + _recoilScope, _bodyH + _recoilScope];
_recoilDelay = 0.036;
_fa = false;
_cwm = currentWeaponMode player;
if (_cwm == "FullAuto" || _cwm == "manual" || _cwm == "Burst") then {
_recoilDelay = getNumber (_config >> _cwm >> "reloadTime")/2.2;
_fa = true;
};
(_scope displayCtrl 1) ctrlCommit _recoilDelay;
(_scope displayCtrl 2) ctrlCommit _recoilDelay;
(_scope displayCtrl 5) ctrlCommit _recoilDelay;
(_scope displayCtrl 6) ctrlCommit _recoilDelay;
//////////////
waituntil {sleep 0.01; ctrlCommitted (_scope displayCtrl 6)};
//////////////
//////
// Bring them all back
(_scope displayCtrl 1) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
(_scope displayCtrl 2) ctrlSetPosition [_reticleX, _reticleY, _reticleW, _reticleH];
(_scope displayCtrl 5) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
(_scope displayCtrl 6) ctrlSetPosition [_bodyX, _bodyY, _bodyW, _bodyH];
_recenterDelay = 0.09;
if (_fa) then {
_recenterDelay = getNumber (_config >> _cwm >> "reloadTime")/2.2;
};
(_scope displayCtrl 1) ctrlCommit _recenterDelay;
(_scope displayCtrl 2) ctrlCommit _recenterDelay;
(_scope displayCtrl 5) ctrlCommit _recenterDelay;
(_scope displayCtrl 6) ctrlCommit _recenterDelay;
};

View File

@ -0,0 +1,19 @@
/*
* Original Author: Taosenai
* Adapted By: KoffeinFlummi
*
* Hides the scope.
*
*/
private ["_scope"];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 1) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 2) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 5) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 6) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 1) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 2) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 5) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 6) ctrlCommit 0;

View File

@ -0,0 +1,25 @@
/*
* Original Author: Taosenai
* Adapted By: KoffeinFlummi
*
* Initializes the scope resources.
*
*/
private ["_display"];
// Make sure we only cutRsc when the resource isn't already available
if (isNil {uiNameSpace getVariable "AGM_Optics_Scope"} or {isNull (uiNameSpace getVariable "AGM_Optics_Scope")}) exitWith {
AGM_Optics_scopeRSC cutRsc ["AGM_Optics_Scope","PLAIN",0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 1) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 2) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 5) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 6) ctrlSetTextColor [1,1,1,0];
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 1) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 2) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 5) ctrlCommit 0;
((uiNameSpace getVariable "AGM_Optics_Scope") displayCtrl 6) ctrlCommit 0;
True
};
False

View File

@ -0,0 +1,94 @@
/*
* Original Author: Taosenai
* Adapted By: KoffeinFlummi
*
* Monitors the RscInGameUI and displays the overlays when needed.
*
* Arguments:
* None
*
* Return Value:
* None
*/
if !(cameraOn == AGM_player && {alive AGM_player} && {!visibleMap} && {ctrlShown ((uinamespace getVariable "AGM_OpticsIGUI") displayCtrl 154)}) exitWith {
// Failed the state check, hide the scope if it's up
if (AGM_Optics_inScope) then {
// Hide the scope
AGM_Optics_inScope = false;
AGM_Optics_inScope_FOV = ([] call cba_fnc_getFOV) select 0;
[] call AGM_Optics_fnc_hideScope;
};
};
AGM_Optics_Camera setposATL (positioncameratoworld [0,0,0.4]);
AGM_Optics_Camera camPrepareTarget (positioncameratoworld [0,0,50]);
AGM_Optics_Camera camCommitPrepared 0;
if (cameraView == "Gunner") then {
AGM_Optics_Camera camsetFOV 0.7;
AGM_Optics_Camera camcommit 0;
} else {
AGM_Optics_Camera camsetFOV 0.01;
AGM_Optics_Camera camcommit 0;
};
private ["_optic", "_scope"];
disableSerialization;
// Get the name of the attached optic
_optic = (primaryWeaponItems AGM_player) select 2;
_scope = uiNameSpace getVariable "AGM_Optics_Scope";
// Init the scope (if needed)
[] call AGM_Optics_fnc_initScope;
// Check if the optic has changed since we last drew it
_doUpdateAllLayers = false;
if (AGM_Optics_currentOptic != _optic) then {
AGM_Optics_currentOptic = _optic;
_doUpdateAllLayers = true;
};
// Check if Splendid Camera, unit switch, etc. has blanked out our displays for no good reason (grrr)
if (ctrlText (_scope displayCtrl 1) == "") then {
_doUpdateAllLayers = true;
};
// Draw the correct layers (don't show them)
if (_doUpdateAllLayers) then {
(_scope displayCtrl 1) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "AGM_Optics_reticle");
(_scope displayCtrl 2) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "AGM_Optics_reticleIllum");
(_scope displayCtrl 5) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "AGM_Optics_bodyNight");
(_scope displayCtrl 6) ctrlSetText getText (configFile >> "CfgWeapons" >> _optic >> "AGM_Optics_body");
};
// Stop processing if already in the scope view and FOV hasn't changed
if (AGM_Optics_inScope) exitwith {};
// Mark that we're in enhanced scope view
AGM_Optics_inScope = true;
// Calculate lighting
_lighting = sunOrMoon; // 1 is day, 0 is night
_nightOpacity = 1;
_dayOpacity = (0 max moonIntensity * (1 - (0 max overcast)))/5;
if (_lighting == 1) then {
_nightOpacity = 0;
_dayOpacity = 1;
};
// Apply lighting and make layers visible
(_scope displayCtrl 1) ctrlSetTextColor [1,1,1,1];
(_scope displayCtrl 2) ctrlSetTextColor [1,1,1,_nightOpacity];
(_scope displayCtrl 5) ctrlSetTextColor [1,1,1,_nightOpacity];
(_scope displayCtrl 6) ctrlSetTextColor [1,1,1,_dayOpacity];
(_scope displayCtrl 1) ctrlCommit 0;
(_scope displayCtrl 2) ctrlCommit 0;
(_scope displayCtrl 5) ctrlCommit 0;
(_scope displayCtrl 6) ctrlCommit 0;

View File

@ -7,14 +7,22 @@ class CfgWeapons {
simulation = "ItemMineDetector"; simulation = "ItemMineDetector";
}; };
class Rifle_Base_F; class Rifle;
class Rifle_Base_F: Rifle {
class WeaponSlotsInfo;
};
class ACE_FakePrimaryWeapon: Rifle_Base_F { class ACE_FakePrimaryWeapon: Rifle_Base_F {
scope = 2;
displayName = "";
model = "";
picture = "";
magazines[] = {"ACE_FakeMagazine"};
discreteDistance[] = {}; discreteDistance[] = {};
discreteDistanceInitIndex = 0; discreteDistanceInitIndex = 0;
displayName = "";
picture = ""; class WeaponSlotsInfo: WeaponSlotsInfo {
model = ""; mass = 0;
magazines[] = {"ACE_FakeMagazine"}; };
scope = 2;
}; };
}; };

View File

@ -20,6 +20,19 @@ if (hasInterface) then {
}; };
}] call FUNC(addEventhandler); }] call FUNC(addEventhandler);
["fixCollision", DFUNC(fixCollision)] call FUNC(addEventhandler);
["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler);
["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler);
["lockVehicle", {
_this setVariable [QGVAR(lockStatus), locked _this];
_this lock 2;
}] call FUNC(addEventhandler);
["unlockVehicle", {
_this lock (_this getVariable [QGVAR(lockStatus), locked _this]);
}] call FUNC(addEventhandler);
// hack to get PFH to work in briefing // hack to get PFH to work in briefing
[QGVAR(onBriefingPFH), "onEachFrame", { [QGVAR(onBriefingPFH), "onEachFrame", {
if (time > 0) exitWith { if (time > 0) exitWith {
@ -86,6 +99,7 @@ GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312);
GVAR(OldCameraView) = cameraView; GVAR(OldCameraView) = cameraView;
GVAR(OldPlayerVehicle) = vehicle ACE_player; GVAR(OldPlayerVehicle) = vehicle ACE_player;
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
// PFH to raise varios events // PFH to raise varios events
[{ [{
@ -146,6 +160,14 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent); ["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
}; };
// "playerWeaponChanged" event
_newPlayerWeapon = currentWeapon ACE_player;
if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then {
// Raise ACE event locally
GVAR(OldPlayerWeapon) = _newPlayerWeapon;
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
};
}, 0, []] call cba_fnc_addPerFrameHandler; }, 0, []] call cba_fnc_addPerFrameHandler;
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable); [QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);

View File

@ -55,7 +55,10 @@ PREP(execPersistentFnc);
PREP(execRemoteFnc); PREP(execRemoteFnc);
PREP(executePersistent); PREP(executePersistent);
PREP(filter); PREP(filter);
PREP(fixCollision);
PREP(fixFloating);
PREP(fixLoweredRifleAnimation); PREP(fixLoweredRifleAnimation);
PREP(fixPosition);
PREP(getAllDefinedSetVariables); PREP(getAllDefinedSetVariables);
PREP(getAllGear); PREP(getAllGear);
PREP(getCaptivityStatus); PREP(getCaptivityStatus);

View File

@ -26,7 +26,7 @@ _exceptions = [_exceptions, {toLower _this}] call FUNC(map);
private "_owner"; private "_owner";
_owner = _target getVariable [QGVAR(owner), objNull]; _owner = _target getVariable [QGVAR(owner), objNull];
if (!isNull _owner && {_unit != _owner} && {!([_owner] call FUNC(isPlayer))}) exitWith {false}; if (!isNull _owner && {_unit != _owner}) exitWith {false};
// check general conditions // check general conditions

View File

@ -0,0 +1,21 @@
/*
* Author: commy2
* Attempt to fix physx collisions causing unreasonable impact forces and damage.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return Value:
* Nothing
*
*/
#include "script_component.hpp"
// allowDamage requires local object
if (!local _this) exitWith {};
// prevent collision damage, @todo allowDamage API
_this allowDamage false;
// re-allow damage after 2 seconds
[{_this allowDamage true}, _this, 2, 0] call EFUNC(common,waitAndExecute);

View File

@ -0,0 +1,32 @@
/*
* Author: commy2
* Attempt to fix floating physx with disabled damage after setPosXXX commands.
*
* Arguments:
* Physx object (Object)
*
* Return Value:
* Nothing
*
*/
#include "script_component.hpp"
private "_object";
_object = _this;
// setHitPointDamage requires local object
if (!local _object) exitWith {};
// save and restore hitpoints, see below why
private ["_hitPoints", "_hitPointDamages"];
_hitPoints = [_object] call FUNC(getHitpoints);
_hitPointDamages = [_hitPoints, {_object getHitPointDamage _this}] call FUNC(map);
// this prevents physx objects from floating when near other physx objects with allowDamage false
_object setDamage damage _object;
{
_object setHitPointDamage [_x, _hitPointDamages select _forEachIndex];
} forEach _hitPoints;

View File

@ -0,0 +1,29 @@
/*
* Author: commy2
*
* Fixes position of an object. E.g. moves object above ground and adjusts to terrain slope. Requires local object.
*
* Argument:
* Object (Object)
*
* Return value:
* NONE
*/
#include "script_component.hpp"
// setVectorUp requires local object
if (!local _this) exitWith {};
private "_position";
_position = getPos _this;
// don't place the object below the ground
if (_position select 2 < -0.1) then {
_position set [2, -0.1];
_this setPos _position;
};
// adjust position to sloped terrain, if placed on ground
if (getPosATL _this select 2 == _position select 2) then {
_this setVectorUp surfaceNormal _position;
};

View File

@ -1,24 +1,24 @@
/* /*
* Author: commy2, Glowbal, PabstMirror * Author: commy2, Glowbal, PabstMirror
* *
* Draw progress bar and execute given function if succesful. * Draw progress bar and execute given function if succesful.
* Finish/Failure/Conditional are all passed [_args, _elapsedTime, _totalTime, _errorCode] * Finish/Failure/Conditional are all passed [_args, _elapsedTime, _totalTime, _errorCode]
* *
* Argument: * Argument:
* 0: NUMBER - Total Time (in game "time" seconds) * 0: NUMBER - Total Time (in game "time" seconds)
* 1: ARRAY - Arguments, passed to condition, fail and finish * 1: ARRAY - Arguments, passed to condition, fail and finish
* 2: CODE or STRING - On Finish: Code called or STRING raised as event. * 2: CODE or STRING - On Finish: Code called or STRING raised as event.
* 3: CODE or STRING - On Failure: Code called or STRING raised as event. * 3: CODE or STRING - On Failure: Code called or STRING raised as event.
* 4: STRING - (Optional) Localized Title * 4: STRING - (Optional) Localized Title
* 5: CODE - (Optional) Code to check each frame * 5: CODE - (Optional) Code to check each frame
* 6: ARRAY - (Optional) Exceptions for checking EGVAR(common,canInteractWith) * 6: ARRAY - (Optional) Exceptions for checking EFUNC(common,canInteractWith)
* *
* Return value: * Return value:
* Nothing * Nothing
* *
* Example: * Example:
* [5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar * [5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar
*/ */
#include "script_component.hpp" #include "script_component.hpp"
@ -36,65 +36,69 @@ createDialog QGVAR(ProgressBar_Dialog);
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle; (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle;
if (GVAR(SettingProgressBarLocation) == 1) then { if (GVAR(SettingProgressBarLocation) == 1) then {
private "_ctrlPos"; private "_ctrlPos";
_ctrlPos = [1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2), 29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2), 38 * (((safezoneW / safezoneH) min 1.2) / 40), 0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)]; _ctrlPos = [1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2), 29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2), 38 * (((safezoneW / safezoneH) min 1.2) / 40), 0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)];
(uiNamespace getVariable QGVAR(ctrlProgressBar)) ctrlSetPosition _ctrlPos; (uiNamespace getVariable QGVAR(ctrlProgressBar)) ctrlSetPosition _ctrlPos;
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetPosition _ctrlPos; (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetPosition _ctrlPos;
(uiNamespace getVariable QGVAR(ctrlProgressBar)) ctrlCommit 0; (uiNamespace getVariable QGVAR(ctrlProgressBar)) ctrlCommit 0;
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlCommit 0; (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlCommit 0;
}; };
_perFrameFunction = { _perFrameFunction = {
PARAMS_2(_parameters,_pfhID); PARAMS_2(_parameters,_pfhID);
EXPLODE_8_PVT(_parameters,_args,_onFinish,_onFail,_condition,_player,_startTime,_totalTime,_exceptions); EXPLODE_8_PVT(_parameters,_args,_onFinish,_onFail,_condition,_player,_startTime,_totalTime,_exceptions);
private ["_elapsedTime", "_errorCode"]; private ["_elapsedTime", "_errorCode"];
_elapsedTime = time - _startTime; _elapsedTime = time - _startTime;
_errorCode = -1; _errorCode = -1;
if (isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then { if (isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then {
_errorCode = 1; _errorCode = 1;
} else {
if (ACE_player != _player) then {
_errorCode = 2;
} else { } else {
if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then { if (ACE_player != _player) then {
_errorCode = 3; _errorCode = 2;
} else {
if (!([_player, objNull, _exceptions] call EGVAR(common,canInteractWith))) then {
_errorCode = 4;
} else { } else {
if (_elapsedTime >= _totalTime) then { if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then {
_errorCode = 0; _errorCode = 3;
}; } else {
if (!([_player, objNull, _exceptions] call EFUNC(common,canInteractWith))) then {
_errorCode = 4;
} else {
if (_elapsedTime >= _totalTime) then {
_errorCode = 0;
};
};
};
}; };
};
}; };
};
if (_errorCode != -1) then { if (_errorCode != -1) then {
//Error or Success, close dialog and remove PFEH //Error or Success, close dialog and remove PFEH
closeDialog 0;
[_pfhID] call CBA_fnc_removePerFrameHandler;
if (_errorCode == 0) then { //Only close dialog if it's the progressBar:
if ((typeName _onFinish) == (typeName "")) then { if (!isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then {
[_onFinish, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); closeDialog 0;
} else { };
[_args, _elapsedTime, _totalTime, _errorCode] call _onFinish; [_pfhID] call CBA_fnc_removePerFrameHandler;
};
if (_errorCode == 0) then {
if ((typeName _onFinish) == (typeName "")) then {
[_onFinish, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent);
} else {
[_args, _elapsedTime, _totalTime, _errorCode] call _onFinish;
};
} else {
if ((typeName _onFail) == (typeName "")) then {
[_onFail, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent);
} else {
[_args, _elapsedTime, _totalTime, _errorCode] call _onFail;
};
};
} else { } else {
if ((typeName _onFail) == (typeName "")) then { //Update Progress Bar (ratio of elepased:total)
[_onFail, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); (uiNamespace getVariable QGVAR(ctrlProgressBar)) progressSetPosition (_elapsedTime / _totalTime);
} else {
[_args, _elapsedTime, _totalTime, _errorCode] call _onFail;
};
}; };
} else {
//Update Progress Bar (ratio of elepased:total)
(uiNamespace getVariable QGVAR(ctrlProgressBar)) progressSetPosition (_elapsedTime / _totalTime);
};
}; };
[_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler; [_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler;

View File

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

View File

@ -0,0 +1,47 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
serverInit = QUOTE(call COMPILE_FILE(XEH_serverInit));
};
};
class Extended_Init_EventHandlers {
class StaticWeapon {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class StaticMortar {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class ReammoBox_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
};
class Extended_Killed_EventHandlers {
class CAManBase {
class ADDON {
killed = QUOTE(_this call DFUNC(handleKilled));
};
};
};
class Extended_AnimChanged_EventHandlers {
class CAManBase {
class ADDON {
animChanged = QUOTE(_this call DFUNC(handleAnimChanged));
};
};
};

View File

@ -0,0 +1,86 @@
class CfgVehicles {
// Static weapons
class LandVehicle;
class StaticWeapon: LandVehicle {
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1.2,0};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragDirection) = 0;
};
//remove actions from Taru Pods
class Pod_Heli_Transport_04_base_F: StaticWeapon {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
class StaticMortar;
class Mortar_01_base_F: StaticMortar {
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1.2,0};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragDirection) = 0;
};
// ammo boxes
class ThingX;
class ReammoBox_F: ThingX {
XEH_ENABLED;
GVAR(canCarry) = 0;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 0;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragDirection) = 0;
};
class Slingload_base_F: ReammoBox_F {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
class EAST_Box_Base: ReammoBox_F {
GVAR(canCarry) = 1;
GVAR(canDrag) = 1;
};
class IND_Box_Base: ReammoBox_F {
GVAR(canCarry) = 1;
GVAR(canDrag) = 1;
};
/*class FIA_Box_Base_F: ReammoBox_F {
GVAR(canCarry) = 1;
GVAR(canDrag) = 1;
};*/
class NATO_Box_Base: ReammoBox_F {
GVAR(canCarry) = 1;
GVAR(canDrag) = 1;
};
// Remove Larger crate dragging support.
// Would be better to allow some sort of joint push/drag functionality
// Requiring 2 units to access the larger crates and attaching them together (a crappy method of doing it)
// in order to move the bigger ones. Currently simply remove support.
// I believe these crates are currently broken (hitbox doesn't work or something) in 1.22 (2014-07-04)
class Box_East_AmmoVeh_F: EAST_Box_Base {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
class Box_NATO_AmmoVeh_F: NATO_Box_Base {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
class Box_IND_AmmoVeh_F: IND_Box_Base {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
};

View File

@ -0,0 +1,19 @@
// by PabstMirror, commy2
#include "script_component.hpp"
[{_this call DFUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler);
if (isNil "ACE_maxWeightDrag") then {
ACE_maxWeightDrag = 800;
};
if (isNil "ACE_maxWeightCarry") then {
ACE_maxWeightCarry = 600;
};
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
// release object on player change. This does work when returning to lobby, but not when hard disconnecting.
["playerChanged", {_this call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
["playerWeaponChanged", {_this call DFUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler);

View File

@ -0,0 +1,28 @@
#include "script_component.hpp"
ADDON = false;
PREP(canCarry);
PREP(canDrag);
PREP(canDrop);
PREP(canDrop_carry);
PREP(carryObject);
PREP(carryObjectPFH);
PREP(dragObject);
PREP(dragObjectPFH);
PREP(dropObject);
PREP(dropObject_carry);
PREP(getWeight);
PREP(handleAnimChanged);
PREP(handleKilled);
PREP(handlePlayerChanged);
PREP(handlePlayerWeaponChanged);
PREP(handleScrollWheel);
PREP(initObject);
PREP(isObjectOnObject);
PREP(setCarryable);
PREP(setDraggable);
PREP(startDrag);
PREP(startDragPFH);
ADDON = true;

View File

@ -0,0 +1,5 @@
// by commy2
#include "script_component.hpp"
// release object on hard disconnection. Function is identical to killed
addMissionEventHandler ["HandleDisconnect", {_this call DFUNC(handleKilled)}];

View File

@ -0,0 +1,16 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common","ace_interaction","ace_interact_menu"};
author[] = {"Garth 'L-H' de Wet","commy2"};
authorUrl = "https://github.com/commy2/";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"

View File

@ -0,0 +1,25 @@
/*
* Author: commy2
*
* 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)
*
* Return value:
* Can the unit carry the object? (Bool)
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
// a static weapon has to be empty for dragging
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
alive _target && {_target getVariable [QGVAR(canCarry), false]}

View File

@ -0,0 +1,25 @@
/*
* Author: commy2
*
* 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)
*
* Return value:
* Can the unit drag the object? (Bool)
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
// a static weapon has to be empty for dragging
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
alive _target && {_target getVariable [QGVAR(canDrag), false]}

View File

@ -0,0 +1,22 @@
/*
* Author: commy2
*
* Check if unit can drop the object.
*
* Argument:
* 0: Unit that currently drags a object (Object)
* 1: Object that is dragged (Object)
*
* Return value:
* Can the unit drop the object? (Bool)
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
if !([_unit, _target, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false};
_unit getVariable [QGVAR(draggedObject), objNull] == _target

View File

@ -0,0 +1,22 @@
/*
* Author: commy2
*
* Check if unit can drop the carried object.
*
* Argument:
* 0: Unit that currently carries a object (Object)
* 1: Object that is carried (Object)
*
* Return value:
* Can the unit drop the object? (Bool)
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
if !([_unit, _target, ["isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false};
_unit getVariable [QGVAR(carriedObject), objNull] == _target

View File

@ -0,0 +1,80 @@
/*
* Author: commy2
*
* Carry an object.
*
* Argument:
* 0: Unit that should do the carrying (Object)
* 1: Object to carry (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// check weight
private "_weight";
_weight = [_target] call FUNC(getWeight);
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
[localize "STR_ACE_Dragging_UnableToDrag"] call EFUNC(common,displayTextStructured);
};
// select no weapon and stop sprinting
_unit action ["SwitchWeapon", _unit, _unit, 99];
[_unit, "isDragging", true] call EFUNC(common,setforceWalkStatus);
// prevent multiple players from accessing the same object
[_unit, _target, true] call EFUNC(common,claim);
// get attachTo offset and direction.
private ["_position", "_direction"];
_position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]];
_direction = _target getVariable [QGVAR(carryDirection), 0];
// add height offset of model
private "_offset";
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
_position = _position vectorAdd [0, 0, _offset];
// attach object
_target attachTo [_unit, _position];
_target setDir _direction;
_unit setVariable [QGVAR(isCarrying), true, true];
_unit setVariable [QGVAR(carriedObject), _target, true];
// add scrollwheel action to release object
private "_actionID";
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
};
_actionID = _unit addAction [
format ["<t color='#FF0000'>%1</t>", localize "STR_ACE_Dragging_Drop"],
QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)])] call FUNC(dropObject_carry)),
nil,
20,
false,
true,
"",
QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)]))
];
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
// check everything
[FUNC(carryObjectPFH), 0, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
// reset current dragging height.
GVAR(currentHeightChange) = 0;

View File

@ -0,0 +1,13 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0 select 0;
_target = _this select 0 select 1;
// drop if the crate is destroyed
if !([_target] call EFUNC(common,isAlive)) then {
[_unit, _target] call FUNC(dropObject_carry);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};

View File

@ -0,0 +1,64 @@
/*
* Author: commy2
*
* Drag an object. Called from ace_dragging_fnc_startDrag
*
* Argument:
* 0: Unit that should do the dragging (Object)
* 1: Object to drag (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// 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 modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
_position = _position vectorAdd [0, 0, _offset];
// attach object
_target attachTo [_unit, _position];
_target setDir _direction;
_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 {
_unit removeAction _actionID;
};
_actionID = _unit addAction [
format ["<t color='#FF0000'>%1</t>", localize "STR_ACE_Dragging_Drop"],
QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])] call FUNC(dropObject)),
nil,
20,
false,
true,
"",
QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)]))
];
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
// check everything
[FUNC(dragObjectPFH), 0, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
// reset current dragging height.
GVAR(currentHeightChange) = 0;

View File

@ -0,0 +1,13 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0 select 0;
_target = _this select 0 select 1;
// drop if the crate is destroyed
if !([_target] call EFUNC(common,isAlive)) then {
[_unit, _target] call FUNC(dropObject);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};

View File

@ -0,0 +1,50 @@
/*
* Author: commy2
*
* Drop a dragged object.
*
* Argument:
* 0: Unit that drags the other object (Object)
* 1: Dragged object to drop (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// remove scroll wheel action
_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]);
private "_inBuilding";
_inBuilding = [_unit] call FUNC(isObjectOnObject);
// play release animation
_unit playAction "released";
// prevent collision damage
["fixCollision", _unit, _unit] call EFUNC(common,targetEvent);
["fixCollision", _target, _target] call EFUNC(common,targetEvent);
// release object
detach _target;
_unit removeWeapon "ACE_FakePrimaryWeapon";
// prevent object from flipping inside buildings
if (_inBuilding) then {
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
};
_unit setVariable [QGVAR(isDragging), false, true];
_unit setVariable [QGVAR(draggedObject), objNull, true];
// make object accesable for other units
[objNull, _target, true] call EFUNC(common,claim);
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
["fixFloating", _target, _target] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,50 @@
/*
* Author: commy2
*
* Drop a carried object.
*
* Argument:
* 0: Unit that carries the other object (Object)
* 1: Carried object to drop (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// remove scroll wheel action
_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]);
private "_inBuilding";
_inBuilding = [_unit] call FUNC(isObjectOnObject);
// prevent collision damage
["fixCollision", _unit, _unit] call EFUNC(common,targetEvent);
["fixCollision", _target, _target] call EFUNC(common,targetEvent);
// release object
detach _target;
// reselect weapon and re-enable sprint
_unit selectWeapon primaryWeapon _unit;
[_unit, "isDragging", false] call EFUNC(common,setforceWalkStatus);
// prevent object from flipping inside buildings
if (_inBuilding) then {
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
};
_unit setVariable [QGVAR(isCarrying), false, true];
_unit setVariable [QGVAR(carriedObject), objNull, true];
// make object accesable for other units
[objNull, _target, true] call EFUNC(common,claim);
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
["fixFloating", _target, _target] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,54 @@
/*
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;
*/
#include "script_component.hpp"
private "_object";
_object = _this select 0;
private ["_totalWeight", "_fnc","_fnc_Extra"];
_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).
_totalWeight

View File

@ -0,0 +1,31 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_anim"];
_unit = _this select 0;
_anim = _this select 1;
if (_unit getVariable [QGVAR(isDragging), false]) then {
// drop dragged object when not in valid animation
if !(_anim in DRAG_ANIMATIONS) then {
private "_draggedObject";
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
};
};
if (_unit getVariable [QGVAR(isCarrying), false]) then {
// drop carried object when not standing
if (stance _unit != "STAND") then {
private "_carriedObject";
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
[_unit, _carriedObject] call FUNC(dropObject_carry);
};
};

View File

@ -0,0 +1,20 @@
// by commy2
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;
if (_unit getVariable [QGVAR(isDragging), false]) then {
private "_draggedObject";
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
};
if (_unit getVariable [QGVAR(isCarrying), false]) then {
private "_carriedObject";
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
[_unit, _carriedObject] call FUNC(dropObject_carry);
};

View File

@ -0,0 +1,17 @@
// by commy2
#include "script_component.hpp"
private ["_newPlayer", "_oldPlayer"];
_newPlayer = _this select 0;
_oldPlayer = _this select 1;
{
if (_x getVariable [QGVAR(isDragging), false]) then {
[_x, _x getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
};
if (_x getVariable [QGVAR(isCarrying), false]) then {
[_x, _x getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry);
};
} forEach [_newPlayer, _oldPlayer];

View File

@ -0,0 +1,31 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_weapon"];
_unit = _this select 0;
_weapon = _this select 1;
if (_unit getVariable [QGVAR(isDragging), false]) then {
// drop dragged object when selecting a non-primary weapon
if (_weapon != primaryWeapon _unit) then {
private "_draggedObject";
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
};
};
if (_unit getVariable [QGVAR(isCarrying), false]) then {
// drop carried object when selecting any weapon
if (_weapon != "") then {
private "_carriedObject";
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
[_unit, _carriedObject] call FUNC(dropObject_carry);
};
};

View File

@ -0,0 +1,45 @@
/*
* Author: L-H, commy2
*
* Handles raising and lowering the dragged weapon to be able to place it on top of objects.
*
* Argument:
* 0: Scroll amount (Number)
*
* Return value:
* Handled or not. (Bool)
*/
#include "script_component.hpp"
// requires modifier key to be hold down
if (GETMVAR(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];
private ["_position", "_maxHeight"];
_position = getPosATL _carriedItem;
_maxHeight = (_unit ModelToWorld [0,0,0]) select 2;
_position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight];
// move up/down object and reattach at current position
detach _carriedItem;
_carriedItem setPosATL _position;
_carriedItem attachTo [_unit];
true

View File

@ -0,0 +1,37 @@
/*
* Author: commy2
*
* Initialize variables for drag or carryable objects. Called from init EH.
*
* Argument:
* 0: Any object (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private "_object";
_object = _this select 0;
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));
[_object, true, _position, _direction] call FUNC(setDraggable);
};
if (getNumber (_config >> QGVAR(canCarry)) == 1) then {
private ["_position", "_direction"];
_position = getArray (_config >> QGVAR(carryPosition));
_direction = getNumber (_config >> QGVAR(carryDirection));
[_object, true, _position, _direction] call FUNC(setCarryable);
};

View File

@ -0,0 +1,6 @@
// by commy2
private "_object";
_object = _this select 0;
(getPosATL _object select 2) - (getPos _object select 2) > 1E-5

View File

@ -0,0 +1,52 @@
/*
* Author: commy2
*
* 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)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_object", "_enableCarry", "_position", "_direction"];
_this resize 4;
_object = _this select 0;
_enableCarry = _this select 1;
_position = _this select 2;
_direction = _this select 3;
if (isNil "_position") then {
_position = _object getVariable [QGVAR(carryPosition), [0,1,1]];
};
if (isNil "_direction") then {
_direction = _object getVariable [QGVAR(carryDirection), 0];
};
// update variables
_object setVariable [QGVAR(canCarry), _enableCarry];
_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,[]);
// do nothing if the class is already initialized
if (_type in _initializedClasses) exitWith {};
_initializedClasses pushBack _type;
GVAR(initializedClasses_carry) = _initializedClasses;
[_type, 0, ["ACE_MainActions", QGVAR(carry)], localize "STR_ACE_Dragging_Carry", "", "", {[_player, _target] call FUNC(carryObject)}, {[_player, _target] call FUNC(canCarry)}, 2] call EFUNC(interact_menu,addClassAction);
[_type, 0, ["ACE_MainActions", QGVAR(drop_carry)], localize "STR_ACE_Dragging_Drop", "", "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}, 2] call EFUNC(interact_menu,addClassAction);

View File

@ -0,0 +1,52 @@
/*
* Author: commy2
*
* Enable the object to be dragged.
*
* Argument:
* 0: Any object (Object)
* 1: true to enable dragging, false to disable (Bool)
* 2: Position offset for attachTo command (Array, optinal; default: [0,0,0])
* 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_object", "_enableDrag", "_position", "_direction"];
_this resize 4;
_object = _this select 0;
_enableDrag = _this select 1;
_position = _this select 2;
_direction = _this select 3;
if (isNil "_position") then {
_position = _object getVariable [QGVAR(dragPosition), [0,0,0]];
};
if (isNil "_direction") then {
_direction = _object getVariable [QGVAR(dragDirection), 0];
};
// update variables
_object setVariable [QGVAR(canDrag), _enableDrag];
_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,[]);
// do nothing if the class is already initialized
if (_type in _initializedClasses) exitWith {};
_initializedClasses pushBack _type;
GVAR(initializedClasses) = _initializedClasses;
[_type, 0, ["ACE_MainActions", QGVAR(drag)], localize "STR_ACE_Dragging_Drag", "", "", {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}, 2] call EFUNC(interact_menu,addClassAction);
[_type, 0, ["ACE_MainActions", QGVAR(drop)], localize "STR_ACE_Dragging_Drop", "", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}, 2] call EFUNC(interact_menu,addClassAction);

View File

@ -0,0 +1,43 @@
/*
* Author: commy2
*
* Start the dragging process.
*
* Argument:
* 0: Unit that should do the dragging (Object)
* 1: Object to drag (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// check weight
private "_weight";
_weight = [_target] call FUNC(getWeight);
if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith {
[localize "STR_ACE_Dragging_UnableToDrag"] call EFUNC(common,displayTextStructured);
};
// add a primary weapon if the unit has none.
// @todo prevent opening inventory when equipped with a fake weapon
if (primaryWeapon _unit == "") then {
_unit addWeapon "ACE_FakePrimaryWeapon";
};
// select primary, otherwise the drag animation actions don't work.
_unit selectWeapon primaryWeapon _unit;
// prevent multiple players from accessing the same object
[_unit, _target, true] call EFUNC(common,claim);
// can't play action that depends on weapon if it was added the same frame
[{_this playActionNow "grabDrag";}, _unit] call EFUNC(common,execNextFrame);
[FUNC(startDragPFH), 0.2, [_unit, _target, time + 5]] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1,20 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_target", "_timeOut"];
_unit = _this select 0 select 0;
_target = _this select 0 select 1;
_timeOut = _this select 0 select 2;
// timeout. Do nothing. Quit. time, because anim length is linked to ingame time.
if (time > _timeOut) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
// unit is ready to start dragging
if (animationState _unit in DRAG_ANIMATIONS) exitWith {
[_unit, _target] call FUNC(dragObject);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};

View File

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

View File

@ -0,0 +1,14 @@
#define COMPONENT dragging
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_DRAGGING
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_ENABLED_DRAGGING
#define DEBUG_SETTINGS DEBUG_ENABLED_DRAGGING
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define DRAG_ANIMATIONS ["amovpercmstpslowwrfldnon_acinpknlmwlkslowwrfldb_2", "amovpercmstpsraswpstdnon_acinpknlmwlksnonwpstdb_2", "amovpercmstpsnonwnondnon_acinpknlmwlksnonwnondb_2", "acinpknlmstpsraswrfldnon", "acinpknlmstpsnonwpstdnon", "acinpknlmstpsnonwnondnon", "acinpknlmwlksraswrfldb", "acinpknlmwlksnonwnondb"]

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-21 -->
<Project name="ACE">
<Package name="Dragging">
<Key ID="STR_ACE_Dragging_Drag">
<English>Drag</English>
<Russian>Тащить</Russian>
<Spanish>Arrastrar</Spanish>
<Polish>Ciągnij</Polish>
<Czech>Táhnout</Czech>
<French>Tracter</French>
<German>Ziehen</German>
<Portuguese>Arrastar</Portuguese>
<Italian>Trascina</Italian>
<Hungarian>Húzás</Hungarian>
</Key>
<Key ID="STR_ACE_Dragging_Drop">
<English>Release</English>
<Russian>Отпустить</Russian>
<Spanish>Soltar</Spanish>
<Polish>Puść</Polish>
<Czech>Položit</Czech>
<French>Lâcher</French>
<German>Loslassen</German>
<Portuguese>Largar</Portuguese>
<Italian>Lascia</Italian>
<Hungarian>Elengedés</Hungarian>
</Key>
<Key ID="STR_ACE_Dragging_UnableToDrag">
<English>Item to heavy</English>
<German>Gegenstand zu schwer</German>
<!-- <English>Unable to drag item due to weight</English>
<Russian>Слишком тяжелый предмет</Russian>
<Spanish>No se puede arrastrar el objeto debido a su peso</Spanish>
<Polish>Nie można ciągnąć tego przedmiotu z powodu jego wagi</Polish>
<Czech>Předmět je příliž těžký!</Czech>
<French>Trop lourd pour être tracté</French>
<German>Dieser Gegenstand kann nicht gezogen werden, da er zu schwer ist.</German>
<Portuguese>Não é possível carregar o item devido a seu peso</Portuguese>
<Italian>Non è possibile trascinare l'oggetto a causa del suo peso</Italian>
<Hungarian>Túl nehéz ahhoz, hogy elhúzd</Hungarian> -->
</Key>
<Key ID="STR_ACE_Dragging_Carry">
<English>Carry</English>
<German>Tragen</German>
<Spanish>Portar</Spanish>
<Polish>Nieś</Polish>
<French>Porter</French>
<Czech>Nést</Czech>
<Portuguese>Carregar</Portuguese>
<Italian>Trascina</Italian>
<Hungarian>Felvesz</Hungarian>
<Russian>Нести</Russian>
</Key>
</Package>
</Project>

View File

@ -36,6 +36,11 @@ class Extended_Init_EventHandlers {
serverInit = QUOTE(_this call FUNC(vehicleInit)); serverInit = QUOTE(_this call FUNC(vehicleInit));
}; };
}; };
class StaticWeapon {
class ADDON {
serverInit = QUOTE(_this call FUNC(vehicleInit));
};
};
}; };
class Extended_Respawn_EventHandlers { class Extended_Respawn_EventHandlers {
@ -64,6 +69,11 @@ class Extended_Respawn_EventHandlers {
respawn = QUOTE(_this call FUNC(vehicleInit)); respawn = QUOTE(_this call FUNC(vehicleInit));
}; };
}; };
class StaticWeapon {
class ADDON {
respawn = QUOTE(_this call FUNC(vehicleInit));
};
};
}; };
class Extended_FiredBIS_EventHandlers { class Extended_FiredBIS_EventHandlers {
@ -92,4 +102,9 @@ class Extended_FiredBIS_EventHandlers {
firedBIS = QUOTE(_this call FUNC(firedEH)); firedBIS = QUOTE(_this call FUNC(firedEH));
}; };
}; };
class StaticWeapon {
class ADDON {
firedBIS = QUOTE(_this call FUNC(firedEH));
};
};
}; };

View File

@ -3,7 +3,7 @@
["ACE3", QGVAR(lazeTarget), localize "STR_ACE_FCS_LaseTarget", ["ACE3", QGVAR(lazeTarget), localize "STR_ACE_FCS_LaseTarget",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
@ -20,7 +20,7 @@
GVAR(isDownStateKey1) = false; GVAR(isDownStateKey1) = false;
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false}; if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false};
@ -33,7 +33,7 @@
["ACE3", QGVAR(adjustRangeUp), localize "STR_ACE_FCS_AdjustRangeUp", ["ACE3", QGVAR(adjustRangeUp), localize "STR_ACE_FCS_AdjustRangeUp",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};
@ -47,7 +47,7 @@
["ACE3", QGVAR(adjustRangDown), localize "STR_ACE_FCS_AdjustRangeDown", ["ACE3", QGVAR(adjustRangDown), localize "STR_ACE_FCS_AdjustRangeDown",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};

View File

@ -13,7 +13,7 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
["ACE3", QGVAR(switchGrenadeMode), localize "STR_ACE_Grenades_SwitchGrenadeMode", ["ACE3", QGVAR(switchGrenadeMode), localize "STR_ACE_Grenades_SwitchGrenadeMode",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, ["isNotEscorting"]] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false}; if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false};

View File

@ -40,6 +40,7 @@ GVAR(lastPath) = [];
GVAR(expanded) = false; GVAR(expanded) = false;
GVAR(startHoverTime) = diag_tickTime; GVAR(startHoverTime) = diag_tickTime;
GVAR(expandedTime) = diag_tickTime;
GVAR(iconCtrls) = []; GVAR(iconCtrls) = [];
GVAR(iconCount) = 0; GVAR(iconCount) = 0;

View File

@ -46,7 +46,7 @@ _recurseFnc = {
if (_condition == "") then {_condition = "true"}; if (_condition == "") then {_condition = "true"};
// Add canInteract (including exceptions) and canInteractWith to condition // Add canInteract (including exceptions) and canInteractWith to condition
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EGVAR(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;

View File

@ -43,7 +43,7 @@ _recurseFnc = {
if (_condition == "") then {_condition = "true"}; if (_condition == "") then {_condition = "true"};
// Add canInteract (including exceptions) and canInteractWith to condition // Add canInteract (including exceptions) and canInteractWith to condition
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, objNull, %1)] call EGVAR(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, objNull, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;

View File

@ -166,6 +166,7 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
} else { } else {
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then { if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then {
GVAR(expanded) = true; GVAR(expanded) = true;
GVAR(expandedTime) = diag_tickTime;
GVAR(menuDepthPath) = +GVAR(lastPath); GVAR(menuDepthPath) = +GVAR(lastPath);
// Execute the current action if it's run on hover // Execute the current action if it's run on hover

View File

@ -21,7 +21,7 @@ EXPLODE_4_PVT(_this,_object,_action,_pos,_angles);
EXPLODE_2_PVT(_action,_actionData,_activeChildren); EXPLODE_2_PVT(_action,_actionData,_activeChildren);
EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan); EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan);
_menuDepth = (count GVAR(menuDepthPath)) - 1; _menuDepth = (count GVAR(menuDepthPath));
// Store path to action // Store path to action
_path = [_object] + (_actionData select 7); _path = [_object] + (_actionData select 7);
@ -42,7 +42,7 @@ _menuInSelectedPath = true;
_color = "#FFFFFFFF"; _color = "#FFFFFFFF";
if(!_menuInSelectedPath) then { //_menuDepth > 0 && if(!_menuInSelectedPath) then { //_menuDepth > 0 &&
if (_menuDepth > 0) then { if (_menuDepth > 0) then {
_color = format ["#%1FFFFFF", [255 * ((((count _path) - 2)/_menuDepth) max 0.25)] call EFUNC(common,toHex)]; _color = format ["#%1FFFFFF", [255 * ((((count _path) - 1)/_menuDepth) max 0.25)] call EFUNC(common,toHex)];
} else { } else {
_color = format ["#%1FFFFFF", [255 * 0.75] call EFUNC(common,toHex)]; _color = format ["#%1FFFFFF", [255 * 0.75] call EFUNC(common,toHex)];
}; };
@ -55,24 +55,42 @@ GVAR(currentOptions) pushBack [_this, _pos, _path];
// Exit without rendering children if it isn't // Exit without rendering children if it isn't
if !(_menuInSelectedPath) exitWith {true}; if !(_menuInSelectedPath) exitWith {true};
private ["_angleSpan","_angle"]; private ["_angleSpan","_angle","_angleInterval","_scale"];
_angleSpan = _maxAngleSpan min (55 * ((count _activeChildren) - 1)); _angleSpan = _maxAngleSpan min (55 * ((count _activeChildren) - 1));
if (_angleSpan >= 305) then { if (_angleSpan >= 305) then {
_angleSpan = 360; _angleSpan = 360;
}; };
_angleInterval = 55;
if (_angleSpan < 360) then {
if (count _activeChildren > 1) then {
_angleInterval = _angleSpan / (count _activeChildren - 1);
};
} else {
_angleSpan / (count _activeChildren);
};
if (count _activeChildren == 1) then {
_angleInterval = 60;
};
// Scale menu based on distance
_scale = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale);
// Scale menu based on the amount of children
_scale = _scale * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.4) max 0.5);
// Animate menu scale
if (_menuInSelectedPath && (_menuDepth == count _path)) then {
_scale = _scale * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * 8) min 1));
};
_angle = _centerAngle - _angleSpan / 2; _angle = _centerAngle - _angleSpan / 2;
{ {
_target = _object; _target = _object;
_player = ACE_player; _player = ACE_player;
_mod = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale); _offset = ((GVAR(refSystem) select 1) vectorMultiply (-_scale * cos _angle)) vectorAdd
((GVAR(refSystem) select 2) vectorMultiply (-_scale * sin _angle));
_offset = ((GVAR(refSystem) select 1) vectorMultiply (-_mod * cos _angle)) vectorAdd
((GVAR(refSystem) select 2) vectorMultiply (-_mod * sin _angle));
_newPos = ((_pos call EFUNC(common,positionToASL)) vectorAdd _offset) call EFUNC(common,ASLToPosition); _newPos = ((_pos call EFUNC(common,positionToASL)) vectorAdd _offset) call EFUNC(common,ASLToPosition);
//drawLine3D [_pos, _newPos, [1,0,0,0.5]]; //drawLine3D [_pos, _newPos, [1,0,0,0.8]];
[_object, _x, _newPos, [_angle, 140]] call FUNC(renderMenu); [_object, _x, _newPos, [_angle, 140]] call FUNC(renderMenu);

View File

@ -497,4 +497,17 @@ class CfgVehicles {
class ACE_SelfActions {}; class ACE_SelfActions {};
}; };
class thingX;
class ReammoBox_F: thingX {
class ACE_Actions {
class ACE_MainActions {
displayName = "$STR_ACE_Interaction_MainAction";
selection = "";
distance = 2;
condition = "true";
};
};
class ACE_SelfActions {};
};
}; };

View File

@ -19,7 +19,7 @@ GVAR(isOpeningDoor) = false;
["ACE3", QGVAR(openDoor), localize "STR_ACE_Interaction_OpenDoor", ["ACE3", QGVAR(openDoor), localize "STR_ACE_Interaction_OpenDoor",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if (GVAR(isOpeningDoor) || {[2] call FUNC(getDoor) select 1 == ''}) exitWith {false}; if (GVAR(isOpeningDoor) || {[2] call FUNC(getDoor) select 1 == ''}) exitWith {false};
@ -39,7 +39,7 @@ GVAR(isOpeningDoor) = false;
["ACE3", QGVAR(tapShoulder), localize "STR_ACE_Interaction_TapShoulder", ["ACE3", QGVAR(tapShoulder), localize "STR_ACE_Interaction_TapShoulder",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false}; if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false};
@ -53,7 +53,7 @@ GVAR(isOpeningDoor) = false;
["ACE3", QGVAR(modifierKey), localize "STR_ACE_Interaction_ModifierKey", ["ACE3", QGVAR(modifierKey), localize "STR_ACE_Interaction_ModifierKey",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, ["isNotDragging"]] call EGVAR(common,canInteractWith)) exitWith {false}; //if !([ACE_player, objNull, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false}; // not needed
// Statement // Statement
ACE_Modifier = 1; ACE_Modifier = 1;

View File

@ -47,7 +47,7 @@ playSound "ACE_Sound_Click";
!GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1} !GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1}
}; };
if (!_usedMouseWheel && {time < _time} && {[ACE_player, objNull, []] call EGVAR(common,canInteractWith)}) then { if (!_usedMouseWheel && {time < _time} && {[ACE_player, objNull, []] call EFUNC(common,canInteractWith)}) then {
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5); _phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
{_house animate [_x, _phase]} forEach _animations; {_house animate [_x, _phase]} forEach _animations;

View File

@ -1,4 +1,5 @@
#include "\x\cba\addons\main\script_macros_common.hpp" #include "\x\cba\addons\main\script_macros_common.hpp"
#include "\x\cba\addons\xeh\script_xeh.hpp"
// Default versioning level // Default versioning level
#define DEFAULT_VERSIONING_LEVEL 2 #define DEFAULT_VERSIONING_LEVEL 2

View File

@ -21,7 +21,7 @@
["ACE3", QGVAR(climb), localize "STR_ACE_Movement_Climb", ["ACE3", QGVAR(climb), localize "STR_ACE_Movement_Climb",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if (ACE_player != (vehicle ACE_player)) exitWith {false}; if (ACE_player != (vehicle ACE_player)) exitWith {false};

View File

@ -10,7 +10,7 @@ if (!hasInterface) exitWith {};
["ACE3", QGVAR(showNameTags), localize "STR_ACE_NameTags_ShowNames", ["ACE3", QGVAR(showNameTags), localize "STR_ACE_NameTags_ShowNames",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Statement // Statement
GVAR(ShowNamesTime) = time; GVAR(ShowNamesTime) = time;

View File

@ -40,7 +40,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
["ACE3", QGVAR(IncreaseNVGBrightness), localize "STR_ACE_NightVision_IncreaseNVGBrightness", ["ACE3", QGVAR(IncreaseNVGBrightness), localize "STR_ACE_NightVision_IncreaseNVGBrightness",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, ["isNotEscorting"]] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if ((currentVisionMode _player != 1)) exitWith {false}; if ((currentVisionMode _player != 1)) exitWith {false};
@ -54,7 +54,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
["ACE3", QGVAR(DecreaseNVGBrightness), localize "STR_ACE_NightVision_DecreaseNVGBrightness", ["ACE3", QGVAR(DecreaseNVGBrightness), localize "STR_ACE_NightVision_DecreaseNVGBrightness",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, ["isNotEscorting"]] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if ((currentVisionMode _player != 1)) exitWith {false}; if ((currentVisionMode _player != 1)) exitWith {false};

View File

@ -7,7 +7,7 @@ if !(hasInterface) exitWith {};
["ACE3", QGVAR(unjamWeapon), localize "STR_ACE_Overheating_UnjamWeapon", ["ACE3", QGVAR(unjamWeapon), localize "STR_ACE_Overheating_UnjamWeapon",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon) && if !([ACE_player] call EFUNC(common,canUseWeapon) &&
{currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])} {currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])}

View File

@ -43,4 +43,9 @@ class Extended_FiredBIS_EventHandlers {
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)});
}; };
}; };
class StaticWeapons {
class ADDON {
firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)});
};
};
}; };

View File

@ -19,7 +19,7 @@ if (!hasInterface) exitWith {};
["ACE3", QGVAR(showAltimeter), localize "STR_ACE_Parachute_showAltimeter", ["ACE3", QGVAR(showAltimeter), localize "STR_ACE_Parachute_showAltimeter",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, ["isNotEscorting"]] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false}; if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false};
if (!(missionNamespace getVariable [QGVAR(AltimeterActive), false])) then { if (!(missionNamespace getVariable [QGVAR(AltimeterActive), false])) then {
[ace_player] call FUNC(showAltimeter); [ace_player] call FUNC(showAltimeter);

View File

@ -7,7 +7,7 @@ if !(hasInterface) exitWith {};
["ACE3", QGVAR(checkAmmo), localize "STR_ACE_Reload_checkAmmo", ["ACE3", QGVAR(checkAmmo), localize "STR_ACE_Reload_checkAmmo",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon) || if !([ACE_player] call EFUNC(common,canUseWeapon) ||
{(vehicle ACE_player) isKindOf 'StaticWeapon'}) exitWith {false}; {(vehicle ACE_player) isKindOf 'StaticWeapon'}) exitWith {false};

View File

@ -13,7 +13,7 @@
EXPLODE_2_PVT(_this,_player,_target); EXPLODE_2_PVT(_this,_player,_target);
// Return true for static weapons if they have been fired once // Return true for static weapons if they have been fired once, @todo 1.40 this work-around doesn't work anymore
if (_target isKindOf "StaticWeapon") exitWith { if (_target isKindOf "StaticWeapon") exitWith {
(currentMagazine _target) != "" (currentMagazine _target) != ""
}; };

View File

@ -7,7 +7,7 @@ if !(hasInterface) exitWith {};
["ACE3", QGVAR(RestWeapon), localize "STR_ACE_Resting_RestWeapon", ["ACE3", QGVAR(RestWeapon), localize "STR_ACE_Resting_RestWeapon",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon) && if !([ACE_player] call EFUNC(common,canUseWeapon) &&
{inputAction 'reloadMagazine' == 0} && {inputAction 'reloadMagazine' == 0} &&

View File

@ -9,7 +9,7 @@
["ACE3", QGVAR(safeMode), localize "STR_ACE_SafeMode_SafeMode", ["ACE3", QGVAR(safeMode), localize "STR_ACE_SafeMode_SafeMode",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, ["isNotEscorting"]] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};

View File

@ -36,7 +36,7 @@ if !(hasInterface) exitWith {};
["ACE3", QGVAR(AdjustUp), localize "STR_ACE_Scopes_AdjustUp", ["ACE3", QGVAR(AdjustUp), localize "STR_ACE_Scopes_AdjustUp",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
[ACE_player] call FUNC(inventoryCheck); [ACE_player] call FUNC(inventoryCheck);
if !([ACE_player, 0, 0.1] call FUNC(canAdjustScope)) exitWith {false}; if !([ACE_player, 0, 0.1] call FUNC(canAdjustScope)) exitWith {false};
@ -51,7 +51,7 @@ if !(hasInterface) exitWith {};
["ACE3", QGVAR(AdjustDown), localize "STR_ACE_Scopes_AdjustDown", ["ACE3", QGVAR(AdjustDown), localize "STR_ACE_Scopes_AdjustDown",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
[ACE_player] call FUNC(inventoryCheck); [ACE_player] call FUNC(inventoryCheck);
if !([ACE_player, 0, -0.1] call FUNC(canAdjustScope)) exitWith {false}; if !([ACE_player, 0, -0.1] call FUNC(canAdjustScope)) exitWith {false};
@ -66,7 +66,7 @@ if !(hasInterface) exitWith {};
["ACE3", QGVAR(AdjustLeft), localize "STR_ACE_Scopes_AdjustLeft", ["ACE3", QGVAR(AdjustLeft), localize "STR_ACE_Scopes_AdjustLeft",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
[ACE_player] call FUNC(inventoryCheck); [ACE_player] call FUNC(inventoryCheck);
if !([ACE_player, -0.1, 0] call FUNC(canAdjustScope)) exitWith {false}; if !([ACE_player, -0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
@ -81,7 +81,7 @@ if !(hasInterface) exitWith {};
["ACE3", QGVAR(AdjustRight), localize "STR_ACE_Scopes_AdjustRight", ["ACE3", QGVAR(AdjustRight), localize "STR_ACE_Scopes_AdjustRight",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
[ACE_player] call FUNC(inventoryCheck); [ACE_player] call FUNC(inventoryCheck);
if !([ACE_player, 0.1, 0] call FUNC(canAdjustScope)) exitWith {false}; if !([ACE_player, 0.1, 0] call FUNC(canAdjustScope)) exitWith {false};

View File

@ -3,7 +3,7 @@
["ACE3", QGVAR(AzimuthKey), localize "STR_ACE_Vector_AzimuthKey", ["ACE3", QGVAR(AzimuthKey), localize "STR_ACE_Vector_AzimuthKey",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false}; if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false};
@ -13,18 +13,18 @@
// Statement // Statement
["azimuth"] call FUNC(onKeyDown); ["azimuth"] call FUNC(onKeyDown);
true false
}, },
{ {
// prevent holding down // prevent holding down
GVAR(isDownStateKey1) = false; GVAR(isDownStateKey1) = false;
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Statement // Statement
["azimuth"] call FUNC(onKeyUp); ["azimuth"] call FUNC(onKeyUp);
true false
}, },
[15, [false, false, false]], false, 0] call CBA_fnc_addKeybind; //Tab Key [15, [false, false, false]], false, 0] call CBA_fnc_addKeybind; //Tab Key
@ -32,7 +32,7 @@
["ACE3", QGVAR(DistanceKey), localize "STR_ACE_Vector_DistanceKey", ["ACE3", QGVAR(DistanceKey), localize "STR_ACE_Vector_DistanceKey",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false}; if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false};
@ -42,17 +42,17 @@
// Statement // Statement
["distance"] call FUNC(onKeyDown); ["distance"] call FUNC(onKeyDown);
true false
}, },
{ {
// prevent holding down // prevent holding down
GVAR(isDownStateKey2) = false; GVAR(isDownStateKey2) = false;
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Statement // Statement
["distance"] call FUNC(onKeyUp); ["distance"] call FUNC(onKeyUp);
true false
}, },
[19, [false, false, false]], false] call CBA_fnc_addKeybind; //R Key [19, [false, false, false]], false] call CBA_fnc_addKeybind; //R Key

View File

@ -7,7 +7,7 @@ if !(hasInterface) exitWith {};
["ACE3", QGVAR(speedLimiter), localize "STR_ACE_SpeedLimiter", ["ACE3", QGVAR(speedLimiter), localize "STR_ACE_SpeedLimiter",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !(ACE_player == driver vehicle ACE_player && if !(ACE_player == driver vehicle ACE_player &&
{vehicle ACE_player isKindOf 'Car' || {vehicle ACE_player isKindOf 'Car' ||

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