mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into disarmingTest
This commit is contained in:
commit
f8e758e136
BIN
TO_MERGE/agm/Optics/agm_optics_pip.p3d
Normal file
BIN
TO_MERGE/agm/Optics/agm_optics_pip.p3d
Normal file
Binary file not shown.
25
TO_MERGE/agm/Optics/clientInit.sqf
Normal file
25
TO_MERGE/agm/Optics/clientInit.sqf
Normal 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};
|
||||
};
|
454
TO_MERGE/agm/Optics/config.cpp
Normal file
454
TO_MERGE/agm/Optics/config.cpp
Normal 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 = "*";
|
||||
};
|
||||
};
|
||||
};
|
BIN
TO_MERGE/agm/Optics/data/arco/arco-bodyNight_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/arco/arco-bodyNight_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/arco/arco-body_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/arco/arco-body_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/arco/arco-reticle65Illum_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/arco/arco-reticle65Illum_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/arco/arco-reticle65_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/arco/arco-reticle65_ca.paa
Normal file
Binary file not shown.
8
TO_MERGE/agm/Optics/data/black.rvmat
Normal file
8
TO_MERGE/agm/Optics/data/black.rvmat
Normal 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";
|
20
TO_MERGE/agm/Optics/data/em.rvmat
Normal file
20
TO_MERGE/agm/Optics/data/em.rvmat
Normal 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};
|
||||
};
|
||||
};
|
BIN
TO_MERGE/agm/Optics/data/hamr/hamr-bodyNight_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/hamr/hamr-bodyNight_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/hamr/hamr-body_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/hamr/hamr-body_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/hamr/hamr-reticle65Illum_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/hamr/hamr-reticle65Illum_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/hamr/hamr-reticle65_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/hamr/hamr-reticle65_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/mrco/mrco-bodyNight_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/mrco/mrco-bodyNight_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/mrco/mrco-body_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/mrco/mrco-body_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/mrco/mrco-reticle556Illum_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/mrco/mrco-reticle556Illum_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/mrco/mrco-reticle556_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/mrco/mrco-reticle556_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/scopeblack-100_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/scopeblack-100_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/scopeblack-70_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/scopeblack-70_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/scopeblack-80_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/scopeblack-80_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/scopeblack-90_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/scopeblack-90_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/sos/sos-bodyNight_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/sos/sos-bodyNight_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/sos/sos-body_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/sos/sos-body_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/sos/sos-reticleMLRIllum_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/sos/sos-reticleMLRIllum_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/sos/sos-reticleMLR_ca.paa
Normal file
BIN
TO_MERGE/agm/Optics/data/sos/sos-reticleMLR_ca.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/tmr_optics_reticle100.p3d
Normal file
BIN
TO_MERGE/agm/Optics/data/tmr_optics_reticle100.p3d
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/tmr_optics_reticle70.p3d
Normal file
BIN
TO_MERGE/agm/Optics/data/tmr_optics_reticle70.p3d
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/tmr_optics_reticle80.p3d
Normal file
BIN
TO_MERGE/agm/Optics/data/tmr_optics_reticle80.p3d
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/tmr_optics_reticle90.p3d
Normal file
BIN
TO_MERGE/agm/Optics/data/tmr_optics_reticle90.p3d
Normal file
Binary file not shown.
BIN
TO_MERGE/agm/Optics/data/tmr_reticle_clear.p3d
Normal file
BIN
TO_MERGE/agm/Optics/data/tmr_reticle_clear.p3d
Normal file
Binary file not shown.
149
TO_MERGE/agm/Optics/functions/fn_firedEH.sqf
Normal file
149
TO_MERGE/agm/Optics/functions/fn_firedEH.sqf
Normal 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;
|
||||
};
|
19
TO_MERGE/agm/Optics/functions/fn_hideScope.sqf
Normal file
19
TO_MERGE/agm/Optics/functions/fn_hideScope.sqf
Normal 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;
|
25
TO_MERGE/agm/Optics/functions/fn_initScope.sqf
Normal file
25
TO_MERGE/agm/Optics/functions/fn_initScope.sqf
Normal 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
|
94
TO_MERGE/agm/Optics/functions/fn_mainLoop.sqf
Normal file
94
TO_MERGE/agm/Optics/functions/fn_mainLoop.sqf
Normal 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;
|
@ -7,14 +7,22 @@ class CfgWeapons {
|
||||
simulation = "ItemMineDetector";
|
||||
};
|
||||
|
||||
class Rifle_Base_F;
|
||||
class Rifle;
|
||||
class Rifle_Base_F: Rifle {
|
||||
class WeaponSlotsInfo;
|
||||
};
|
||||
|
||||
class ACE_FakePrimaryWeapon: Rifle_Base_F {
|
||||
scope = 2;
|
||||
displayName = "";
|
||||
model = "";
|
||||
picture = "";
|
||||
magazines[] = {"ACE_FakeMagazine"};
|
||||
discreteDistance[] = {};
|
||||
discreteDistanceInitIndex = 0;
|
||||
displayName = "";
|
||||
picture = "";
|
||||
model = "";
|
||||
magazines[] = {"ACE_FakeMagazine"};
|
||||
scope = 2;
|
||||
|
||||
class WeaponSlotsInfo: WeaponSlotsInfo {
|
||||
mass = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -20,6 +20,19 @@ if (hasInterface) then {
|
||||
};
|
||||
}] 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
|
||||
[QGVAR(onBriefingPFH), "onEachFrame", {
|
||||
if (time > 0) exitWith {
|
||||
@ -86,6 +99,7 @@ GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312);
|
||||
GVAR(OldCameraView) = cameraView;
|
||||
GVAR(OldPlayerVehicle) = vehicle ACE_player;
|
||||
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
||||
GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
||||
|
||||
// PFH to raise varios events
|
||||
[{
|
||||
@ -146,6 +160,14 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
||||
["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;
|
||||
|
||||
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
|
@ -55,7 +55,10 @@ PREP(execPersistentFnc);
|
||||
PREP(execRemoteFnc);
|
||||
PREP(executePersistent);
|
||||
PREP(filter);
|
||||
PREP(fixCollision);
|
||||
PREP(fixFloating);
|
||||
PREP(fixLoweredRifleAnimation);
|
||||
PREP(fixPosition);
|
||||
PREP(getAllDefinedSetVariables);
|
||||
PREP(getAllGear);
|
||||
PREP(getCaptivityStatus);
|
||||
|
@ -26,7 +26,7 @@ _exceptions = [_exceptions, {toLower _this}] call FUNC(map);
|
||||
private "_owner";
|
||||
_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
|
||||
|
||||
|
21
addons/common/functions/fnc_fixCollision.sqf
Normal file
21
addons/common/functions/fnc_fixCollision.sqf
Normal 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);
|
32
addons/common/functions/fnc_fixFloating.sqf
Normal file
32
addons/common/functions/fnc_fixFloating.sqf
Normal 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;
|
29
addons/common/functions/fnc_fixPosition.sqf
Normal file
29
addons/common/functions/fnc_fixPosition.sqf
Normal 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;
|
||||
};
|
@ -11,7 +11,7 @@
|
||||
* 3: CODE or STRING - On Failure: Code called or STRING raised as event.
|
||||
* 4: STRING - (Optional) Localized Title
|
||||
* 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:
|
||||
* Nothing
|
||||
@ -62,7 +62,7 @@ _perFrameFunction = {
|
||||
if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then {
|
||||
_errorCode = 3;
|
||||
} else {
|
||||
if (!([_player, objNull, _exceptions] call EGVAR(common,canInteractWith))) then {
|
||||
if (!([_player, objNull, _exceptions] call EFUNC(common,canInteractWith))) then {
|
||||
_errorCode = 4;
|
||||
} else {
|
||||
if (_elapsedTime >= _totalTime) then {
|
||||
@ -75,7 +75,11 @@ _perFrameFunction = {
|
||||
|
||||
if (_errorCode != -1) then {
|
||||
//Error or Success, close dialog and remove PFEH
|
||||
|
||||
//Only close dialog if it's the progressBar:
|
||||
if (!isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then {
|
||||
closeDialog 0;
|
||||
};
|
||||
[_pfhID] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
if (_errorCode == 0) then {
|
||||
|
1
addons/dragging/$PBOPREFIX$
Normal file
1
addons/dragging/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\dragging
|
47
addons/dragging/CfgEventHandlers.hpp
Normal file
47
addons/dragging/CfgEventHandlers.hpp
Normal 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));
|
||||
};
|
||||
};
|
||||
};
|
86
addons/dragging/CfgVehicles.hpp
Normal file
86
addons/dragging/CfgVehicles.hpp
Normal 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;
|
||||
};
|
||||
};
|
19
addons/dragging/XEH_clientInit.sqf
Normal file
19
addons/dragging/XEH_clientInit.sqf
Normal 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);
|
28
addons/dragging/XEH_preInit.sqf
Normal file
28
addons/dragging/XEH_preInit.sqf
Normal 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;
|
5
addons/dragging/XEH_serverInit.sqf
Normal file
5
addons/dragging/XEH_serverInit.sqf
Normal 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)}];
|
16
addons/dragging/config.cpp
Normal file
16
addons/dragging/config.cpp
Normal 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"
|
25
addons/dragging/functions/fnc_canCarry.sqf
Normal file
25
addons/dragging/functions/fnc_canCarry.sqf
Normal 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]}
|
25
addons/dragging/functions/fnc_canDrag.sqf
Normal file
25
addons/dragging/functions/fnc_canDrag.sqf
Normal 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]}
|
22
addons/dragging/functions/fnc_canDrop.sqf
Normal file
22
addons/dragging/functions/fnc_canDrop.sqf
Normal 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
|
22
addons/dragging/functions/fnc_canDrop_carry.sqf
Normal file
22
addons/dragging/functions/fnc_canDrop_carry.sqf
Normal 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
|
80
addons/dragging/functions/fnc_carryObject.sqf
Normal file
80
addons/dragging/functions/fnc_carryObject.sqf
Normal 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;
|
13
addons/dragging/functions/fnc_carryObjectPFH.sqf
Normal file
13
addons/dragging/functions/fnc_carryObjectPFH.sqf
Normal 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;
|
||||
};
|
64
addons/dragging/functions/fnc_dragObject.sqf
Normal file
64
addons/dragging/functions/fnc_dragObject.sqf
Normal 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;
|
13
addons/dragging/functions/fnc_dragObjectPFH.sqf
Normal file
13
addons/dragging/functions/fnc_dragObjectPFH.sqf
Normal 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;
|
||||
};
|
50
addons/dragging/functions/fnc_dropObject.sqf
Normal file
50
addons/dragging/functions/fnc_dropObject.sqf
Normal 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);
|
50
addons/dragging/functions/fnc_dropObject_carry.sqf
Normal file
50
addons/dragging/functions/fnc_dropObject_carry.sqf
Normal 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);
|
54
addons/dragging/functions/fnc_getWeight.sqf
Normal file
54
addons/dragging/functions/fnc_getWeight.sqf
Normal 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
|
31
addons/dragging/functions/fnc_handleAnimChanged.sqf
Normal file
31
addons/dragging/functions/fnc_handleAnimChanged.sqf
Normal 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);
|
||||
};
|
||||
|
||||
};
|
20
addons/dragging/functions/fnc_handleKilled.sqf
Normal file
20
addons/dragging/functions/fnc_handleKilled.sqf
Normal 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);
|
||||
};
|
17
addons/dragging/functions/fnc_handlePlayerChanged.sqf
Normal file
17
addons/dragging/functions/fnc_handlePlayerChanged.sqf
Normal 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];
|
31
addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf
Normal file
31
addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf
Normal 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);
|
||||
};
|
||||
|
||||
};
|
45
addons/dragging/functions/fnc_handleScrollWheel.sqf
Normal file
45
addons/dragging/functions/fnc_handleScrollWheel.sqf
Normal 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
|
37
addons/dragging/functions/fnc_initObject.sqf
Normal file
37
addons/dragging/functions/fnc_initObject.sqf
Normal 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);
|
||||
};
|
6
addons/dragging/functions/fnc_isObjectOnObject.sqf
Normal file
6
addons/dragging/functions/fnc_isObjectOnObject.sqf
Normal file
@ -0,0 +1,6 @@
|
||||
// by commy2
|
||||
|
||||
private "_object";
|
||||
_object = _this select 0;
|
||||
|
||||
(getPosATL _object select 2) - (getPos _object select 2) > 1E-5
|
52
addons/dragging/functions/fnc_setCarryable.sqf
Normal file
52
addons/dragging/functions/fnc_setCarryable.sqf
Normal 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);
|
52
addons/dragging/functions/fnc_setDraggable.sqf
Normal file
52
addons/dragging/functions/fnc_setDraggable.sqf
Normal 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);
|
43
addons/dragging/functions/fnc_startDrag.sqf
Normal file
43
addons/dragging/functions/fnc_startDrag.sqf
Normal 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;
|
20
addons/dragging/functions/fnc_startDragPFH.sqf
Normal file
20
addons/dragging/functions/fnc_startDragPFH.sqf
Normal 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;
|
||||
};
|
1
addons/dragging/functions/script_component.hpp
Normal file
1
addons/dragging/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\dragging\script_component.hpp"
|
14
addons/dragging/script_component.hpp
Normal file
14
addons/dragging/script_component.hpp
Normal 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"]
|
56
addons/dragging/stringtable.xml
Normal file
56
addons/dragging/stringtable.xml
Normal 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>
|
@ -36,6 +36,11 @@ class Extended_Init_EventHandlers {
|
||||
serverInit = QUOTE(_this call FUNC(vehicleInit));
|
||||
};
|
||||
};
|
||||
class StaticWeapon {
|
||||
class ADDON {
|
||||
serverInit = QUOTE(_this call FUNC(vehicleInit));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Respawn_EventHandlers {
|
||||
@ -64,6 +69,11 @@ class Extended_Respawn_EventHandlers {
|
||||
respawn = QUOTE(_this call FUNC(vehicleInit));
|
||||
};
|
||||
};
|
||||
class StaticWeapon {
|
||||
class ADDON {
|
||||
respawn = QUOTE(_this call FUNC(vehicleInit));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
@ -92,4 +102,9 @@ class Extended_FiredBIS_EventHandlers {
|
||||
firedBIS = QUOTE(_this call FUNC(firedEH));
|
||||
};
|
||||
};
|
||||
class StaticWeapon {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(_this call FUNC(firedEH));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
["ACE3", QGVAR(lazeTarget), localize "STR_ACE_FCS_LaseTarget",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
GVAR(isDownStateKey1) = false;
|
||||
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false};
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
["ACE3", QGVAR(adjustRangeUp), localize "STR_ACE_FCS_AdjustRangeUp",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
["ACE3", QGVAR(adjustRangDown), localize "STR_ACE_FCS_AdjustRangeDown",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};
|
||||
|
||||
|
@ -13,7 +13,7 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
|
||||
["ACE3", QGVAR(switchGrenadeMode), localize "STR_ACE_Grenades_SwitchGrenadeMode",
|
||||
{
|
||||
// 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
|
||||
if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false};
|
||||
|
||||
|
@ -40,6 +40,7 @@ GVAR(lastPath) = [];
|
||||
GVAR(expanded) = false;
|
||||
|
||||
GVAR(startHoverTime) = diag_tickTime;
|
||||
GVAR(expandedTime) = diag_tickTime;
|
||||
GVAR(iconCtrls) = [];
|
||||
GVAR(iconCount) = 0;
|
||||
|
||||
|
@ -46,7 +46,7 @@ _recurseFnc = {
|
||||
if (_condition == "") then {_condition = "true"};
|
||||
|
||||
// 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;
|
||||
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
||||
|
@ -43,7 +43,7 @@ _recurseFnc = {
|
||||
if (_condition == "") then {_condition = "true"};
|
||||
|
||||
// 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;
|
||||
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
||||
|
@ -166,6 +166,7 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
||||
} else {
|
||||
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then {
|
||||
GVAR(expanded) = true;
|
||||
GVAR(expandedTime) = diag_tickTime;
|
||||
GVAR(menuDepthPath) = +GVAR(lastPath);
|
||||
|
||||
// Execute the current action if it's run on hover
|
||||
|
@ -21,7 +21,7 @@ EXPLODE_4_PVT(_this,_object,_action,_pos,_angles);
|
||||
EXPLODE_2_PVT(_action,_actionData,_activeChildren);
|
||||
EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan);
|
||||
|
||||
_menuDepth = (count GVAR(menuDepthPath)) - 1;
|
||||
_menuDepth = (count GVAR(menuDepthPath));
|
||||
|
||||
// Store path to action
|
||||
_path = [_object] + (_actionData select 7);
|
||||
@ -42,7 +42,7 @@ _menuInSelectedPath = true;
|
||||
_color = "#FFFFFFFF";
|
||||
if(!_menuInSelectedPath) then { //_menuDepth > 0 &&
|
||||
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 {
|
||||
_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
|
||||
if !(_menuInSelectedPath) exitWith {true};
|
||||
|
||||
private ["_angleSpan","_angle"];
|
||||
private ["_angleSpan","_angle","_angleInterval","_scale"];
|
||||
_angleSpan = _maxAngleSpan min (55 * ((count _activeChildren) - 1));
|
||||
if (_angleSpan >= 305) then {
|
||||
_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;
|
||||
{
|
||||
_target = _object;
|
||||
_player = ACE_player;
|
||||
|
||||
_mod = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale);
|
||||
|
||||
_offset = ((GVAR(refSystem) select 1) vectorMultiply (-_mod * cos _angle)) vectorAdd
|
||||
((GVAR(refSystem) select 2) vectorMultiply (-_mod * sin _angle));
|
||||
_offset = ((GVAR(refSystem) select 1) vectorMultiply (-_scale * cos _angle)) vectorAdd
|
||||
((GVAR(refSystem) select 2) vectorMultiply (-_scale * sin _angle));
|
||||
_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);
|
||||
|
||||
|
@ -497,4 +497,17 @@ class CfgVehicles {
|
||||
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 {};
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ GVAR(isOpeningDoor) = false;
|
||||
["ACE3", QGVAR(openDoor), localize "STR_ACE_Interaction_OpenDoor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
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",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false};
|
||||
|
||||
@ -53,7 +53,7 @@ GVAR(isOpeningDoor) = false;
|
||||
["ACE3", QGVAR(modifierKey), localize "STR_ACE_Interaction_ModifierKey",
|
||||
{
|
||||
// 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
|
||||
ACE_Modifier = 1;
|
||||
|
@ -47,7 +47,7 @@ playSound "ACE_Sound_Click";
|
||||
!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);
|
||||
|
||||
{_house animate [_x, _phase]} forEach _animations;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "\x\cba\addons\main\script_macros_common.hpp"
|
||||
#include "\x\cba\addons\xeh\script_xeh.hpp"
|
||||
|
||||
// Default versioning level
|
||||
#define DEFAULT_VERSIONING_LEVEL 2
|
||||
|
@ -21,7 +21,7 @@
|
||||
["ACE3", QGVAR(climb), localize "STR_ACE_Movement_Climb",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if (ACE_player != (vehicle ACE_player)) exitWith {false};
|
||||
|
||||
|
@ -10,7 +10,7 @@ if (!hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(showNameTags), localize "STR_ACE_NameTags_ShowNames",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
GVAR(ShowNamesTime) = time;
|
||||
|
@ -40,7 +40,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
|
||||
["ACE3", QGVAR(IncreaseNVGBrightness), localize "STR_ACE_NightVision_IncreaseNVGBrightness",
|
||||
{
|
||||
// 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
|
||||
if ((currentVisionMode _player != 1)) exitWith {false};
|
||||
|
||||
@ -54,7 +54,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
|
||||
["ACE3", QGVAR(DecreaseNVGBrightness), localize "STR_ACE_NightVision_DecreaseNVGBrightness",
|
||||
{
|
||||
// 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
|
||||
if ((currentVisionMode _player != 1)) exitWith {false};
|
||||
|
||||
|
@ -7,7 +7,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(unjamWeapon), localize "STR_ACE_Overheating_UnjamWeapon",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon) &&
|
||||
{currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])}
|
||||
|
@ -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)});
|
||||
};
|
||||
};
|
||||
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)});
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ if (!hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(showAltimeter), localize "STR_ACE_Parachute_showAltimeter",
|
||||
{
|
||||
// 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 (!(missionNamespace getVariable [QGVAR(AltimeterActive), false])) then {
|
||||
[ace_player] call FUNC(showAltimeter);
|
||||
|
@ -7,7 +7,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(checkAmmo), localize "STR_ACE_Reload_checkAmmo",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon) ||
|
||||
{(vehicle ACE_player) isKindOf 'StaticWeapon'}) exitWith {false};
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
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 {
|
||||
(currentMagazine _target) != ""
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(RestWeapon), localize "STR_ACE_Resting_RestWeapon",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon) &&
|
||||
{inputAction 'reloadMagazine' == 0} &&
|
||||
|
@ -9,7 +9,7 @@
|
||||
["ACE3", QGVAR(safeMode), localize "STR_ACE_SafeMode_SafeMode",
|
||||
{
|
||||
// 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
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
|
||||
|
||||
|
@ -36,7 +36,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(AdjustUp), localize "STR_ACE_Scopes_AdjustUp",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
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",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
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",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
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",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
if !([ACE_player, 0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
|
||||
|
@ -3,7 +3,7 @@
|
||||
["ACE3", QGVAR(AzimuthKey), localize "STR_ACE_Vector_AzimuthKey",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false};
|
||||
|
||||
@ -13,18 +13,18 @@
|
||||
|
||||
// Statement
|
||||
["azimuth"] call FUNC(onKeyDown);
|
||||
true
|
||||
false
|
||||
},
|
||||
{
|
||||
// prevent holding down
|
||||
GVAR(isDownStateKey1) = false;
|
||||
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
["azimuth"] call FUNC(onKeyUp);
|
||||
true
|
||||
false
|
||||
},
|
||||
[15, [false, false, false]], false, 0] call CBA_fnc_addKeybind; //Tab Key
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
["ACE3", QGVAR(DistanceKey), localize "STR_ACE_Vector_DistanceKey",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false};
|
||||
|
||||
@ -42,17 +42,17 @@
|
||||
|
||||
// Statement
|
||||
["distance"] call FUNC(onKeyDown);
|
||||
true
|
||||
false
|
||||
},
|
||||
{
|
||||
// prevent holding down
|
||||
GVAR(isDownStateKey2) = false;
|
||||
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
["distance"] call FUNC(onKeyUp);
|
||||
true
|
||||
false
|
||||
},
|
||||
[19, [false, false, false]], false] call CBA_fnc_addKeybind; //R Key
|
||||
|
@ -7,7 +7,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(speedLimiter), localize "STR_ACE_SpeedLimiter",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(ACE_player == driver vehicle ACE_player &&
|
||||
{vehicle ACE_player isKindOf 'Car' ||
|
||||
|
@ -7,7 +7,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectPistol), localize "STR_ACE_WeaponSelect_SelectPistol",
|
||||
{
|
||||
// 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
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
|
||||
|
||||
@ -21,7 +21,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectRifle), localize "STR_ACE_WeaponSelect_SelectRifle",
|
||||
{
|
||||
// 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
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
|
||||
|
||||
@ -35,7 +35,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectRifleMuzzle), localize "STR_ACE_WeaponSelect_SelectRifleMuzzle",
|
||||
{
|
||||
// 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
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
|
||||
|
||||
@ -49,7 +49,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectLauncher), localize "STR_ACE_WeaponSelect_SelectLauncher",
|
||||
{
|
||||
// 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
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
|
||||
|
||||
@ -63,7 +63,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectBinocular), localize "STR_ACE_WeaponSelect_SelectBinocular",
|
||||
{
|
||||
// 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
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
|
||||
|
||||
@ -77,7 +77,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectGrenadeFrag), localize "STR_ACE_WeaponSelect_SelectGrenadeFrag",
|
||||
{
|
||||
// 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
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
|
||||
|
||||
@ -91,7 +91,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectGrenadeOther), localize "STR_ACE_WeaponSelect_SelectGrenadeOther",
|
||||
{
|
||||
// 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
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
|
||||
|
||||
@ -105,7 +105,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(HolsterWeapon), localize "STR_ACE_WeaponSelect_HolsterWeapon",
|
||||
{
|
||||
// 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
|
||||
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
|
||||
|
||||
@ -119,7 +119,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(EngineOn), localize "STR_ACE_WeaponSelect_EngineOn",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(ACE_player != vehicle ACE_player && {ACE_player == driver vehicle ACE_player} && {!isEngineOn vehicle ACE_player}) exitWith {false};
|
||||
|
||||
@ -133,7 +133,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(EngineOff), localize "STR_ACE_WeaponSelect_EngineOff",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(ACE_player != vehicle ACE_player && {ACE_player == driver vehicle ACE_player} && {isEngineOn vehicle ACE_player}) exitWith {false};
|
||||
|
||||
@ -147,7 +147,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectMainGun), localize "STR_ACE_WeaponSelect_SelectMainGun",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(ACE_player != vehicle ACE_player) exitWith {false};
|
||||
|
||||
@ -161,7 +161,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectMachineGun), localize "STR_ACE_WeaponSelect_SelectMachineGun",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(ACE_player != vehicle ACE_player) exitWith {false};
|
||||
|
||||
@ -175,7 +175,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(SelectMissiles), localize "STR_ACE_WeaponSelect_SelectMissiles",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(ACE_player != vehicle ACE_player) exitWith {false};
|
||||
|
||||
@ -189,7 +189,7 @@ if !(hasInterface) exitWith {};
|
||||
["ACE3", QGVAR(FireSmokeLauncher), localize "STR_ACE_WeaponSelect_FireSmokeLauncher",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(ACE_player != vehicle ACE_player && {ACE_player == commander vehicle ACE_player}) exitWith {false};
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user