mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' of https://github.com/KoffeinFlummi/ACE3 into reloadLaunchers
This commit is contained in:
commit
ae5fbaef86
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;
|
@ -53,17 +53,6 @@ class RscTitles {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_EventHandlerHelper: ACE_Rsc_Display_Base {
|
|
||||||
idd = -1;
|
|
||||||
class controls {
|
|
||||||
class CameraView: RscMapControl {
|
|
||||||
onDraw = "if (cameraView != uiNamespace getVariable 'ACE_EventHandler_CameraMode') then {uiNamespace setVariable ['ACE_EventHandler_CameraMode', cameraView]; {[uiNamespace getVariable 'ACE_EventHandler_CameraMode'] call _x; nil} count ((missionNamespace getVariable 'ACE_EventHandler_CameraMode') select 2);};";
|
|
||||||
idc = -1;
|
|
||||||
w = 0;
|
|
||||||
h = 0;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
class ACE_EventHandlerHelper2: ACE_Rsc_Display_Base {
|
class ACE_EventHandlerHelper2: ACE_Rsc_Display_Base {
|
||||||
class controls {
|
class controls {
|
||||||
class MapMarkerCreated: RscMapControl {
|
class MapMarkerCreated: RscMapControl {
|
||||||
|
@ -6,9 +6,7 @@ ADDON = false;
|
|||||||
// ACE Common Function
|
// ACE Common Function
|
||||||
PREP(addActionEventHandler);
|
PREP(addActionEventHandler);
|
||||||
PREP(addActionMenuEventHandler);
|
PREP(addActionMenuEventHandler);
|
||||||
PREP(addCameraEventHandler);
|
|
||||||
PREP(addCanInteractWithCondition);
|
PREP(addCanInteractWithCondition);
|
||||||
PREP(addCustomEventHandler);
|
|
||||||
PREP(addLineToDebugDraw);
|
PREP(addLineToDebugDraw);
|
||||||
PREP(addMapMarkerCreatedEventHandler);
|
PREP(addMapMarkerCreatedEventHandler);
|
||||||
PREP(addScrollWheelEventHandler);
|
PREP(addScrollWheelEventHandler);
|
||||||
@ -21,8 +19,6 @@ PREP(beingCarried);
|
|||||||
PREP(binarizeNumber);
|
PREP(binarizeNumber);
|
||||||
PREP(blurScreen);
|
PREP(blurScreen);
|
||||||
PREP(cachedCall);
|
PREP(cachedCall);
|
||||||
PREP(callCustomEventHandlers);
|
|
||||||
PREP(callCustomEventHandlersGlobal);
|
|
||||||
PREP(canGetInPosition);
|
PREP(canGetInPosition);
|
||||||
PREP(canInteract);
|
PREP(canInteract);
|
||||||
PREP(canInteractWith);
|
PREP(canInteractWith);
|
||||||
@ -150,9 +146,7 @@ PREP(readSettingFromModule);
|
|||||||
PREP(receiveRequest);
|
PREP(receiveRequest);
|
||||||
PREP(removeActionEventHandler);
|
PREP(removeActionEventHandler);
|
||||||
PREP(removeActionMenuEventHandler);
|
PREP(removeActionMenuEventHandler);
|
||||||
PREP(removeCameraEventHandler);
|
|
||||||
PREP(removeCanInteractWithCondition);
|
PREP(removeCanInteractWithCondition);
|
||||||
PREP(removeCustomEventHandler);
|
|
||||||
PREP(removeMapMarkerCreatedEventHandler);
|
PREP(removeMapMarkerCreatedEventHandler);
|
||||||
PREP(removeScrollWheelEventHandler);
|
PREP(removeScrollWheelEventHandler);
|
||||||
PREP(removeSpecificMagazine);
|
PREP(removeSpecificMagazine);
|
||||||
@ -258,8 +252,6 @@ if (hasInterface) then {
|
|||||||
ACE_player = missionNamespace getVariable ["BIS_fnc_moduleRemoteControl_unit", player];
|
ACE_player = missionNamespace getVariable ["BIS_fnc_moduleRemoteControl_unit", player];
|
||||||
uiNamespace setVariable ["ACE_player", ACE_player];
|
uiNamespace setVariable ["ACE_player", ACE_player];
|
||||||
|
|
||||||
// Raise custom event. @todo, remove
|
|
||||||
[missionNamespace, "playerChanged", [ACE_player, _oldPlayer]] call FUNC(callCustomEventHandlers);
|
|
||||||
// Raise ACE event
|
// Raise ACE event
|
||||||
["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent);
|
["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent);
|
||||||
};
|
};
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: commy2
|
|
||||||
*
|
|
||||||
* Add a camera view event handler. The event script is called when the camera view changes.
|
|
||||||
* The argument of the called function is stored in the _this variable and has as first element the new camera mode. Possible arguments are ["INTERNAL"], ["EXTERNAL"], ["GUNNER"] and ["GROUP"].
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: Code to execute (Code or String)
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* ID of the event script (used to remove it later).
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
private ["_statement", "_actionsVar", "_id", "_actionIDs", "_actions"];
|
|
||||||
|
|
||||||
_statement = _this select 0;
|
|
||||||
|
|
||||||
if (typeName _statement == "STRING") then {
|
|
||||||
_statement = compile _statement;
|
|
||||||
};
|
|
||||||
|
|
||||||
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_CameraMode", [-1, [], []]];
|
|
||||||
|
|
||||||
_id = (_actionsVar select 0) + 1;
|
|
||||||
_actionIDs = _actionsVar select 1;
|
|
||||||
_actions = _actionsVar select 2;
|
|
||||||
|
|
||||||
if (_id == 0) then {
|
|
||||||
uiNamespace setVariable ["ACE_EventHandler_CameraMode", cameraView];
|
|
||||||
(QGVAR(EventHandlerHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(EventHandlerHelper), "PLAIN"];
|
|
||||||
};
|
|
||||||
|
|
||||||
_actionIDs pushBack _id;
|
|
||||||
_actions pushBack _statement;
|
|
||||||
|
|
||||||
missionNamespace setVariable ["ACE_EventHandler_CameraMode", [_id, _actionIDs, _actions]];
|
|
||||||
|
|
||||||
_id
|
|
@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: commy2
|
|
||||||
*
|
|
||||||
* Add a custom event to a unit. The event scripts are called by FUNC(callCustomEventHandlers).
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: Object the event should be assigned to or namespace (Object OR Namespace)
|
|
||||||
* 1: Name of the event (String)
|
|
||||||
* 2: Code to execute (Code or String)
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* ID of the event script (used to remove it later).
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
private ["_object", "_type", "_statement", "_name", "_actionsVar", "_id", "_actionIDs", "_actions"];
|
|
||||||
|
|
||||||
_object = _this select 0;
|
|
||||||
_type = _this select 1;
|
|
||||||
_statement = _this select 2;
|
|
||||||
|
|
||||||
if (typeName _statement == "STRING") then {
|
|
||||||
_statement = compile _statement;
|
|
||||||
};
|
|
||||||
|
|
||||||
_name = format ["ACE_CustomEventHandlers_%1", _type];
|
|
||||||
|
|
||||||
_actionsVar = _object getVariable [_name, [-1, [], []]];
|
|
||||||
|
|
||||||
_id = (_actionsVar select 0) + 1;
|
|
||||||
_actionIDs = _actionsVar select 1;
|
|
||||||
_actions = _actionsVar select 2;
|
|
||||||
|
|
||||||
_actionIDs pushBack _id;
|
|
||||||
_actions pushBack _statement;
|
|
||||||
|
|
||||||
_object setVariable [_name, [_id, _actionIDs, _actions]];
|
|
||||||
|
|
||||||
_id
|
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Author: CAA-Picard and Jaynus
|
* Author: CAA-Picard and Jaynus
|
||||||
* Returns the result of the function and caches it up to a given time
|
* Returns the result of the function and caches it up to a given time or event
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Parameters <ARRAY>
|
* 0: Parameters <ARRAY>
|
||||||
@ -8,6 +8,7 @@
|
|||||||
* 2: Namespace to store the cache on <NAMESPACE>
|
* 2: Namespace to store the cache on <NAMESPACE>
|
||||||
* 3: Cache uid <STRING>
|
* 3: Cache uid <STRING>
|
||||||
* 4: Max duration of the cache <NUMBER>
|
* 4: Max duration of the cache <NUMBER>
|
||||||
|
* 5: Event that clears the cache <STRING> (Optional)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Result of the function <ANY>
|
* Result of the function <ANY>
|
||||||
@ -20,6 +21,40 @@ EXPLODE_5_PVT(_this,_params,_function,_namespace,_uid,_duration);
|
|||||||
|
|
||||||
if (((_namespace getVariable [_uid, [-99999]]) select 0) < diag_tickTime) then {
|
if (((_namespace getVariable [_uid, [-99999]]) select 0) < diag_tickTime) then {
|
||||||
_namespace setVariable [_uid, [diag_tickTime + _duration, _params call _function]];
|
_namespace setVariable [_uid, [diag_tickTime + _duration, _params call _function]];
|
||||||
|
|
||||||
|
// Does the cache needs to be cleared on an event?
|
||||||
|
if (count _this > 5) then {
|
||||||
|
private ["_event","_varName","_cacheList"];
|
||||||
|
_event = _this select 5;
|
||||||
|
_varName = format [QGVAR(clearCache_%1),_event];
|
||||||
|
_cacheList = missionNamespace getVariable _varName;
|
||||||
|
|
||||||
|
// If there was no EH to clear these caches, add one
|
||||||
|
if (isNil {_cacheList}) then {
|
||||||
|
_cacheList = [];
|
||||||
|
missionNamespace setVariable [_varName, _cacheList];
|
||||||
|
|
||||||
|
[_event, {
|
||||||
|
private ["_varName","_cacheList"];
|
||||||
|
// _eventName is defined on the function that calls the event
|
||||||
|
#ifdef DEBUG_MODE_FULL
|
||||||
|
diag_log text format ["ACE: Clear cached variables on event: %1", _eventName];
|
||||||
|
#endif
|
||||||
|
// Get the list of caches to clear
|
||||||
|
_varName = format [QGVAR(clearCache_%1),_eventName];
|
||||||
|
_cacheList = missionNamespace getVariable [_varName, []];
|
||||||
|
// Erase all the cached results
|
||||||
|
{
|
||||||
|
_x call FUNC(eraseCache);
|
||||||
|
} forEach _cacheList;
|
||||||
|
// Empty the list
|
||||||
|
missionNamespace setVariable [_varName, []];
|
||||||
|
}] call FUNC(addEventhandler);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add this cache to the list of the event
|
||||||
|
_cacheList pushBack [_namespace, _uid];
|
||||||
|
};
|
||||||
#ifdef DEBUG_MODE_FULL
|
#ifdef DEBUG_MODE_FULL
|
||||||
diag_log format ["Calculated result: %1 %2", _namespace, _uid];
|
diag_log format ["Calculated result: %1 %2", _namespace, _uid];
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: commy2
|
|
||||||
*
|
|
||||||
* Execute all custom event script assigned to this object.
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: Object the eventhandlers are assigned to or namespace (Object or Namespace)
|
|
||||||
* 1: Name of the event (String)
|
|
||||||
* 2: Arguments passed to the eventhandler script (Array, optional default: [Object the event handlers are assigned to])
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* None.
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
private ["_object", "_type", "_argument", "_name", "_actions"];
|
|
||||||
|
|
||||||
_object = _this select 0;
|
|
||||||
_type = _this select 1;
|
|
||||||
_argument = _this select 2;
|
|
||||||
|
|
||||||
if (isNil "_argument") then {_argument = [_object]};
|
|
||||||
|
|
||||||
_name = format ["ACE_CustomEventHandlers_%1", _type];
|
|
||||||
|
|
||||||
_actions = (_object getVariable [_name, [-1, [], []]]) select 2;
|
|
||||||
|
|
||||||
{
|
|
||||||
_argument call _x; nil;
|
|
||||||
} count _actions;
|
|
||||||
nil
|
|
@ -1,16 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: commy2
|
|
||||||
*
|
|
||||||
* Execute all custom event script assigned to this object on every machine.
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: Object the eventhandlers are assigned to or namespace (Object or Namespace)
|
|
||||||
* 1: Name of the event (String)
|
|
||||||
* 2: Arguments passed to the eventhandler script (Array, optional default: [Object the event handlers are assigned to])
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* None.
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
[_this, QUOTE(FUNC(callCustomEventHandlers)), 2] call FUNC(execRemoteFnc);
|
|
@ -1,16 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Check if the unit can interact.
|
* Check if the unit can interact.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The player. (Object)
|
* 0: The player. <OBJECT>
|
||||||
* 1: The interaction target. objNull to ignore. (Object)
|
* 1: The interaction target. objNull to ignore. <OBJECT>
|
||||||
* 2: Exceptions. What general conditions are to skip? (Array)
|
* 2: Exceptions. What general conditions are to skip? <ARRAY> (Optional)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Unit can interact?
|
* Unit can interact?
|
||||||
*
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
@ -18,7 +18,11 @@ private ["_unit", "_target", "_exceptions"];
|
|||||||
|
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_target = _this select 1;
|
_target = _this select 1;
|
||||||
_exceptions = _this select 2;
|
_exceptions = if (count _this > 2) then {
|
||||||
|
_this select 2;
|
||||||
|
} else {
|
||||||
|
[];
|
||||||
|
};
|
||||||
|
|
||||||
_exceptions = [_exceptions, {toLower _this}] call FUNC(map);
|
_exceptions = [_exceptions, {toLower _this}] call FUNC(map);
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* 3: CODE or STRING - On Failure: Code called or STRING raised as event.
|
* 3: CODE or STRING - On Failure: Code called or STRING raised as event.
|
||||||
* 4: STRING - (Optional) Localized Title
|
* 4: STRING - (Optional) Localized Title
|
||||||
* 5: CODE - (Optional) Code to check each frame
|
* 5: CODE - (Optional) Code to check each frame
|
||||||
* 6: ARRAY - (Optional) Exceptions for checking EGVAR(common,canInteractWith)
|
* 6: ARRAY - (Optional) Exceptions for checking EFUNC(common,canInteractWith)
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Nothing
|
* Nothing
|
||||||
@ -62,7 +62,7 @@ _perFrameFunction = {
|
|||||||
if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then {
|
if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then {
|
||||||
_errorCode = 3;
|
_errorCode = 3;
|
||||||
} else {
|
} else {
|
||||||
if (!([_player, objNull, _exceptions] call EGVAR(common,canInteractWith))) then {
|
if (!([_player, objNull, _exceptions] call EFUNC(common,canInteractWith))) then {
|
||||||
_errorCode = 4;
|
_errorCode = 4;
|
||||||
} else {
|
} else {
|
||||||
if (_elapsedTime >= _totalTime) then {
|
if (_elapsedTime >= _totalTime) then {
|
||||||
@ -75,7 +75,11 @@ _perFrameFunction = {
|
|||||||
|
|
||||||
if (_errorCode != -1) then {
|
if (_errorCode != -1) then {
|
||||||
//Error or Success, close dialog and remove PFEH
|
//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;
|
closeDialog 0;
|
||||||
|
};
|
||||||
[_pfhID] call CBA_fnc_removePerFrameHandler;
|
[_pfhID] call CBA_fnc_removePerFrameHandler;
|
||||||
|
|
||||||
if (_errorCode == 0) then {
|
if (_errorCode == 0) then {
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: commy2
|
|
||||||
*
|
|
||||||
* Remove a camera view event handler.
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: ID of the event handler (Number)
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* None.
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
private ["_id", "_actionsVar", "_currentId", "_actionIDs", "_actions"];
|
|
||||||
|
|
||||||
_id = _this select 0;
|
|
||||||
|
|
||||||
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_CameraMode", [-1, [], []]];
|
|
||||||
|
|
||||||
_currentId = _actionsVar select 0;
|
|
||||||
_actionIDs = _actionsVar select 1;
|
|
||||||
_actions = _actionsVar select 2;
|
|
||||||
|
|
||||||
_id = _actionIDs find _id;
|
|
||||||
|
|
||||||
if (_id == -1) exitWith {};
|
|
||||||
|
|
||||||
_actionIDs set [_id, -1];
|
|
||||||
_actionIDs = _actionIDs - [-1];
|
|
||||||
|
|
||||||
_actions set [_id, []];//{}
|
|
||||||
_actions = _actions - [[]];//[{}]
|
|
||||||
|
|
||||||
missionNamespace setVariable ["ACE_EventHandler_CameraMode", [_currentId, _actionIDs, _actions]];
|
|
@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: commy2
|
|
||||||
*
|
|
||||||
* Remove a custom event handler from an object.
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: Unit the event handler is assigned to or namespace (Object OR Namespace)
|
|
||||||
* 1: Name of the event (String)
|
|
||||||
* 2: ID of the event handler (Number)
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* None.
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
private ["_object", "_type", "_id", "_name", "_actionsVar", "_currentId", "_actionIDs", "_actions"];
|
|
||||||
|
|
||||||
_object = _this select 0;
|
|
||||||
_type = _this select 1;
|
|
||||||
_id = _this select 2;
|
|
||||||
|
|
||||||
_name = format ["ACE_CustomEventHandlers_%1", _type];
|
|
||||||
|
|
||||||
_actionsVar = _object getVariable [_name, [-1, [], []]];
|
|
||||||
|
|
||||||
_currentId = _actionsVar select 0;
|
|
||||||
_actionIDs = _actionsVar select 1;
|
|
||||||
_actions = _actionsVar select 2;
|
|
||||||
|
|
||||||
_id = _actionIDs find _id;
|
|
||||||
|
|
||||||
if (_id == -1) exitWith {};
|
|
||||||
|
|
||||||
_actionIDs set [_id, -1];
|
|
||||||
_actionIDs = _actionIDs - [-1];
|
|
||||||
|
|
||||||
_actions set [_id, []];//{}
|
|
||||||
_actions = _actions - [[]];//[{}]
|
|
||||||
|
|
||||||
_object setVariable [_name, [_currentId, _actionIDs, _actions]];
|
|
@ -1,7 +1,7 @@
|
|||||||
ace_disposable
|
ace_disposable
|
||||||
==============
|
==============
|
||||||
|
|
||||||
Makes the NLAW a disposable one-way weapon.
|
Makes the NLAW a disposable one-shot weapon.
|
||||||
|
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if (isNil QGVAR(UpdateInventoryDisplay_EHID)) then {
|
["inventoryDisplayLoaded",{
|
||||||
GVAR(UpdateInventoryDisplay_EHID) = ["inventoryDisplayLoaded",{
|
|
||||||
_player = ACE_player;
|
_player = ACE_player;
|
||||||
[_player, secondaryWeapon _player] call FUNC(takeLoadedATWeapon);
|
[_player] call FUNC(takeLoadedATWeapon);
|
||||||
[_player, (_this select 0)] call FUNC(updateInventoryDisplay);
|
[_player, (_this select 0)] call FUNC(updateInventoryDisplay);
|
||||||
}] call EFUNC(common,addEventHandler);
|
}] call EFUNC(common,addEventHandler);
|
||||||
};
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
PREP(aiDropWeaponCallback);
|
|
||||||
PREP(replaceATWeapon);
|
PREP(replaceATWeapon);
|
||||||
PREP(takeLoadedATWeapon);
|
PREP(takeLoadedATWeapon);
|
||||||
PREP(updateInventoryDisplay);
|
PREP(updateInventoryDisplay);
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: bux, commy2
|
|
||||||
*
|
|
||||||
* Remove the ai's missle launcher tube
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* Nothing
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
private ["_unit", "_tube", "_projectile", "_logic"];
|
|
||||||
|
|
||||||
_unit = (_this select 0) select 0;
|
|
||||||
_tube = (_this select 0) select 1;
|
|
||||||
_projectile = (_this select 0) select 2;
|
|
||||||
|
|
||||||
if (!isNull _projectile) exitWith {};
|
|
||||||
|
|
||||||
//remove frameEH
|
|
||||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
|
||||||
|
|
||||||
if ([_unit] call EFUNC(common,isPlayer)) exitWith {}; //Just in case a player took control
|
|
||||||
if (!alive _unit) exitWith {}; //No point doing this for dead
|
|
||||||
|
|
||||||
//If AI still has tube, throw it on ground
|
|
||||||
if (secondaryWeapon _unit == _tube) then {
|
|
||||||
_logic = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
|
|
||||||
_logic addWeaponCargoGlobal [_tube, 1]; // @todo secondary weapon items
|
|
||||||
|
|
||||||
_unit removeWeaponGlobal _tube;
|
|
||||||
};
|
|
@ -1,38 +1,79 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: bux, commy2
|
||||||
*
|
|
||||||
* Replace the disposable launcher with the used dummy.
|
* Replace the disposable launcher with the used dummy.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* Input from "Fired" eventhandler
|
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||||
|
* 1: weapon - Fired weapon <STRING>
|
||||||
|
* 2: muzzle - Muzzle that was used <STRING>
|
||||||
|
* 3: mode - Current mode of the fired weapon <STRING>
|
||||||
|
* 4: ammo - Ammo used <STRING>
|
||||||
|
* 5: magazine - magazine name which was used <STRING>
|
||||||
|
* 6: projectile - Object of the projectile that was shot <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Nothing
|
* Nothing
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [fromBisFiredEH] call ace_disposable_fnc_replaceATWeapon;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_unit", "_tube", "_projectile"];
|
private ["_unit", "_weapon", "_projectile", "_replacementTube", "_items"];
|
||||||
|
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_tube = getText (configFile >> "CfgWeapons" >> (_this select 1) >> "ACE_UsedTube");
|
_weapon = _this select 1;
|
||||||
_projectile = _this select 6;
|
_projectile = _this select 6;
|
||||||
|
|
||||||
if (!local _unit) exitWith {};
|
if (!local _unit) exitWith {};
|
||||||
if (_tube == "") exitWith {};
|
|
||||||
|
|
||||||
private "_items";
|
_replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube");
|
||||||
|
if (_replacementTube == "") exitWith {}; //If no replacement defined just exit
|
||||||
|
if (_weapon != (secondaryWeapon _unit)) exitWith {}; //just to be sure
|
||||||
|
|
||||||
|
|
||||||
|
//Save array of items attached to launcher
|
||||||
_items = secondaryWeaponItems _unit;
|
_items = secondaryWeaponItems _unit;
|
||||||
|
//Replace the orginal weapon with the 'usedTube' weapon
|
||||||
_unit addWeapon _tube;
|
_unit addWeapon _replacementTube;
|
||||||
_unit selectWeapon _tube;
|
//Makes sure the used tube is still equiped
|
||||||
|
_unit selectWeapon _replacementTube;
|
||||||
|
//Re-add all attachments to the used tube
|
||||||
{
|
{
|
||||||
if (_x != "") then {_unit addSecondaryWeaponItem _x};
|
if (_x != "") then {_unit addSecondaryWeaponItem _x};
|
||||||
} forEach _items;
|
} forEach _items;
|
||||||
|
|
||||||
// AI
|
|
||||||
|
// AI - Remove the ai's missle launcher tube after the missle has exploded
|
||||||
if !([_unit] call EFUNC(common,isPlayer)) then {
|
if !([_unit] call EFUNC(common,isPlayer)) then {
|
||||||
//waits until _projectile is null, so random 0-2 tickTime seconds after that
|
[{
|
||||||
[FUNC(aiDropWeaponCallback), 2, [_unit, _tube, _projectile]] call CBA_fnc_addPerFrameHandler;
|
EXPLODE_2_PVT(_this,_params,_pfhId);
|
||||||
|
EXPLODE_3_PVT(_params,_unit,_tube,_projectile);
|
||||||
|
|
||||||
|
//don't do anything until projectile is null (exploded/max range)
|
||||||
|
if (isNull _projectile) then {
|
||||||
|
//Remove PFEH:
|
||||||
|
[_pfhId] call cba_fnc_removePerFrameHandler;
|
||||||
|
|
||||||
|
//If (tube is dropped) OR (is dead) OR (is player) just exit
|
||||||
|
if (((secondaryWeapon _unit) != _tube) || {!alive _unit} || {([_unit] call EFUNC(common,isPlayer))}) exitWith {};
|
||||||
|
|
||||||
|
private ["_items", "_container"];
|
||||||
|
|
||||||
|
// _items = secondaryWeaponItems _unit;
|
||||||
|
_container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
|
||||||
|
_container setPosAsl (getPosAsl _unit);
|
||||||
|
_container addWeaponCargoGlobal [_tube, 1];
|
||||||
|
|
||||||
|
//This will duplicate attachements, because we will be adding a weapon that may already have attachments on it
|
||||||
|
//We either need a way to add a clean weapon, or a way to add a fully configured weapon to a container:
|
||||||
|
// {
|
||||||
|
// if (_x != "") then {_container addItemCargoGlobal [_x, 1];};
|
||||||
|
// } forEach _items;
|
||||||
|
|
||||||
|
_unit removeWeaponGlobal _tube;
|
||||||
|
};
|
||||||
|
}, 1, [_unit, _replacementTube, _projectile]] call CBA_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
||||||
|
@ -1,24 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Handle the take event. Add a dummy magazine if a disposable rocket launcher is taken.
|
* Handle the take event. Add a dummy magazine if a disposable rocket launcher is taken.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* Input from "Take" eventhandler
|
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [fromTakeEH] call ace_disposable_fnc_takeLoadedATWeapon;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_unit", "_launcher", "_config"];
|
private ["_unit", "_launcher", "_config"];
|
||||||
|
|
||||||
_unit = _this select 0;
|
PARAMS_1(_unit);
|
||||||
_launcher = secondaryWeapon _unit;
|
|
||||||
|
|
||||||
if (!local _unit) exitWith {};
|
if (!local _unit) exitWith {};
|
||||||
|
|
||||||
|
_launcher = secondaryWeapon _unit;
|
||||||
_config = configFile >> "CfgWeapons" >> _launcher;
|
_config = configFile >> "CfgWeapons" >> _launcher;
|
||||||
|
|
||||||
if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then {
|
if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then {
|
||||||
|
@ -1,26 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* Author: bux, commy2
|
* Author: bux, commy2
|
||||||
*
|
|
||||||
* Hide or show the secondary weapon magazine inventory slot to prevent unloading of dummy magazines.
|
* Hide or show the secondary weapon magazine inventory slot to prevent unloading of dummy magazines.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: The player. (Object)
|
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player] call ace_disposable_fnc_updateInventoryDisplay;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_player", "_display"];
|
disableSerialization;
|
||||||
|
|
||||||
_player = _this select 0;
|
PARAMS_1(_player);
|
||||||
|
DEFAULT_PARAM(1,_display,(findDisplay 602));
|
||||||
|
|
||||||
_player removeMagazines "ACE_PreloadedMissileDummy";
|
_player removeMagazines "ACE_PreloadedMissileDummy";
|
||||||
_player removeMagazines "ACE_FiredMissileDummy";
|
_player removeMagazines "ACE_FiredMissileDummy";
|
||||||
|
|
||||||
disableSerialization;
|
|
||||||
_display = [_this, 1, (findDisplay 602)] call BIS_fnc_param;
|
|
||||||
if (isNull _display) exitWith {};
|
if (isNull _display) exitWith {};
|
||||||
|
|
||||||
private ["_launcher", "_control", "_config"];
|
private ["_launcher", "_control", "_config"];
|
||||||
|
@ -48,5 +48,8 @@ if (_type in _initializedClasses) exitWith {};
|
|||||||
_initializedClasses pushBack _type;
|
_initializedClasses pushBack _type;
|
||||||
GVAR(initializedClasses_carry) = _initializedClasses;
|
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);
|
_carryAction = [QGVAR(drag), localize "STR_ACE_Dragging_Carry", "", {[_player, _target] call FUNC(carryObject)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction);
|
||||||
[_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);
|
_dropAction = [QGVAR(drop), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction);
|
||||||
|
|
||||||
|
[_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
[_type, 0, ["ACE_MainActions"], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
@ -48,5 +48,8 @@ if (_type in _initializedClasses) exitWith {};
|
|||||||
_initializedClasses pushBack _type;
|
_initializedClasses pushBack _type;
|
||||||
GVAR(initializedClasses) = _initializedClasses;
|
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);
|
_dragAction = [QGVAR(drag), localize "STR_ACE_Dragging_Drag", "", {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}] call EFUNC(interact_menu,createAction);
|
||||||
[_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);
|
_dropAction = [QGVAR(drop), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction);
|
||||||
|
|
||||||
|
[_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
[_type, 0, ["ACE_MainActions"], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
["ACE3", QGVAR(lazeTarget), localize "STR_ACE_FCS_LaseTarget",
|
["ACE3", QGVAR(lazeTarget), localize "STR_ACE_FCS_LaseTarget",
|
||||||
{
|
{
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
// Conditions: specific
|
// Conditions: specific
|
||||||
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
|
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
GVAR(isDownStateKey1) = false;
|
GVAR(isDownStateKey1) = false;
|
||||||
|
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
// Conditions: specific
|
// Conditions: specific
|
||||||
if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false};
|
if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false};
|
||||||
|
|
||||||
@ -33,7 +33,7 @@
|
|||||||
["ACE3", QGVAR(adjustRangeUp), localize "STR_ACE_FCS_AdjustRangeUp",
|
["ACE3", QGVAR(adjustRangeUp), localize "STR_ACE_FCS_AdjustRangeUp",
|
||||||
{
|
{
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
// Conditions: specific
|
// Conditions: specific
|
||||||
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};
|
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};
|
||||||
|
|
||||||
@ -47,7 +47,7 @@
|
|||||||
["ACE3", QGVAR(adjustRangDown), localize "STR_ACE_FCS_AdjustRangeDown",
|
["ACE3", QGVAR(adjustRangDown), localize "STR_ACE_FCS_AdjustRangeDown",
|
||||||
{
|
{
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
// Conditions: specific
|
// Conditions: specific
|
||||||
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};
|
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class CfgAmmo {
|
|||||||
ACE_FRAG_SKIP = 0;
|
ACE_FRAG_SKIP = 0;
|
||||||
ACE_FRAG_FORCE = 1;
|
ACE_FRAG_FORCE = 1;
|
||||||
// This is a good high-drag frag type for grenades.
|
// This is a good high-drag frag type for grenades.
|
||||||
ACE_FRAG_CLASSES[] = {"ACE_frag_medium_HD"};
|
ACE_FRAG_CLASSES[] = {"ACE_frag_tiny_HD"};
|
||||||
/*
|
/*
|
||||||
These values are based on the M67 Grenade, should be tweaked for
|
These values are based on the M67 Grenade, should be tweaked for
|
||||||
individual grenades.
|
individual grenades.
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
[QUOTE(ffsBIS), "oneachframe", QUOTE(FUNC(onFrame))] call BIS_fnc_addStackedEventHandler;
|
|
||||||
if(isServer) then {
|
if(isServer) then {
|
||||||
[QGVAR(frag_eh), { _this call FUNC(frago); }] call CBA_fnc_addClientToServerEventhandler;
|
[QGVAR(frag_eh), { _this call FUNC(frago); }] call ace_common_fnc_addEventHandler;
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
GVAR(replacedBisArtyWrapper) = false;
|
GVAR(replacedBisArtyWrapper) = false;
|
||||||
[] spawn {
|
[] spawn {
|
||||||
waitUntil {
|
waitUntil {
|
||||||
@ -15,3 +15,4 @@ GVAR(replacedBisArtyWrapper) = false;
|
|||||||
GVAR(replacedBisArtyWrapper)
|
GVAR(replacedBisArtyWrapper)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
*/
|
@ -1,6 +1,6 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
#define ACE_TRACE_DRAW_INC 1
|
|
||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
PREP(fired);
|
PREP(fired);
|
||||||
@ -14,7 +14,7 @@ GVAR(trackedObjects) = [];
|
|||||||
GVAR(blackList) = [];
|
GVAR(blackList) = [];
|
||||||
GVAR(traceFrags) = false;
|
GVAR(traceFrags) = false;
|
||||||
|
|
||||||
GVAR(replacedBisArtyWrapper) = false;
|
GVAR(replacedBisArtyWrapper) = true;
|
||||||
|
|
||||||
GVAR(TOTALFRAGS) = 0;
|
GVAR(TOTALFRAGS) = 0;
|
||||||
|
|
||||||
|
@ -3,5 +3,5 @@ private ["_round"];
|
|||||||
_round = _this select 0;
|
_round = _this select 0;
|
||||||
if(alive _round) then {
|
if(alive _round) then {
|
||||||
GVAR(trackedObjects) set[(count GVAR(trackedObjects)), _round];
|
GVAR(trackedObjects) set[(count GVAR(trackedObjects)), _round];
|
||||||
[FUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), (typeOf _round), time, objNull, false, 0, 0]] call cba_fnc_addPerFrameHandler;
|
[DFUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), (typeOf _round), time, objNull, false, 0, 0]] call cba_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
@ -17,4 +17,4 @@ _objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)
|
|||||||
_positions set[(count _positions), [(getPos _obj), _objTVel]];
|
_positions set[(count _positions), [(getPos _obj), _objTVel]];
|
||||||
_data = [_origin, typeOf _origin, typeOf _obj, _objTVel, _positions, _color];
|
_data = [_origin, typeOf _origin, typeOf _obj, _objTVel, _positions, _color];
|
||||||
GVAR(traces) set[_index, _data];
|
GVAR(traces) set[_index, _data];
|
||||||
[FUNC(trackTrace), 0, [_obj, _index, time]] call cba_fnc_addPerFrameHandler;
|
[DFUNC(trackTrace), 0, [_obj, _index, time]] call cba_fnc_addPerFrameHandler;
|
@ -44,13 +44,12 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
|
|||||||
_exit = false;
|
_exit = false;
|
||||||
_vm = 1;
|
_vm = 1;
|
||||||
_velocity = _initialData select 5;
|
_velocity = _initialData select 5;
|
||||||
_unitDir = _velocity call BIS_fnc_unitVector;
|
|
||||||
|
|
||||||
_oldVelocity = _velocity call BIS_fnc_magnitude;
|
_oldVelocity = _velocity call BIS_fnc_magnitude;
|
||||||
_curVelocity = (velocity _round) call BIS_fnc_magnitude;
|
_curVelocity = (velocity _round) call BIS_fnc_magnitude;
|
||||||
|
|
||||||
if(alive _round) then {
|
if(alive _round) then {
|
||||||
_diff = [_velocity, (velocity _round)] call FUNC(vectorDiffFast);
|
_diff = _velocity vectorDiff (velocity _round);
|
||||||
_polar = _diff call CBA_fnc_vect2polar;
|
_polar = _diff call CBA_fnc_vect2polar;
|
||||||
// player sideChat format["polar: %1", _polar];
|
// player sideChat format["polar: %1", _polar];
|
||||||
if((abs(_polar select 1) > 45 || abs(_polar select 2) > 45)) then {
|
if((abs(_polar select 1) > 45 || abs(_polar select 2) > 45)) then {
|
||||||
@ -63,7 +62,7 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
if(!_exit) then {
|
if(!_exit) then {
|
||||||
_unitDir = _velocity call BIS_fnc_unitVector;
|
_unitDir = vectorNormalized _velocity;
|
||||||
_pos = _hpData select 3;
|
_pos = _hpData select 3;
|
||||||
_spallPos = nil;
|
_spallPos = nil;
|
||||||
for "_i" from 0 to 100 do {
|
for "_i" from 0 to 100 do {
|
||||||
@ -137,7 +136,6 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
|
|||||||
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
|
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
|
||||||
_fragment setPosASL _spallPos;
|
_fragment setPosASL _spallPos;
|
||||||
_fragment setVelocity _spallFragVect;
|
_fragment setVelocity _spallFragVect;
|
||||||
// [fnc_spallTrackPFH, 0, [_fragment, diag_tickTime]] call cba_fnc_addPerFrameHandler;
|
|
||||||
if(GVAR(traceFrags)) then {
|
if(GVAR(traceFrags)) then {
|
||||||
[player, _fragment, [1,0.5,0,1]] call FUNC(addTrack);
|
[player, _fragment, [1,0.5,0,1]] call FUNC(addTrack);
|
||||||
};
|
};
|
||||||
@ -159,7 +157,6 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
|
|||||||
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
|
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
|
||||||
_fragment setPosASL _spallPos;
|
_fragment setPosASL _spallPos;
|
||||||
_fragment setVelocity _spallFragVect;
|
_fragment setVelocity _spallFragVect;
|
||||||
// [fnc_spallTrackPFH, 0, [_fragment, diag_tickTime]] call cba_fnc_addPerFrameHandler;
|
|
||||||
if(GVAR(traceFrags)) then {
|
if(GVAR(traceFrags)) then {
|
||||||
[player, _fragment, [1,0,0,1]] call FUNC(addTrack);
|
[player, _fragment, [1,0,0,1]] call FUNC(addTrack);
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
|
||||||
private ["_gun", "_type", "_round", "_doFragTrack", "_doSpall"];
|
private ["_gun", "_type", "_round", "_doFragTrack", "_doSpall"];
|
||||||
if !(isNil QGVAR(enabled) && {GVAR(enabled)}) exitWith {};
|
if !(isNil QGVAR(enabled) && {GVAR(enabled)}) exitWith {};
|
||||||
|
|
||||||
@ -23,7 +22,7 @@ if(_gun == player) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
_doSpall = true;
|
_doSpall = false;
|
||||||
if(_doSpall) then {
|
if(_doSpall) then {
|
||||||
if(GVAR(spallIsTrackingCount) <= 0) then {
|
if(GVAR(spallIsTrackingCount) <= 0) then {
|
||||||
GVAR(spallHPData) = [];
|
GVAR(spallHPData) = [];
|
||||||
@ -36,15 +35,14 @@ if(_doSpall) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
// player sideChat format["c: %1", GVAR(spallIsTrackingCount)];
|
// player sideChat format["c: %1", GVAR(spallIsTrackingCount)];
|
||||||
[player, _round, [1,0,0,1]] call FUNC(addTrack);
|
[player, _round, [1,0,0,1]] call nou_fnc_addTrack;
|
||||||
if(_doFragTrack && alive _round) then {
|
if(_doFragTrack && alive _round) then {
|
||||||
GVAR(trackedObjects) set[(count GVAR(trackedObjects)), _round];
|
GVAR(trackedObjects) pushBack _round;
|
||||||
_spallTrack = [];
|
_spallTrack = [];
|
||||||
_spallTrackID = [];
|
_spallTrackID = [];
|
||||||
[FUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), _type, time, _gun, _doSpall, _spallTrack, _spallTrackID]] call cba_fnc_addPerFrameHandler;
|
[DFUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), _type, time, _gun, _doSpall, _spallTrack, _spallTrackID]] call cba_fnc_addPerFrameHandler;
|
||||||
if(_doSpall) then {
|
if(_doSpall) then {
|
||||||
[_round, 2, _spallTrack, _spallTrackID] call FUNC(spallTrack);
|
[_round, 2, _spallTrack, _spallTrackID] call FUNC(spallTrack);
|
||||||
};
|
};
|
||||||
// player sideChat "WTF2";
|
// player sideChat "WTF2";
|
||||||
};
|
};
|
||||||
*/
|
|
@ -6,5 +6,5 @@ _shell = _params select 0;
|
|||||||
if(alive _shell) then {
|
if(alive _shell) then {
|
||||||
drop ["\Ca\Data\Cl_basic","","Billboard",1,30,(getPos _shell),[0,0,0],1,1.275,1.0,0.0,[0.5],[[0,1,0,1]],[0],0.0,2.0,"","",""];
|
drop ["\Ca\Data\Cl_basic","","Billboard",1,30,(getPos _shell),[0,0,0],1,1.275,1.0,0.0,[0.5],[[0,1,0,1]],[0],0.0,2.0,"","",""];
|
||||||
} else {
|
} else {
|
||||||
[_this select 1] call FUNC(removeBISPFH);
|
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
@ -130,11 +130,12 @@ if(_isArmed && (count _objects) > 0) then {
|
|||||||
|
|
||||||
_targetVel = (velocity _target);
|
_targetVel = (velocity _target);
|
||||||
|
|
||||||
_targetPos set[2, (_targetPos select 2)+_add];
|
|
||||||
_targetPos set[0, (_targetPos select 0)+((_targetVel select 0)*(_distance/_fragPower))];
|
_targetPos set[0, (_targetPos select 0)+((_targetVel select 0)*(_distance/_fragPower))];
|
||||||
_targetPos set[1, (_targetPos select 1)+((_targetVel select 1)*(_distance/_fragPower))];
|
_targetPos set[1, (_targetPos select 1)+((_targetVel select 1)*(_distance/_fragPower))];
|
||||||
|
_targetPos set[2, (_targetPos select 2)+_add];
|
||||||
|
|
||||||
_baseVec = [_lastPos, _targetPos] call BIS_fnc_vectorFromXToY;
|
_baseVec = _lastPos vectorFromTo _targetPos;
|
||||||
|
|
||||||
_dir = floor(_baseVec call CBA_fnc_vectDir);
|
_dir = floor(_baseVec call CBA_fnc_vectDir);
|
||||||
_currentCount = _fragArcs select _dir;
|
_currentCount = _fragArcs select _dir;
|
||||||
@ -213,7 +214,6 @@ if(_isArmed && (count _objects) > 0) then {
|
|||||||
_fragObj setVelocity _vel;
|
_fragObj setVelocity _vel;
|
||||||
#ifdef DEBUG_MODE_FULL
|
#ifdef DEBUG_MODE_FULL
|
||||||
GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1;
|
GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1;
|
||||||
// [FUNC(frag_trace), 0, [_fragObj]] call cba_fnc_addPerFrameHandler;
|
|
||||||
GVAR(traceFrags) = true;
|
GVAR(traceFrags) = true;
|
||||||
#endif
|
#endif
|
||||||
if(GVAR(traceFrags)) then {
|
if(GVAR(traceFrags)) then {
|
||||||
|
@ -21,7 +21,7 @@ if((_this select 0) <= (count GVAR(spallHPData))) then {
|
|||||||
// diag_log text format["%1: %2", _forEachIndex, _x];
|
// diag_log text format["%1: %2", _forEachIndex, _x];
|
||||||
// } forEach _hp;
|
// } forEach _hp;
|
||||||
// } forEach (_this select 1);
|
// } forEach (_this select 1);
|
||||||
[FUNC(doSpall), 0, [_this, _forEachIndex]] call cba_fnc_addPerFrameHandler;
|
[DFUNC(doSpall), 0, [_this, _forEachIndex]] call cba_fnc_addPerFrameHandler;
|
||||||
// player sideChat "WEEE";
|
// player sideChat "WEEE";
|
||||||
} forEach (_this select 1);
|
} forEach (_this select 1);
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
if(GVAR(tracesStarted)) then {
|
if(GVAR(tracesStarted)) then {
|
||||||
GVAR(tracesStarted) = false;
|
GVAR(tracesStarted) = false;
|
||||||
[GVAR(traceID)] call FUNC(removeBISPFH);
|
[GVAR(traceID)] call cba_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
@ -12,7 +12,7 @@ _spallTrack = _params select 7;
|
|||||||
_foundObjectHPIds = _params select 8;
|
_foundObjectHPIds = _params select 8;
|
||||||
|
|
||||||
if (!alive _round) then {
|
if (!alive _round) then {
|
||||||
[_this select 1] call FUNC(removeBISPFH);
|
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||||
if(_time != time && {_round in GVAR(trackedObjects)} && {!(_round in GVAR(blackList))}) then {
|
if(_time != time && {_round in GVAR(trackedObjects)} && {!(_round in GVAR(blackList))}) then {
|
||||||
GVAR(trackedObjects) = GVAR(trackedObjects) - [_round];
|
GVAR(trackedObjects) = GVAR(trackedObjects) - [_round];
|
||||||
_skip = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_SKIP");
|
_skip = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_SKIP");
|
||||||
@ -22,7 +22,7 @@ if (!alive _round) then {
|
|||||||
_force = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_FORCE");
|
_force = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_FORCE");
|
||||||
_fragPower = getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt(_indirectRange));
|
_fragPower = getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt(_indirectRange));
|
||||||
if((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1} ) then {
|
if((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1} ) then {
|
||||||
[QGVAR(frag_eh), _params] call CBA_fnc_clientToServerEvent;
|
[QGVAR(frag_eh), _params] call ace_common_fnc_serverEvent;
|
||||||
GVAR(trackedObjects) = GVAR(trackedObjects) - [_round];
|
GVAR(trackedObjects) = GVAR(trackedObjects) - [_round];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -38,7 +38,7 @@ if (!alive _round) then {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if(!(_round in GVAR(trackedObjects)) || {_round in GVAR(blackList)}) then {
|
if(!(_round in GVAR(trackedObjects)) || {_round in GVAR(blackList)}) then {
|
||||||
[_this select 1] call FUNC(removeBISPFH);
|
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||||
if(_round in GVAR(blackList)) then {
|
if(_round in GVAR(blackList)) then {
|
||||||
GVAR(blackList) = GVAR(blackList) - [_round];
|
GVAR(blackList) = GVAR(blackList) - [_round];
|
||||||
};
|
};
|
||||||
|
@ -10,5 +10,5 @@ if(alive _tracerObj && (count GVAR(traces)) > 0) then {
|
|||||||
_objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)^2);
|
_objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)^2);
|
||||||
_positions set[(count _positions), [(getPos _tracerObj), _objTVel]];
|
_positions set[(count _positions), [(getPos _tracerObj), _objTVel]];
|
||||||
} else {
|
} else {
|
||||||
[(_this select 1)] call FUNC(removeBISPFH);
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
@ -1,7 +1,7 @@
|
|||||||
#define COMPONENT frag
|
#define COMPONENT frag
|
||||||
#include "\z\ace\Addons\main\script_mod.hpp"
|
#include "\z\ace\Addons\main\script_mod.hpp"
|
||||||
|
|
||||||
#define DEBUG_ENABLED_FRAG
|
//#define DEBUG_ENABLED_FRAG
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED_FRAG
|
#ifdef DEBUG_ENABLED_FRAG
|
||||||
#define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
@ -12,3 +12,5 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "\z\ace\Addons\main\script_macros.hpp"
|
#include "\z\ace\Addons\main\script_macros.hpp"
|
||||||
|
|
||||||
|
#define ACE_TRACE_DRAW_INC 1
|
@ -1 +1 @@
|
|||||||
z\ace\addons\hearing
|
z\ace\addons\gforces
|
||||||
|
@ -13,7 +13,7 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
|
|||||||
["ACE3", QGVAR(switchGrenadeMode), localize "STR_ACE_Grenades_SwitchGrenadeMode",
|
["ACE3", QGVAR(switchGrenadeMode), localize "STR_ACE_Grenades_SwitchGrenadeMode",
|
||||||
{
|
{
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
if !([ACE_player, objNull, ["isNotEscorting"]] call EGVAR(common,canInteractWith)) exitWith {false};
|
if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
// Conditions: specific
|
// Conditions: specific
|
||||||
if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false};
|
if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false};
|
||||||
|
|
||||||
|
@ -2,21 +2,25 @@
|
|||||||
|
|
||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
PREP(addAction);
|
PREP(addActionToClass);
|
||||||
PREP(addClassAction);
|
PREP(addActionToObject);
|
||||||
PREP(compileMenu);
|
PREP(compileMenu);
|
||||||
PREP(compileMenuSelfAction);
|
PREP(compileMenuSelfAction);
|
||||||
PREP(collectActiveActionTree);
|
PREP(collectActiveActionTree);
|
||||||
|
PREP(createAction);
|
||||||
|
PREP(findActionNode);
|
||||||
|
PREP(isSubPath);
|
||||||
PREP(keyDown);
|
PREP(keyDown);
|
||||||
PREP(keyDownSelfAction);
|
PREP(keyDownSelfAction);
|
||||||
PREP(keyUp);
|
PREP(keyUp);
|
||||||
PREP(keyUpSelfAction);
|
PREP(keyUpSelfAction);
|
||||||
PREP(removeAction);
|
PREP(removeActionFromClass);
|
||||||
PREP(removeClassAction);
|
PREP(removeActionFromObject);
|
||||||
PREP(render);
|
PREP(render);
|
||||||
PREP(renderIcon);
|
|
||||||
PREP(renderBaseMenu);
|
PREP(renderBaseMenu);
|
||||||
|
PREP(renderIcon);
|
||||||
PREP(renderMenu);
|
PREP(renderMenu);
|
||||||
|
PREP(splitPath);
|
||||||
|
|
||||||
GVAR(keyDown) = false;
|
GVAR(keyDown) = false;
|
||||||
GVAR(keyDownSelfAction) = false;
|
GVAR(keyDownSelfAction) = false;
|
||||||
@ -26,7 +30,6 @@ GVAR(lastTime) = diag_tickTime;
|
|||||||
GVAR(rotationAngle) = 0;
|
GVAR(rotationAngle) = 0;
|
||||||
|
|
||||||
GVAR(selectedAction) = [[],[]];
|
GVAR(selectedAction) = [[],[]];
|
||||||
GVAR(selectedStatement) = {};
|
|
||||||
GVAR(actionSelected) = false;
|
GVAR(actionSelected) = false;
|
||||||
GVAR(selectedTarget) = objNull;
|
GVAR(selectedTarget) = objNull;
|
||||||
|
|
||||||
@ -40,6 +43,7 @@ GVAR(lastPath) = [];
|
|||||||
GVAR(expanded) = false;
|
GVAR(expanded) = false;
|
||||||
|
|
||||||
GVAR(startHoverTime) = diag_tickTime;
|
GVAR(startHoverTime) = diag_tickTime;
|
||||||
|
GVAR(expandedTime) = diag_tickTime;
|
||||||
GVAR(iconCtrls) = [];
|
GVAR(iconCtrls) = [];
|
||||||
GVAR(iconCount) = 0;
|
GVAR(iconCount) = 0;
|
||||||
|
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: commy2, NouberNou and CAA-Picard
|
|
||||||
* Add an ACE action to an object, under a certain config path
|
|
||||||
* Note: This function is NOT global.
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: Object the action should be assigned to <OBJECT>
|
|
||||||
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
|
|
||||||
* 2: Full path of the new action <ARRAY>
|
|
||||||
* 3: Name of the action shown in the menu <STRING>
|
|
||||||
* 4: Icon <STRING>
|
|
||||||
* 5: Position (Position or Selection Name) <POSITION> or <STRING>
|
|
||||||
* 6: Statement <CODE>
|
|
||||||
* 7: Condition <CODE>
|
|
||||||
* 8: Distance <NUMBER>
|
|
||||||
* 9: Other parameters <ARRAY> (Optional)
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [cursorTarget,0,["ACE_TapShoulderRight","VulcanPinch"],"Vulcan Pinch","",[0,0,0],{_target setDamage 1;},{true},100] call ace_interact_menu_fnc_addAction;
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
EXPLODE_9_PVT(_this,_object,_typeNum,_fullPath,_displayName,_icon,_position,_statement,_condition,_distance);
|
|
||||||
|
|
||||||
private ["_varName","_actions","_params","_entry"];
|
|
||||||
|
|
||||||
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
|
|
||||||
_actions = _object getVariable [_varName, []];
|
|
||||||
if((count _actions) == 0) then {
|
|
||||||
_object setVariable [_varName, _actions];
|
|
||||||
};
|
|
||||||
|
|
||||||
_params = [false,false,false,false];
|
|
||||||
if (count _this > 9) then {
|
|
||||||
_params = _this select 9;
|
|
||||||
};
|
|
||||||
|
|
||||||
_entry = [
|
|
||||||
[
|
|
||||||
_displayName,
|
|
||||||
_icon,
|
|
||||||
_position,
|
|
||||||
_statement,
|
|
||||||
_condition,
|
|
||||||
_distance,
|
|
||||||
_params,
|
|
||||||
+ _fullPath
|
|
||||||
],
|
|
||||||
[]
|
|
||||||
];
|
|
||||||
|
|
||||||
_actions pushBack _entry;
|
|
||||||
|
|
||||||
_fullPath
|
|
45
addons/interact_menu/functions/fnc_addActionToClass.sqf
Normal file
45
addons/interact_menu/functions/fnc_addActionToClass.sqf
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
* Insert an ACE action to a class, under a certain path
|
||||||
|
* Note: This function is NOT global.
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: TypeOf of the class <STRING>
|
||||||
|
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
|
||||||
|
* 2: Parent path of the new action <ARRAY>
|
||||||
|
* 3: Action <ARRAY>
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [typeOf cursorTarget, 0, ["ACE_TapShoulderRight"],VulcanPinchAction] call ace_interact_menu_fnc_addActionToClass;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
EXPLODE_4_PVT(_this,_objectType,_typeNum,_parentPath,_action);
|
||||||
|
|
||||||
|
// Ensure the config menu was compiled first
|
||||||
|
if (_typeNum == 0) then {
|
||||||
|
[_objectType] call FUNC(compileMenu);
|
||||||
|
} else {
|
||||||
|
[_objectType] call FUNC(compileMenuSelfAction);
|
||||||
|
};
|
||||||
|
|
||||||
|
private ["_varName","_actionTrees", "_parentNode"];
|
||||||
|
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
|
||||||
|
_actionTrees = missionNamespace getVariable [_varName, []];
|
||||||
|
if((count _actionTrees) == 0) then {
|
||||||
|
missionNamespace setVariable [_varName, _actionTrees];
|
||||||
|
};
|
||||||
|
|
||||||
|
_parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode);
|
||||||
|
if (isNil {_parentNode}) exitWith {};
|
||||||
|
|
||||||
|
// Add action node as children of the correct node of action tree
|
||||||
|
(_parentNode select 1) pushBack [_action,[]];
|
||||||
|
|
||||||
|
// Return the full path
|
||||||
|
(+ _parentPath) pushBack (_action select 0)
|
35
addons/interact_menu/functions/fnc_addActionToObject.sqf
Normal file
35
addons/interact_menu/functions/fnc_addActionToObject.sqf
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
* Insert an ACE action to an object, under a certain config path
|
||||||
|
* Note: This function is NOT global.
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Object the action should be assigned to <OBJECT>
|
||||||
|
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
|
||||||
|
* 2: Parent path of the new action <ARRAY>
|
||||||
|
* 3: Action <ARRAY>
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [typeOf cursorTarget, 0, ["ACE_TapShoulderRight"],VulcanPinchAction] call ace_interact_menu_fnc_addActionToClass;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
EXPLODE_4_PVT(_this,_object,_typeNum,_parentPath,_action);
|
||||||
|
|
||||||
|
private ["_varName","_actionList"];
|
||||||
|
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
|
||||||
|
_actionList = _object getVariable [_varName, []];
|
||||||
|
if((count _actionList) == 0) then {
|
||||||
|
_object setVariable [_varName, _actionList];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add action and parent path to the list of object actions
|
||||||
|
_actionList pushBack [_action, +_parentPath];
|
||||||
|
|
||||||
|
// Return the full path
|
||||||
|
(+ _parentPath) pushBack (_action select 0)
|
@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: CAA-Picard
|
|
||||||
* Add an ACE action to a class, under a certain path
|
|
||||||
* Note: This function is NOT global.
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: TypeOf of the class <STRING>
|
|
||||||
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
|
|
||||||
* 2: Full path of the new action <ARRAY>
|
|
||||||
* 3: Name of the action shown in the menu <STRING>
|
|
||||||
* 4: Icon <STRING>
|
|
||||||
* 5: Position (Position or Selection Name) <POSITION> or <STRING>
|
|
||||||
* 6: Statement <CODE>
|
|
||||||
* 7: Condition <CODE>
|
|
||||||
* 8: Distance <NUMBER>
|
|
||||||
* 9: Other parameters <ARRAY> (Optional)
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [typeOf cursorTarget, 0,["ACE_TapShoulderRight","VulcanPinch"],"Vulcan Pinch","",[0,0,0],{_target setDamage 1;},{true},100] call ace_interact_menu_fnc_addClassAction;
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
EXPLODE_9_PVT(_this,_objectType,_typeNum,_fullPath,_displayName,_icon,_position,_statement,_condition,_distance);
|
|
||||||
|
|
||||||
// Ensure the config menu was compiled first
|
|
||||||
if (_typeNum == 0) then {
|
|
||||||
[_objectType] call FUNC(compileMenu);
|
|
||||||
} else {
|
|
||||||
[_objectType] call FUNC(compileMenuSelfAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
private ["_varName","_actions","_params","_entry", "_parentLevel", "_foundParentLevel", "_fnc_findFolder"];
|
|
||||||
|
|
||||||
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
|
|
||||||
_actions = missionNamespace getVariable [_varName, []];
|
|
||||||
if((count _actions) == 0) then {
|
|
||||||
missionNamespace setVariable [_varName, _actions];
|
|
||||||
};
|
|
||||||
|
|
||||||
_params = [false,false,false,false];
|
|
||||||
if (count _this > 9) then {
|
|
||||||
_params = _this select 9;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Search the class action trees and find where to insert the entry
|
|
||||||
_parentLevel = _actions;
|
|
||||||
_foundParentLevel = false;
|
|
||||||
|
|
||||||
_fnc_findFolder = {
|
|
||||||
EXPLODE_3_PVT(_this,_fullPath,_level,_classActions);
|
|
||||||
|
|
||||||
if (count _fullPath == _level + 1) then {
|
|
||||||
_parentLevel = _classActions;
|
|
||||||
_foundParentLevel = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_foundParentLevel) exitWith {};
|
|
||||||
|
|
||||||
{
|
|
||||||
EXPLODE_2_PVT(_x,_actionData,_actionChildren);
|
|
||||||
if (((_actionData select 7) select _level) isEqualTo (_fullPath select _level)) exitWith {
|
|
||||||
// The action should go somewhere in here
|
|
||||||
[_fullPath, _level + 1, _actionChildren] call _fnc_findFolder;
|
|
||||||
};
|
|
||||||
} forEach _classActions;
|
|
||||||
};
|
|
||||||
|
|
||||||
[_fullPath, 0, _actions] call _fnc_findFolder;
|
|
||||||
|
|
||||||
// Exit if there's no entry point to insert this action
|
|
||||||
if (!_foundParentLevel) exitWith {};
|
|
||||||
|
|
||||||
_entry = [
|
|
||||||
[
|
|
||||||
_displayName,
|
|
||||||
_icon,
|
|
||||||
_position,
|
|
||||||
_statement,
|
|
||||||
_condition,
|
|
||||||
_distance,
|
|
||||||
_params,
|
|
||||||
+ _fullPath
|
|
||||||
],
|
|
||||||
[]
|
|
||||||
];
|
|
||||||
|
|
||||||
_parentLevel pushBack _entry;
|
|
||||||
|
|
||||||
_fullPath
|
|
@ -5,6 +5,7 @@
|
|||||||
* Argument:
|
* Argument:
|
||||||
* 0: Object <OBJECT>
|
* 0: Object <OBJECT>
|
||||||
* 1: Original action tree <ARRAY>
|
* 1: Original action tree <ARRAY>
|
||||||
|
* 2: Parent path <ARRAY>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Active children <ARRAY>
|
* Active children <ARRAY>
|
||||||
@ -13,24 +14,39 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
EXPLODE_2_PVT(_this,_object,_origAction);
|
EXPLODE_3_PVT(_this,_object,_origAction,_parentPath);
|
||||||
EXPLODE_2_PVT(_origAction,_origActionData,_origActionChildren);
|
EXPLODE_2_PVT(_origAction,_origActionData,_origActionChildren);
|
||||||
|
|
||||||
private ["_resultingAction","_target","_player","_activeChildren","_action","_actionData","_x"];
|
private ["_target","_player","_fullPath","_activeChildren","_dynamicChildren","_action","_actionData","_x"];
|
||||||
|
|
||||||
_target = _object;
|
_target = _object;
|
||||||
_player = ACE_player;
|
_player = ACE_player;
|
||||||
|
|
||||||
// Return nothing if the action itself is not active
|
// Return nothing if the action itself is not active
|
||||||
if !([_target, ACE_player] call (_origActionData select 4)) exitWith {
|
if !([_target, ACE_player, _origActionData select 6] call (_origActionData select 4)) exitWith {
|
||||||
[]
|
[]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_fullPath = +_parentPath;
|
||||||
|
_fullPath pushBack (_origActionData select 0);
|
||||||
_activeChildren = [];
|
_activeChildren = [];
|
||||||
|
|
||||||
|
// If there's a statement to dynamically insert children then execute it
|
||||||
|
if !({} isEqualTo (_origActionData select 5)) then {
|
||||||
|
_dynamicChildren = [_target, ACE_player, _origActionData select 6] call (_origActionData select 5);
|
||||||
|
|
||||||
|
// Collect dynamic children class actions
|
||||||
|
{
|
||||||
|
_action = [_x select 2, _x, _fullPath] call FUNC(collectActiveActionTree);
|
||||||
|
if ((count _action) > 0) then {
|
||||||
|
_activeChildren pushBack _action;
|
||||||
|
};
|
||||||
|
} forEach _dynamicChildren;
|
||||||
|
};
|
||||||
|
|
||||||
// Collect children class actions
|
// Collect children class actions
|
||||||
{
|
{
|
||||||
_action = [_object, _x] call FUNC(collectActiveActionTree);
|
_action = [_object, _x, _fullPath] call FUNC(collectActiveActionTree);
|
||||||
if ((count _action) > 0) then {
|
if ((count _action) > 0) then {
|
||||||
_activeChildren pushBack _action;
|
_activeChildren pushBack _action;
|
||||||
};
|
};
|
||||||
@ -38,28 +54,17 @@ _activeChildren = [];
|
|||||||
|
|
||||||
// Collect children object actions
|
// Collect children object actions
|
||||||
{
|
{
|
||||||
_action = _x;
|
EXPLODE_2_PVT(_x,_actionData,_pPath);
|
||||||
_actionData = _action select 0;
|
|
||||||
|
|
||||||
// Check if the action is children of the original action
|
// Check if the action is children of the original action
|
||||||
if ((count (_actionData select 7)) == (count (_origActionData select 7) + 1)) then {
|
if (count _pPath == count _fullPath &&
|
||||||
|
{_pPath isEqualTo _fullPath}) then {
|
||||||
|
|
||||||
// Compare parent path to see if it's a suitable child
|
_action = [_object, _action, _fullPath] call FUNC(collectActiveActionTree);
|
||||||
private "_isChild";
|
|
||||||
_isChild = true;
|
|
||||||
{
|
|
||||||
if !(_x isEqualTo ((_actionData select 7) select _forEachIndex)) exitWith {
|
|
||||||
_isChild = false;
|
|
||||||
};
|
|
||||||
} forEach (_origActionData select 7);
|
|
||||||
|
|
||||||
if (_isChild) then {
|
|
||||||
_action = [_object, _action] call FUNC(collectActiveActionTree);
|
|
||||||
if ((count _action) > 0) then {
|
if ((count _action) > 0) then {
|
||||||
_activeChildren pushBack _action;
|
_activeChildren pushBack _action;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
} forEach GVAR(objectActions);
|
} forEach GVAR(objectActions);
|
||||||
|
|
||||||
|
|
||||||
@ -69,4 +74,5 @@ if ((count _activeChildren) == 0 && ((_origActionData select 3) isEqualTo {})) e
|
|||||||
[]
|
[]
|
||||||
};
|
};
|
||||||
|
|
||||||
[_origActionData, _activeChildren]
|
|
||||||
|
[_origActionData, _activeChildren, _object]
|
||||||
|
@ -27,8 +27,8 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
|
|||||||
private "_recurseFnc";
|
private "_recurseFnc";
|
||||||
_recurseFnc = {
|
_recurseFnc = {
|
||||||
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
|
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
|
||||||
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_fullPath"];
|
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren"];
|
||||||
EXPLODE_2_PVT(_this,_actionsCfg,_parentPath);
|
EXPLODE_1_PVT(_this,_actionsCfg);
|
||||||
_actions = [];
|
_actions = [];
|
||||||
|
|
||||||
for "_i" from 0 to (count _actionsCfg) - 1 do {
|
for "_i" from 0 to (count _actionsCfg) - 1 do {
|
||||||
@ -46,29 +46,30 @@ _recurseFnc = {
|
|||||||
if (_condition == "") then {_condition = "true"};
|
if (_condition == "") then {_condition = "true"};
|
||||||
|
|
||||||
// Add canInteract (including exceptions) and canInteractWith to condition
|
// Add canInteract (including exceptions) and canInteractWith to condition
|
||||||
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EGVAR(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
|
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
|
||||||
|
|
||||||
|
_insertChildren = compile (getText (_entryCfg >> "insertChildren"));
|
||||||
|
|
||||||
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
|
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
|
||||||
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
||||||
_canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0;
|
_canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0;
|
||||||
_runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0;
|
_runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0;
|
||||||
|
|
||||||
_fullPath = (+ _parentPath);
|
|
||||||
_fullPath pushBack (configName _entryCfg);
|
|
||||||
|
|
||||||
_condition = compile _condition;
|
_condition = compile _condition;
|
||||||
_children = [_entryCfg, _fullPath] call _recurseFnc;
|
_children = [_entryCfg] call _recurseFnc;
|
||||||
|
|
||||||
_entry = [
|
_entry = [
|
||||||
[
|
[
|
||||||
|
configName _entryCfg,
|
||||||
_displayName,
|
_displayName,
|
||||||
_icon,
|
_icon,
|
||||||
_selection,
|
|
||||||
_statement,
|
_statement,
|
||||||
_condition,
|
_condition,
|
||||||
|
_insertChildren,
|
||||||
|
[],
|
||||||
|
_selection,
|
||||||
_distance,
|
_distance,
|
||||||
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
|
[_showDisabled,_enableInside,_canCollapse,_runOnHover]
|
||||||
_fullPath
|
|
||||||
],
|
],
|
||||||
_children
|
_children
|
||||||
];
|
];
|
||||||
@ -81,20 +82,22 @@ _recurseFnc = {
|
|||||||
private "_actionsCfg";
|
private "_actionsCfg";
|
||||||
_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions";
|
_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions";
|
||||||
|
|
||||||
missionNamespace setVariable [_actionsVarName, [_actionsCfg, []] call _recurseFnc];
|
missionNamespace setVariable [_actionsVarName, [_actionsCfg] call _recurseFnc];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
"MyAction",
|
||||||
"My Action",
|
"My Action",
|
||||||
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",
|
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",
|
||||||
[0,0,0],
|
|
||||||
{ (_this select 0) setVelocity [0,0,10]; },
|
{ (_this select 0) setVelocity [0,0,10]; },
|
||||||
{ true },
|
{ true },
|
||||||
|
{},
|
||||||
|
[],
|
||||||
|
[0,0,0],
|
||||||
1,
|
1,
|
||||||
[false,false,false]
|
[false,false,false]
|
||||||
["ACE_MainActions","TeamManagement","MyAction"]
|
|
||||||
],
|
],
|
||||||
[children actions]
|
[children actions]
|
||||||
]
|
]
|
||||||
|
@ -27,8 +27,8 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
|
|||||||
private "_recurseFnc";
|
private "_recurseFnc";
|
||||||
_recurseFnc = {
|
_recurseFnc = {
|
||||||
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
|
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
|
||||||
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_fullPath"];
|
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren"];
|
||||||
EXPLODE_2_PVT(_this,_actionsCfg,_parentPath);
|
EXPLODE_1_PVT(_this,_actionsCfg);
|
||||||
_actions = [];
|
_actions = [];
|
||||||
|
|
||||||
for "_i" from 0 to (count _actionsCfg) - 1 do {
|
for "_i" from 0 to (count _actionsCfg) - 1 do {
|
||||||
@ -43,29 +43,30 @@ _recurseFnc = {
|
|||||||
if (_condition == "") then {_condition = "true"};
|
if (_condition == "") then {_condition = "true"};
|
||||||
|
|
||||||
// Add canInteract (including exceptions) and canInteractWith to condition
|
// Add canInteract (including exceptions) and canInteractWith to condition
|
||||||
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, objNull, %1)] call EGVAR(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
|
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, objNull, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
|
||||||
|
|
||||||
|
_insertChildren = compile (getText (_entryCfg >> "insertChildren"));
|
||||||
|
|
||||||
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
|
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
|
||||||
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
||||||
_canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0;
|
_canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0;
|
||||||
_runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0;
|
_runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0;
|
||||||
|
|
||||||
_fullPath = (+ _parentPath);
|
|
||||||
_fullPath pushBack (configName _entryCfg);
|
|
||||||
|
|
||||||
_condition = compile _condition;
|
_condition = compile _condition;
|
||||||
_children = [_entryCfg, _fullPath] call _recurseFnc;
|
_children = [_entryCfg] call _recurseFnc;
|
||||||
|
|
||||||
_entry = [
|
_entry = [
|
||||||
[
|
[
|
||||||
|
configName _entryCfg,
|
||||||
_displayName,
|
_displayName,
|
||||||
_icon,
|
_icon,
|
||||||
[0,0,0],
|
|
||||||
_statement,
|
_statement,
|
||||||
_condition,
|
_condition,
|
||||||
|
_insertChildren,
|
||||||
|
[],
|
||||||
|
[0,0,0],
|
||||||
10, //distace
|
10, //distace
|
||||||
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
|
[_showDisabled,_enableInside,_canCollapse,_runOnHover]
|
||||||
_fullPath
|
|
||||||
],
|
],
|
||||||
_children
|
_children
|
||||||
];
|
];
|
||||||
@ -82,16 +83,18 @@ _actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions";
|
|||||||
_actions = [
|
_actions = [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
"ACE_SelfActions",
|
||||||
"Self Actions",
|
"Self Actions",
|
||||||
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",
|
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",
|
||||||
|
{},
|
||||||
|
{ true },
|
||||||
|
{},
|
||||||
|
[],
|
||||||
"Spine3",
|
"Spine3",
|
||||||
{ true },
|
|
||||||
{ true },
|
|
||||||
10,
|
10,
|
||||||
[false,true,false],
|
[false,true,false]
|
||||||
["ACE_SelfActions"]
|
|
||||||
],
|
],
|
||||||
[_actionsCfg, ["ACE_SelfActions"]] call _recurseFnc
|
[_actionsCfg] call _recurseFnc
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
74
addons/interact_menu/functions/fnc_createAction.sqf
Normal file
74
addons/interact_menu/functions/fnc_createAction.sqf
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
* Creates an isolated ACE action
|
||||||
|
* Note: This function is NOT global.
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Action name <STRING>
|
||||||
|
* 1: Name of the action shown in the menu <STRING>
|
||||||
|
* 2: Icon <STRING>
|
||||||
|
* 3: Statement <CODE>
|
||||||
|
* 4: Condition <CODE>
|
||||||
|
* 5: Insert children code <CODE> (Optional)
|
||||||
|
* 6: Action parameters <ANY> (Optional)
|
||||||
|
* 7: Position (Position or Selection Name) <POSITION> or <STRING> (Optional)
|
||||||
|
* 8: Distance <NUMBER> (Optional)
|
||||||
|
* 9: Other parameters <ARRAY> (Optional)
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Action <ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [VulcanPinch","Vulcan Pinch",{_target setDamage 1;},{true},{},[parameters], [0,0,0], 100] call ace_interact_menu_fnc_createAction;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
EXPLODE_5_PVT(_this,_actionName,_displayName,_icon,_statement,_condition);
|
||||||
|
|
||||||
|
private ["_insertChildren","_customParams","_position","_distance","_params"];
|
||||||
|
|
||||||
|
_insertChildren = if (count _this > 5) then {
|
||||||
|
_this select 5
|
||||||
|
} else {
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
_customParams = if (count _this > 6) then {
|
||||||
|
_this select 6
|
||||||
|
} else {
|
||||||
|
[]
|
||||||
|
};
|
||||||
|
|
||||||
|
_position = if (count _this > 7) then {
|
||||||
|
_this select 7
|
||||||
|
} else {
|
||||||
|
[0,0,0]
|
||||||
|
};
|
||||||
|
|
||||||
|
_distance = if (count _this > 8) then {
|
||||||
|
_this select 8
|
||||||
|
} else {
|
||||||
|
2
|
||||||
|
};
|
||||||
|
|
||||||
|
_params = if (count _this > 9) then {
|
||||||
|
_this select 9
|
||||||
|
} else {
|
||||||
|
[false,false,false,false]
|
||||||
|
};
|
||||||
|
|
||||||
|
[
|
||||||
|
_actionName,
|
||||||
|
_displayName,
|
||||||
|
_icon,
|
||||||
|
_statement,
|
||||||
|
_condition,
|
||||||
|
|
||||||
|
_insertChildren,
|
||||||
|
_customParams,
|
||||||
|
_position,
|
||||||
|
_distance,
|
||||||
|
_params
|
||||||
|
]
|
56
addons/interact_menu/functions/fnc_findActionNode.sqf
Normal file
56
addons/interact_menu/functions/fnc_findActionNode.sqf
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
* Return action point from path
|
||||||
|
* Note: This function is NOT global.
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: List of Action Tree <ARRAY>
|
||||||
|
* 1: Path <ARRAY>
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Action node <ARRAY>.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [_actionTree, ["ACE_TapShoulderRight","VulcanPinchAction"]] call ace_interact_menu_fnc_findActionNode;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
EXPLODE_2_PVT(_this,_actionTreeList,_parentPath);
|
||||||
|
|
||||||
|
private ["_parentNode", "_foundParentNode", "_fnc_findFolder"];
|
||||||
|
|
||||||
|
// Hack to make this work on the root node too
|
||||||
|
if (count _parentPath == 0) exitWith {
|
||||||
|
[[],_actionTreeList]
|
||||||
|
};
|
||||||
|
|
||||||
|
// Search the class action trees and find where to insert the entry
|
||||||
|
_parentNode = [[],_actionTreeList];
|
||||||
|
_foundParentNode = false;
|
||||||
|
|
||||||
|
_fnc_findFolder = {
|
||||||
|
EXPLODE_3_PVT(_this,_parentPath,_level,_actionNode);
|
||||||
|
|
||||||
|
{
|
||||||
|
EXPLODE_2_PVT(_x,_actionData,_actionChildren);
|
||||||
|
if ((_actionData select 0) isEqualTo (_parentPath select _level)) exitWith {
|
||||||
|
|
||||||
|
if (count _parentPath == _level + 1) exitWith {
|
||||||
|
_parentNode = _x;
|
||||||
|
_foundParentNode = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// The action should go somewhere in here
|
||||||
|
[_parentPath, _level + 1, _x] call _fnc_findFolder;
|
||||||
|
};
|
||||||
|
} forEach (_actionNode select 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
[_parentPath, 0, [[],_actionTreeList]] call _fnc_findFolder;
|
||||||
|
|
||||||
|
// Exit if there's no entry point to insert this action
|
||||||
|
if (!_foundParentNode) exitWith {};
|
||||||
|
|
||||||
|
_parentNode
|
29
addons/interact_menu/functions/fnc_isSubPath.sqf
Normal file
29
addons/interact_menu/functions/fnc_isSubPath.sqf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
* Check if the first path is a subpath of the other
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: LongPath <ARRAY>
|
||||||
|
* 1: ShortPath <STRING>
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Bool
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
EXPLODE_2_PVT(_this,_longPath,_shortPath);
|
||||||
|
|
||||||
|
private ["_isSubPath","_i"];
|
||||||
|
_isSubPath = true;
|
||||||
|
|
||||||
|
if (count _shortPath > count _longPath) exitWith {false};
|
||||||
|
|
||||||
|
for [{_i = 0},{_i < count _shortPath},{_i = _i + 1}] do {
|
||||||
|
if !((_longPath select _i) isEqualTo (_shortPath select _i)) exitWith {
|
||||||
|
_isSubPath = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_isSubPath
|
@ -14,9 +14,23 @@
|
|||||||
|
|
||||||
if(GVAR(actionSelected)) then {
|
if(GVAR(actionSelected)) then {
|
||||||
this = GVAR(selectedTarget);
|
this = GVAR(selectedTarget);
|
||||||
|
|
||||||
|
private ["_player","_target","_actionData"];
|
||||||
_player = ACE_Player;
|
_player = ACE_Player;
|
||||||
_target = GVAR(selectedTarget);
|
_target = GVAR(selectedTarget);
|
||||||
[GVAR(selectedTarget), ACE_player] call GVAR(selectedStatement);
|
|
||||||
|
// Clear the conditions caches
|
||||||
|
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||||
|
|
||||||
|
// Check the action conditions
|
||||||
|
_actionData = GVAR(selectedAction) select 0;
|
||||||
|
if ([_target, _player, _actionData select 6] call (_actionData select 4)) then {
|
||||||
|
// Call the statement
|
||||||
|
[_target, _player, _actionData select 6] call (_actionData select 3);
|
||||||
|
|
||||||
|
// Clear the conditions caches again if the action was performed
|
||||||
|
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(keyDown)) then {
|
if (GVAR(keyDown)) then {
|
||||||
|
@ -18,9 +18,23 @@ if (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then {
|
|||||||
|
|
||||||
if(GVAR(actionSelected)) then {
|
if(GVAR(actionSelected)) then {
|
||||||
this = GVAR(selectedTarget);
|
this = GVAR(selectedTarget);
|
||||||
|
|
||||||
|
private ["_player","_target","_actionData"];
|
||||||
_player = ACE_Player;
|
_player = ACE_Player;
|
||||||
_target = GVAR(selectedTarget);
|
_target = GVAR(selectedTarget);
|
||||||
[GVAR(selectedTarget), ACE_player] call GVAR(selectedStatement);
|
|
||||||
|
// Clear the conditions caches
|
||||||
|
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||||
|
|
||||||
|
// Check the action conditions
|
||||||
|
_actionData = GVAR(selectedAction) select 0;
|
||||||
|
if ([_target, _player, _actionData select 6] call (_actionData select 4)) then {
|
||||||
|
// Call the statement
|
||||||
|
[_target, _player, _actionData select 6] call (_actionData select 3);
|
||||||
|
|
||||||
|
// Clear the conditions caches again if the action was performed
|
||||||
|
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(keyDownSelfAction)) then {
|
if (GVAR(keyDownSelfAction)) then {
|
||||||
|
39
addons/interact_menu/functions/fnc_removeActionFromClass.sqf
Normal file
39
addons/interact_menu/functions/fnc_removeActionFromClass.sqf
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
* Removes an action from a class
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: TypeOf of the class <STRING>
|
||||||
|
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
|
||||||
|
* 2: Full path of the new action <ARRAY>
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [typeOf cursorTarget, 0,["ACE_TapShoulderRight","VulcanPinch"]] call ace_interact_menu_fnc_removeActionFromClass;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
EXPLODE_3_PVT(_this,_objectType,_typeNum,_fullPath);
|
||||||
|
|
||||||
|
private ["_res","_varName","_actionTrees"];
|
||||||
|
_res = _fullPath call FUNC(splitPath);
|
||||||
|
EXPLODE_2_PVT(_res,_parentPath,_actionName);
|
||||||
|
|
||||||
|
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
|
||||||
|
_actionTrees = missionNamespace getVariable [_varName, []];
|
||||||
|
|
||||||
|
_parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode);
|
||||||
|
if (isNil {_parentNode}) exitWith {};
|
||||||
|
|
||||||
|
// Iterate through children of the father
|
||||||
|
{
|
||||||
|
if (((_x select 0) select 0) == _actionName) exitWith {
|
||||||
|
(_parentNode select 1) deleteAt _forEachIndex;
|
||||||
|
};
|
||||||
|
} forEach (_parentNode select 1);
|
||||||
|
|
||||||
|
_parentLevel deleteAt _actionIndex;
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2, NouberNou and CAA-Picard
|
* Author: commy2, NouberNou and CAA-Picard
|
||||||
* Remove an action from an object
|
* Removes an action from an object
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* 0: Object the action is assigned to <OBJECT>
|
* 0: Object the action is assigned to <OBJECT>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [cursorTarget,0,["ACE_TapShoulderRight","VulcanPinch"]] call ace_interact_menu_fnc_removeAction;
|
* [cursorTarget,0,["ACE_TapShoulderRight","VulcanPinch"]] call ace_interact_menu_fnc_removeActionFromObject;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -19,12 +19,15 @@
|
|||||||
|
|
||||||
EXPLODE_3_PVT(_this,_object,_typeNum,_fullPath);
|
EXPLODE_3_PVT(_this,_object,_typeNum,_fullPath);
|
||||||
|
|
||||||
private ["_varName","_actions"];
|
private ["_res","_varName","_actionList"];
|
||||||
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
|
_res = _fullPath call FUNC(splitPath);
|
||||||
_actions = _object getVariable [_varName, []];
|
EXPLODE_2_PVT(_res,_parentPath,_actionName);
|
||||||
|
|
||||||
|
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
|
||||||
|
_actionList = _object getVariable [_varName, []];
|
||||||
{
|
{
|
||||||
if (((_x select 0) select 7) isEqualTo _fullPath) exitWith {
|
if (((_x select 0) select 0) isEqualTo _actionName &&
|
||||||
_actions deleteAt _forEachIndex;
|
{(_x select 1) isEqualTo _parentPath}) exitWith {
|
||||||
|
_actionList deleteAt _forEachIndex;
|
||||||
};
|
};
|
||||||
} forEach _actions;
|
} forEach _actionList;
|
@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: CAA-Picard
|
|
||||||
* Removes a class action from a class
|
|
||||||
* Note: This function is NOT global.
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: TypeOf of the class <STRING>
|
|
||||||
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
|
|
||||||
* 2: Full path of the new action <ARRAY>
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [typeOf cursorTarget, 0,["ACE_TapShoulderRight","VulcanPinch"]] call ace_interact_menu_fnc_removeClassAction;
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
EXPLODE_3_PVT(_this,_objectType,_typeNum,_fullPath);
|
|
||||||
|
|
||||||
private ["_varName","_actions","_parentLevel", "_actionIndex", "_foundAction", "_fnc_findFolder"];
|
|
||||||
|
|
||||||
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
|
|
||||||
_actions = missionNamespace getVariable [_varName, []];
|
|
||||||
|
|
||||||
// Search the class action trees and find where to insert the entry
|
|
||||||
_parentLevel = _actions;
|
|
||||||
_actionIndex = -1;
|
|
||||||
_foundAction = false;
|
|
||||||
|
|
||||||
_fnc_findFolder = {
|
|
||||||
EXPLODE_3_PVT(_this,_fullPath,_level,_classActions);
|
|
||||||
|
|
||||||
if (count _fullPath == _level + 1) then {
|
|
||||||
_parentLevel = _classActions;
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
|
||||||
EXPLODE_2_PVT(_x,_actionData,_actionChildren);
|
|
||||||
if (((_actionData select 7) select _level) isEqualTo (_fullPath select _level)) exitWith {
|
|
||||||
if (_level + 1 == count _fullPath) exitWith {
|
|
||||||
_actionIndex = _forEachIndex;
|
|
||||||
_foundAction = true;
|
|
||||||
};
|
|
||||||
[_fullPath, _level + 1, _actionChildren] call _fnc_findFolder;
|
|
||||||
};
|
|
||||||
if (_foundAction) exitWith {};
|
|
||||||
} forEach _classActions;
|
|
||||||
};
|
|
||||||
|
|
||||||
[_fullPath, 0, _actions] call _fnc_findFolder;
|
|
||||||
|
|
||||||
// Exit if the action was not found
|
|
||||||
if (!_foundAction) exitWith {};
|
|
||||||
|
|
||||||
_entry = [
|
|
||||||
[
|
|
||||||
_displayName,
|
|
||||||
_icon,
|
|
||||||
_position,
|
|
||||||
_statement,
|
|
||||||
_condition,
|
|
||||||
_distance,
|
|
||||||
_params,
|
|
||||||
+ _fullPath
|
|
||||||
],
|
|
||||||
[]
|
|
||||||
];
|
|
||||||
|
|
||||||
_parentLevel deleteAt _actionIndex;
|
|
@ -41,17 +41,17 @@ if (GVAR(keyDown)) then {
|
|||||||
|
|
||||||
// Iterate through object actions, find base level actions and render them if appropiate
|
// Iterate through object actions, find base level actions and render them if appropiate
|
||||||
_actionsVarName = format [QGVAR(Act_%1), typeOf _target];
|
_actionsVarName = format [QGVAR(Act_%1), typeOf _target];
|
||||||
GVAR(objectActions) = _target getVariable [QGVAR(actions), []];
|
GVAR(objectActionList) = _target getVariable [QGVAR(actions), []];
|
||||||
{
|
{
|
||||||
_action = _x;
|
|
||||||
// Only render them directly if they are base level actions
|
// Only render them directly if they are base level actions
|
||||||
if (count ((_action select 0) select 7) == 1) then {
|
if (count (_x select 1) == 0) then {
|
||||||
// Try to render the menu
|
// Try to render the menu
|
||||||
|
_action = [_x,[]];
|
||||||
if ([_target, _action] call FUNC(renderBaseMenu)) then {
|
if ([_target, _action] call FUNC(renderBaseMenu)) then {
|
||||||
_numInteractions = _numInteractions + 1;
|
_numInteractions = _numInteractions + 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} forEach GVAR(objectActions);
|
} forEach GVAR(objectActionList);
|
||||||
|
|
||||||
// Iterate through base level class actions and render them if appropiate
|
// Iterate through base level class actions and render them if appropiate
|
||||||
_classActions = missionNamespace getVariable [_actionsVarName, []];
|
_classActions = missionNamespace getVariable [_actionsVarName, []];
|
||||||
@ -80,7 +80,7 @@ if (GVAR(keyDown)) then {
|
|||||||
|
|
||||||
// Iterate through object actions, find base level actions and render them if appropiate
|
// Iterate through object actions, find base level actions and render them if appropiate
|
||||||
_actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target];
|
_actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target];
|
||||||
GVAR(objectActions) = _target getVariable [QGVAR(selfActions), []];
|
GVAR(objectActionList) = _target getVariable [QGVAR(selfActions), []];
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
_action = _x;
|
_action = _x;
|
||||||
@ -88,7 +88,7 @@ if (GVAR(keyDown)) then {
|
|||||||
if (count (_action select 7) == 1) then {
|
if (count (_action select 7) == 1) then {
|
||||||
[_target, _action, 0, [180, 360]] call FUNC(renderMenu);
|
[_target, _action, 0, [180, 360]] call FUNC(renderMenu);
|
||||||
};
|
};
|
||||||
} forEach GVAR(objectActions);
|
} forEach GVAR(objectActionList);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Iterate through base level class actions and render them if appropiate
|
// Iterate through base level class actions and render them if appropiate
|
||||||
@ -142,9 +142,8 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
|||||||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,.75], _pos, 0.6*SafeZoneW, 0.6*SafeZoneW, GVAR(rotationAngle), "", 0.5, 0.025, "TahomaB"];
|
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,.75], _pos, 0.6*SafeZoneW, 0.6*SafeZoneW, GVAR(rotationAngle), "", 0.5, 0.025, "TahomaB"];
|
||||||
_foundTarget = true;
|
_foundTarget = true;
|
||||||
GVAR(actionSelected) = true;
|
GVAR(actionSelected) = true;
|
||||||
GVAR(selectedTarget) = (_closest select 0) select 0;
|
|
||||||
GVAR(selectedAction) = (_closest select 0) select 1;
|
GVAR(selectedAction) = (_closest select 0) select 1;
|
||||||
GVAR(selectedStatement) = ((GVAR(selectedAction)) select 0) select 3;
|
GVAR(selectedTarget) = (GVAR(selectedAction)) select 2;
|
||||||
|
|
||||||
_misMatch = false;
|
_misMatch = false;
|
||||||
_hoverPath = (_closest select 2);
|
_hoverPath = (_closest select 2);
|
||||||
@ -153,29 +152,46 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
|||||||
_misMatch = true;
|
_misMatch = true;
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
if(_x != (_hoverPath select _forEachIndex)) exitWith {
|
if !(_x isEqualTo (_hoverPath select _forEachIndex)) exitWith {
|
||||||
_misMatch = true;
|
_misMatch = true;
|
||||||
};
|
};
|
||||||
} forEach GVAR(lastPath);
|
} forEach GVAR(lastPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
if(_misMatch) then {
|
if(_misMatch && {diag_tickTime-GVAR(expandedTime) > 0.25}) then {
|
||||||
GVAR(lastPath) = _hoverPath;
|
|
||||||
GVAR(startHoverTime) = diag_tickTime;
|
GVAR(startHoverTime) = diag_tickTime;
|
||||||
|
GVAR(lastPath) = _hoverPath;
|
||||||
GVAR(expanded) = false;
|
GVAR(expanded) = false;
|
||||||
} else {
|
} else {
|
||||||
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then {
|
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then {
|
||||||
GVAR(expanded) = true;
|
GVAR(expanded) = true;
|
||||||
|
|
||||||
|
// Start the expanding menu animation only if the user is not going up the menu
|
||||||
|
if !([GVAR(menuDepthPath),GVAR(lastPath)] call FUNC(isSubPath)) then {
|
||||||
|
GVAR(expandedTime) = diag_tickTime;
|
||||||
|
};
|
||||||
GVAR(menuDepthPath) = +GVAR(lastPath);
|
GVAR(menuDepthPath) = +GVAR(lastPath);
|
||||||
|
|
||||||
// Execute the current action if it's run on hover
|
// Execute the current action if it's run on hover
|
||||||
private "_runOnHover";
|
private "_runOnHover";
|
||||||
_runOnHover = ((GVAR(selectedAction) select 0) select 6) select 3;
|
_runOnHover = ((GVAR(selectedAction) select 0) select 9) select 3;
|
||||||
if (_runOnHover) then {
|
if (_runOnHover) then {
|
||||||
this = GVAR(selectedTarget);
|
this = GVAR(selectedTarget);
|
||||||
_player = ACE_Player;
|
_player = ACE_Player;
|
||||||
_target = GVAR(selectedTarget);
|
_target = GVAR(selectedTarget);
|
||||||
[GVAR(selectedTarget), ACE_player] call GVAR(selectedStatement);
|
|
||||||
|
// Clear the conditions caches
|
||||||
|
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||||
|
|
||||||
|
// Check the action conditions
|
||||||
|
_actionData = GVAR(selectedAction) select 0;
|
||||||
|
if ([_target, _player, _actionData select 6] call (_actionData select 4)) then {
|
||||||
|
// Call the statement
|
||||||
|
[_target, _player, _actionData select 6] call (_actionData select 3);
|
||||||
|
|
||||||
|
// Clear the conditions caches again if the action was performed
|
||||||
|
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* 0: Object <OBJECT>
|
* 0: Object <OBJECT>
|
||||||
* 1: Action data <ARRAY>
|
* 1: Action node <ARRAY>
|
||||||
* 2: 3D position <ARRAY> (Optional)
|
* 2: 3D position <ARRAY> (Optional)
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
@ -16,25 +16,25 @@
|
|||||||
|
|
||||||
private ["_distance","_pos","_weaponDir","_ref","_cameraPos","_sPos","_activeActionTree"];
|
private ["_distance","_pos","_weaponDir","_ref","_cameraPos","_sPos","_activeActionTree"];
|
||||||
|
|
||||||
EXPLODE_2_PVT(_this,_object,_baseAction);
|
EXPLODE_2_PVT(_this,_object,_baseActionNode);
|
||||||
EXPLODE_1_PVT(_baseAction,_actionData);
|
EXPLODE_1_PVT(_baseActionNode,_actionData);
|
||||||
|
|
||||||
_distance = _actionData select 5;
|
_distance = _actionData select 8;
|
||||||
|
|
||||||
// Obtain a 3D position for the action
|
// Obtain a 3D position for the action
|
||||||
if((count _this) > 2) then {
|
if((count _this) > 2) then {
|
||||||
_pos = _this select 2;
|
_pos = _this select 2;
|
||||||
} else {
|
} else {
|
||||||
if(typeName (_actionData select 2) == "ARRAY") then {
|
if(typeName (_actionData select 7) == "ARRAY") then {
|
||||||
_pos = _object modelToWorld (_actionData select 2);
|
_pos = _object modelToWorld (_actionData select 7);
|
||||||
} else {
|
} else {
|
||||||
if ((_actionData select 2) == "weapon") then {
|
if ((_actionData select 7) == "weapon") then {
|
||||||
// Craft a suitable position for weapon interaction
|
// Craft a suitable position for weapon interaction
|
||||||
_weaponDir = _object weaponDirection currentWeapon _object;
|
_weaponDir = _object weaponDirection currentWeapon _object;
|
||||||
_ref = _weaponDir call EFUNC(common,createOrthonormalReference);
|
_ref = _weaponDir call EFUNC(common,createOrthonormalReference);
|
||||||
_pos = (_object modelToWorld (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1);
|
_pos = (_object modelToWorld (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1);
|
||||||
} else {
|
} else {
|
||||||
_pos = _object modelToWorld (_object selectionPosition (_actionData select 2));
|
_pos = _object modelToWorld (_object selectionPosition (_actionData select 7));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
// Compensate for movement during the frame to get rid of jittering
|
// Compensate for movement during the frame to get rid of jittering
|
||||||
@ -59,19 +59,30 @@ if ((_sPos select 1) < safeZoneY || (_sPos select 1) > safeZoneY + safeZon
|
|||||||
|
|
||||||
// Collect active tree
|
// Collect active tree
|
||||||
private "_uid";
|
private "_uid";
|
||||||
_uid = format [QGVAR(ATCache_%1), (_actionData select 7) select 0];
|
_uid = format [QGVAR(ATCache_%1), _actionData select 0];
|
||||||
_activeActionTree = [
|
_activeActionTree = [
|
||||||
[_object, _baseAction],
|
[_object, _baseActionNode, []],
|
||||||
DFUNC(collectActiveActionTree),
|
DFUNC(collectActiveActionTree),
|
||||||
_object, _uid, 0.2
|
_object, _uid, 1.0, "interactMenuClosed"
|
||||||
] call EFUNC(common,cachedCall);
|
] call EFUNC(common,cachedCall);
|
||||||
|
|
||||||
|
/*
|
||||||
|
diag_log "Printing: _activeActionTree";
|
||||||
|
_fnc_print = {
|
||||||
|
EXPLODE_2_PVT(_this,_level,_node);
|
||||||
|
EXPLODE_3_PVT(_node,_actionData,_children,_object);
|
||||||
|
diag_log text format ["Level %1 -> %2 on %3", _level, _actionData select 0, _object];
|
||||||
|
{
|
||||||
|
[_level + 1, _x] call _fnc_print;
|
||||||
|
} forEach _children;
|
||||||
|
};
|
||||||
|
[0, _activeActionTree] call _fnc_print;
|
||||||
|
*/
|
||||||
// Check if there's something left for rendering
|
// Check if there's something left for rendering
|
||||||
if (count _activeActionTree == 0) exitWith {false};
|
if (count _activeActionTree == 0) exitWith {false};
|
||||||
|
|
||||||
//EXPLODE_2_PVT(_activeActionTree,_actionData,_actionChildren);
|
//EXPLODE_2_PVT(_activeActionTree,_actionData,_actionChildren);
|
||||||
|
|
||||||
[_object, _activeActionTree, _pos, [180,360]] call FUNC(renderMenu);
|
[[], _activeActionTree, _pos, [180,360]] call FUNC(renderMenu);
|
||||||
|
|
||||||
true
|
true
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Render an interaction menu and it's children recursively
|
* Render an interaction menu and it's children recursively
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* 0: Object <OBJECT>
|
* 0: Parent path <ARRAY>
|
||||||
* 1: Action data <ARRAY>
|
* 1: Action data <ARRAY>
|
||||||
* 2: 3D position <ARRAY>
|
* 2: 3D position <ARRAY>
|
||||||
* 3: Angle range available for rendering <ARRAY>
|
* 3: Angle range available for rendering <ARRAY>
|
||||||
@ -17,14 +17,15 @@
|
|||||||
|
|
||||||
private ["_menuInSelectedPath", "_path", "_menuDepth", "_currentRenderDepth", "_x", "_offset", "_newPos", "_forEachIndex"];
|
private ["_menuInSelectedPath", "_path", "_menuDepth", "_currentRenderDepth", "_x", "_offset", "_newPos", "_forEachIndex"];
|
||||||
|
|
||||||
EXPLODE_4_PVT(_this,_object,_action,_pos,_angles);
|
EXPLODE_4_PVT(_this,_parentPath,_action,_pos,_angles);
|
||||||
EXPLODE_2_PVT(_action,_actionData,_activeChildren);
|
EXPLODE_3_PVT(_action,_actionData,_activeChildren,_actionObject);
|
||||||
EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan);
|
EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan);
|
||||||
|
|
||||||
_menuDepth = (count GVAR(menuDepthPath)) - 1;
|
_menuDepth = (count GVAR(menuDepthPath));
|
||||||
|
|
||||||
// Store path to action
|
// Store path to action
|
||||||
_path = [_object] + (_actionData select 7);
|
_path = +_parentPath;
|
||||||
|
_path pushBack [_actionData select 0,_actionObject];
|
||||||
|
|
||||||
// Check if the menu is on the selected path
|
// Check if the menu is on the selected path
|
||||||
_menuInSelectedPath = true;
|
_menuInSelectedPath = true;
|
||||||
@ -32,7 +33,7 @@ _menuInSelectedPath = true;
|
|||||||
if (_forEachIndex >= (count GVAR(menuDepthPath))) exitWith {
|
if (_forEachIndex >= (count GVAR(menuDepthPath))) exitWith {
|
||||||
_menuInSelectedPath = false;
|
_menuInSelectedPath = false;
|
||||||
};
|
};
|
||||||
if (_x != (GVAR(menuDepthPath) select _forEachIndex)) exitWith {
|
if !(_x isEqualTo (GVAR(menuDepthPath) select _forEachIndex)) exitWith {
|
||||||
_menuInSelectedPath = false;
|
_menuInSelectedPath = false;
|
||||||
};
|
};
|
||||||
} forEach _path;
|
} forEach _path;
|
||||||
@ -42,12 +43,12 @@ _menuInSelectedPath = true;
|
|||||||
_color = "#FFFFFFFF";
|
_color = "#FFFFFFFF";
|
||||||
if(!_menuInSelectedPath) then { //_menuDepth > 0 &&
|
if(!_menuInSelectedPath) then { //_menuDepth > 0 &&
|
||||||
if (_menuDepth > 0) then {
|
if (_menuDepth > 0) then {
|
||||||
_color = format ["#%1FFFFFF", [255 * ((((count _path) - 2)/_menuDepth) max 0.25)] call EFUNC(common,toHex)];
|
_color = format ["#%1FFFFFF", [255 * ((((count _path) - 1)/_menuDepth) max 0.25)] call EFUNC(common,toHex)];
|
||||||
} else {
|
} else {
|
||||||
_color = format ["#%1FFFFFF", [255 * 0.75] call EFUNC(common,toHex)];
|
_color = format ["#%1FFFFFF", [255 * 0.75] call EFUNC(common,toHex)];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
[_actionData select 0, _color, _pos, 1, 1, 0, _actionData select 1, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon);
|
[_actionData select 1, _color, _pos, 1, 1, 0, _actionData select 2, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon);
|
||||||
|
|
||||||
// Add the action to current options
|
// Add the action to current options
|
||||||
GVAR(currentOptions) pushBack [_this, _pos, _path];
|
GVAR(currentOptions) pushBack [_this, _pos, _path];
|
||||||
@ -55,26 +56,44 @@ GVAR(currentOptions) pushBack [_this, _pos, _path];
|
|||||||
// Exit without rendering children if it isn't
|
// Exit without rendering children if it isn't
|
||||||
if !(_menuInSelectedPath) exitWith {true};
|
if !(_menuInSelectedPath) exitWith {true};
|
||||||
|
|
||||||
private ["_angleSpan","_angle"];
|
private ["_angleSpan","_angle","_angleInterval","_scale"];
|
||||||
_angleSpan = _maxAngleSpan min (55 * ((count _activeChildren) - 1));
|
_angleSpan = _maxAngleSpan min (55 * ((count _activeChildren) - 1));
|
||||||
if (_angleSpan >= 305) then {
|
if (_angleSpan >= 305) then {
|
||||||
_angleSpan = 360;
|
_angleSpan = 360;
|
||||||
};
|
};
|
||||||
|
_angleInterval = 55;
|
||||||
|
if (_angleSpan < 360) then {
|
||||||
|
if (count _activeChildren > 1) then {
|
||||||
|
_angleInterval = _angleSpan / (count _activeChildren - 1);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_angleSpan / (count _activeChildren);
|
||||||
|
};
|
||||||
|
if (count _activeChildren == 1) then {
|
||||||
|
_angleInterval = 60;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Scale menu based on distance
|
||||||
|
_scale = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale);
|
||||||
|
// Scale menu based on the amount of children
|
||||||
|
_scale = _scale * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.4) max 0.5);
|
||||||
|
// Animate menu scale
|
||||||
|
if (_menuInSelectedPath && (_menuDepth == count _path)) then {
|
||||||
|
_scale = _scale * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * 8) min 1));
|
||||||
|
};
|
||||||
|
|
||||||
_angle = _centerAngle - _angleSpan / 2;
|
_angle = _centerAngle - _angleSpan / 2;
|
||||||
{
|
{
|
||||||
_target = _object;
|
_target = _actionObject;
|
||||||
_player = ACE_player;
|
_player = ACE_player;
|
||||||
|
|
||||||
_mod = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale);
|
_offset = ((GVAR(refSystem) select 1) vectorMultiply (-_scale * cos _angle)) vectorAdd
|
||||||
|
((GVAR(refSystem) select 2) vectorMultiply (-_scale * sin _angle));
|
||||||
_offset = ((GVAR(refSystem) select 1) vectorMultiply (-_mod * cos _angle)) vectorAdd
|
|
||||||
((GVAR(refSystem) select 2) vectorMultiply (-_mod * sin _angle));
|
|
||||||
_newPos = ((_pos call EFUNC(common,positionToASL)) vectorAdd _offset) call EFUNC(common,ASLToPosition);
|
_newPos = ((_pos call EFUNC(common,positionToASL)) vectorAdd _offset) call EFUNC(common,ASLToPosition);
|
||||||
|
|
||||||
//drawLine3D [_pos, _newPos, [1,0,0,0.5]];
|
//drawLine3D [_pos, _newPos, [1,0,0,0.8]];
|
||||||
|
|
||||||
[_object, _x, _newPos, [_angle, 140]] call FUNC(renderMenu);
|
[_path, _x, _newPos, [_angle, 140]] call FUNC(renderMenu);
|
||||||
|
|
||||||
if (_angleSpan == 360) then {
|
if (_angleSpan == 360) then {
|
||||||
_angle = _angle + _angleSpan / (count _activeChildren);
|
_angle = _angle + _angleSpan / (count _activeChildren);
|
||||||
|
27
addons/interact_menu/functions/fnc_splitPath.sqf
Normal file
27
addons/interact_menu/functions/fnc_splitPath.sqf
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
* Take full path and split it between parent path and action name
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* Full path of the action to remove <ARRAY>
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* 0: Parent path <ARRAY>
|
||||||
|
* 1: Action name <STRING>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_parentPath","_actionName"];
|
||||||
|
_parentPath = [];
|
||||||
|
for [{_i = 0},{_i < (count _this) - 1},{_i = _i + 1}] do {
|
||||||
|
_parentPath pushBack (_this select _i);
|
||||||
|
};
|
||||||
|
_actionName = if (count _this > 0) then {
|
||||||
|
_this select ((count _this) - 1);
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
};
|
||||||
|
|
||||||
|
[_parentPath, _actionName]
|
@ -31,7 +31,7 @@ class CfgVehicles {
|
|||||||
condition = QUOTE(true);
|
condition = QUOTE(true);
|
||||||
statement = "";
|
statement = "";
|
||||||
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
|
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
|
||||||
selection = "spine3";
|
selection = "pelvis";
|
||||||
|
|
||||||
class ACE_TeamManagement {
|
class ACE_TeamManagement {
|
||||||
displayName = "$STR_ACE_Interaction_TeamManagement";
|
displayName = "$STR_ACE_Interaction_TeamManagement";
|
||||||
@ -140,45 +140,52 @@ class CfgVehicles {
|
|||||||
enableInside = 1;
|
enableInside = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
class ACE_Torso {
|
||||||
|
displayName = "$STR_ACE_Interaction_Torso";
|
||||||
|
selection = "spine3";
|
||||||
|
distance = 1.50;
|
||||||
|
condition = "";
|
||||||
|
statement = "";
|
||||||
|
};
|
||||||
class ACE_Head {
|
class ACE_Head {
|
||||||
displayName = "$STR_ACE_Interaction_Head";
|
displayName = "$STR_ACE_Interaction_Head";
|
||||||
selection = "pilot";
|
selection = "pilot";
|
||||||
distance = 2.0;
|
distance = 1.50;
|
||||||
condition = "";
|
condition = "";
|
||||||
statement = "";
|
statement = "";
|
||||||
};
|
};
|
||||||
class ACE_ArmLeft {
|
class ACE_ArmLeft {
|
||||||
displayName = "$STR_ACE_Interaction_ArmLeft";
|
displayName = "$STR_ACE_Interaction_ArmLeft";
|
||||||
selection = "LeftForeArm";
|
selection = "LeftForeArm";
|
||||||
distance = 2.0;
|
distance = 1.50;
|
||||||
condition = "";
|
condition = "";
|
||||||
statement = "";
|
statement = "";
|
||||||
};
|
};
|
||||||
class ACE_ArmRight {
|
class ACE_ArmRight {
|
||||||
displayName = "$STR_ACE_Interaction_ArmRight";
|
displayName = "$STR_ACE_Interaction_ArmRight";
|
||||||
selection = "RightForeArm";
|
selection = "RightForeArm";
|
||||||
distance = 2.0;
|
distance = 1.50;
|
||||||
condition = "";
|
condition = "";
|
||||||
statement = "";
|
statement = "";
|
||||||
};
|
};
|
||||||
class ACE_LegLeft {
|
class ACE_LegLeft {
|
||||||
displayName = "$STR_ACE_Interaction_LegLeft";
|
displayName = "$STR_ACE_Interaction_LegLeft";
|
||||||
selection = "LKnee";
|
selection = "LKnee";
|
||||||
distance = 2.0;
|
distance = 1.50;
|
||||||
condition = "";
|
condition = "";
|
||||||
statement = "";
|
statement = "";
|
||||||
};
|
};
|
||||||
class ACE_LegRight {
|
class ACE_LegRight {
|
||||||
displayName = "$STR_ACE_Interaction_LegRight";
|
displayName = "$STR_ACE_Interaction_LegRight";
|
||||||
selection = "RKnee";
|
selection = "RKnee";
|
||||||
distance = 2.0;
|
distance = 1.50;
|
||||||
condition = "";
|
condition = "";
|
||||||
statement = "";
|
statement = "";
|
||||||
};
|
};
|
||||||
class ACE_Weapon {
|
class ACE_Weapon {
|
||||||
displayName = "$STR_ACE_Interaction_Weapon";
|
displayName = "$STR_ACE_Interaction_Weapon";
|
||||||
selection = "weapon";
|
selection = "weapon";
|
||||||
distance = 2.0;
|
distance = 1.50;
|
||||||
condition = "";
|
condition = "";
|
||||||
statement = "";
|
statement = "";
|
||||||
};
|
};
|
||||||
@ -412,7 +419,14 @@ class CfgVehicles {
|
|||||||
condition = "true";
|
condition = "true";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_SelfActions {};
|
class ACE_SelfActions {
|
||||||
|
class ACE_Passengers {
|
||||||
|
displayName = "$STR_ACE_Interaction_Passengers";
|
||||||
|
condition = "true";
|
||||||
|
statement = "";
|
||||||
|
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class Tank: LandVehicle {
|
class Tank: LandVehicle {
|
||||||
class ACE_Actions {
|
class ACE_Actions {
|
||||||
@ -423,7 +437,14 @@ class CfgVehicles {
|
|||||||
condition = "true";
|
condition = "true";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_SelfActions {};
|
class ACE_SelfActions {
|
||||||
|
class ACE_Passengers {
|
||||||
|
displayName = "$STR_ACE_Interaction_Passengers";
|
||||||
|
condition = "true";
|
||||||
|
statement = "";
|
||||||
|
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Air;
|
class Air;
|
||||||
@ -436,7 +457,14 @@ class CfgVehicles {
|
|||||||
condition = "true";
|
condition = "true";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_SelfActions {};
|
class ACE_SelfActions {
|
||||||
|
class ACE_Passengers {
|
||||||
|
displayName = "$STR_ACE_Interaction_Passengers";
|
||||||
|
condition = "true";
|
||||||
|
statement = "";
|
||||||
|
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class Plane: Air {
|
class Plane: Air {
|
||||||
class ACE_Actions {
|
class ACE_Actions {
|
||||||
@ -447,7 +475,14 @@ class CfgVehicles {
|
|||||||
condition = "true";
|
condition = "true";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_SelfActions {};
|
class ACE_SelfActions {
|
||||||
|
class ACE_Passengers {
|
||||||
|
displayName = "$STR_ACE_Interaction_Passengers";
|
||||||
|
condition = "true";
|
||||||
|
statement = "";
|
||||||
|
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Ship;
|
class Ship;
|
||||||
@ -469,7 +504,14 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_SelfActions {};
|
class ACE_SelfActions {
|
||||||
|
class ACE_Passengers {
|
||||||
|
displayName = "$STR_ACE_Interaction_Passengers";
|
||||||
|
condition = "true";
|
||||||
|
statement = "";
|
||||||
|
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class StaticWeapon: LandVehicle {
|
class StaticWeapon: LandVehicle {
|
||||||
@ -481,7 +523,14 @@ class CfgVehicles {
|
|||||||
condition = "true";
|
condition = "true";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_SelfActions {};
|
class ACE_SelfActions {
|
||||||
|
class ACE_Passengers {
|
||||||
|
displayName = "$STR_ACE_Interaction_Passengers";
|
||||||
|
condition = "true";
|
||||||
|
statement = "";
|
||||||
|
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class StaticMortar;
|
class StaticMortar;
|
||||||
@ -494,7 +543,14 @@ class CfgVehicles {
|
|||||||
condition = "true";
|
condition = "true";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ACE_SelfActions {};
|
class ACE_SelfActions {
|
||||||
|
class ACE_Passengers {
|
||||||
|
displayName = "$STR_ACE_Interaction_Passengers";
|
||||||
|
condition = "true";
|
||||||
|
statement = "";
|
||||||
|
insertChildren = QUOTE(_this call FUNC(addPassengersActions));
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class thingX;
|
class thingX;
|
||||||
|
@ -19,7 +19,7 @@ GVAR(isOpeningDoor) = false;
|
|||||||
["ACE3", QGVAR(openDoor), localize "STR_ACE_Interaction_OpenDoor",
|
["ACE3", QGVAR(openDoor), localize "STR_ACE_Interaction_OpenDoor",
|
||||||
{
|
{
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
// Conditions: specific
|
// Conditions: specific
|
||||||
if (GVAR(isOpeningDoor) || {[2] call FUNC(getDoor) select 1 == ''}) exitWith {false};
|
if (GVAR(isOpeningDoor) || {[2] call FUNC(getDoor) select 1 == ''}) exitWith {false};
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ GVAR(isOpeningDoor) = false;
|
|||||||
["ACE3", QGVAR(tapShoulder), localize "STR_ACE_Interaction_TapShoulder",
|
["ACE3", QGVAR(tapShoulder), localize "STR_ACE_Interaction_TapShoulder",
|
||||||
{
|
{
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
// Conditions: specific
|
// Conditions: specific
|
||||||
if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false};
|
if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false};
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ GVAR(isOpeningDoor) = false;
|
|||||||
["ACE3", QGVAR(modifierKey), localize "STR_ACE_Interaction_ModifierKey",
|
["ACE3", QGVAR(modifierKey), localize "STR_ACE_Interaction_ModifierKey",
|
||||||
{
|
{
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
//if !([ACE_player, objNull, ["isNotDragging"]] call EGVAR(common,canInteractWith)) exitWith {false}; // not needed
|
//if !([ACE_player, objNull, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false}; // not needed
|
||||||
|
|
||||||
// Statement
|
// Statement
|
||||||
ACE_Modifier = 1;
|
ACE_Modifier = 1;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
|
PREP(addPassengerActions);
|
||||||
|
PREP(addPassengersActions);
|
||||||
PREP(addSelectableItem);
|
PREP(addSelectableItem);
|
||||||
PREP(applyButtons);
|
PREP(applyButtons);
|
||||||
PREP(canInteractWithCivilian);
|
PREP(canInteractWithCivilian);
|
||||||
|
@ -5,7 +5,7 @@ class CfgPatches {
|
|||||||
units[] = {};
|
units[] = {};
|
||||||
weapons[] = {};
|
weapons[] = {};
|
||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ace_common"};
|
requiredAddons[] = {"ace_interact_menu"};
|
||||||
author[] = {"commy2", "KoffeinFlummi", "CAA-Picard", "bux578"};
|
author[] = {"commy2", "KoffeinFlummi", "CAA-Picard", "bux578"};
|
||||||
authorUrl = "https://github.com/commy2/";
|
authorUrl = "https://github.com/commy2/";
|
||||||
VERSION_CONFIG;
|
VERSION_CONFIG;
|
||||||
|
31
addons/interaction/functions/fnc_addPassengerActions.sqf
Normal file
31
addons/interaction/functions/fnc_addPassengerActions.sqf
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
* Mount unit actions inside passenger submenu
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Vehicle <OBJECT>
|
||||||
|
* 1: Player <OBJECT>
|
||||||
|
* 3: Parameters <ARRAY>
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Children actions <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters);
|
||||||
|
|
||||||
|
diag_log "addPassengerActions";
|
||||||
|
|
||||||
|
private ["_unit","_actions"];
|
||||||
|
_unit = _parameters select 0;
|
||||||
|
|
||||||
|
_varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit];
|
||||||
|
_actionTrees = missionNamespace getVariable [_varName, []];
|
||||||
|
|
||||||
|
_actions = [];
|
||||||
|
// Mount unit MainActions menu
|
||||||
|
_actions pushBack [(_actionTrees select 0) select 0, (_actionTrees select 0) select 1, _unit];
|
||||||
|
|
||||||
|
_actions
|
42
addons/interaction/functions/fnc_addPassengersActions.sqf
Normal file
42
addons/interaction/functions/fnc_addPassengersActions.sqf
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Author: CAA-Picard
|
||||||
|
* Create one action per passenger
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Vehicle <OBJECT>
|
||||||
|
* 1: Player <OBJECT>
|
||||||
|
* 3: Parameters <ARRAY>
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Children actions <ARRAY>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters);
|
||||||
|
|
||||||
|
private ["_actions"];
|
||||||
|
_actions = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
_unit = _x;
|
||||||
|
if (_x != _player) then {
|
||||||
|
_actions pushBack
|
||||||
|
[
|
||||||
|
[
|
||||||
|
str(_unit),
|
||||||
|
[_unit, true] call EFUNC(common,getName),
|
||||||
|
"",
|
||||||
|
{},
|
||||||
|
{true},
|
||||||
|
{_this call FUNC(addPassengerActions);},
|
||||||
|
[_unit]
|
||||||
|
] call EFUNC(interact_menu,createAction),
|
||||||
|
[],
|
||||||
|
_unit
|
||||||
|
];
|
||||||
|
};
|
||||||
|
} forEach crew _vehicle;
|
||||||
|
|
||||||
|
_actions
|
@ -47,7 +47,7 @@ playSound "ACE_Sound_Click";
|
|||||||
!GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1}
|
!GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!_usedMouseWheel && {time < _time} && {[ACE_player, objNull, []] call EGVAR(common,canInteractWith)}) then {
|
if (!_usedMouseWheel && {time < _time} && {[ACE_player, objNull, []] call EFUNC(common,canInteractWith)}) then {
|
||||||
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
|
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
|
||||||
|
|
||||||
{_house animate [_x, _phase]} forEach _animations;
|
{_house animate [_x, _phase]} forEach _animations;
|
||||||
|
@ -5,7 +5,7 @@ EXPLODE_3_PVT(_this,_tapper,_target,_shoulderNum);
|
|||||||
|
|
||||||
if (_target != ACE_player) exitWith {
|
if (_target != ACE_player) exitWith {
|
||||||
addCamShake [4, 0.5, 5];
|
addCamShake [4, 0.5, 5];
|
||||||
ACE_player playActionNow 'gestureAdvance';
|
ACE_player playActionNow "PutDown";
|
||||||
if !(local _target) then {
|
if !(local _target) then {
|
||||||
[[_tapper, _target, _shoulderNum], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc);
|
[[_tapper, _target, _shoulderNum], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc);
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
<Key ID="STR_ACE_Interaction_MainAction">
|
<Key ID="STR_ACE_Interaction_MainAction">
|
||||||
<English>Interactions >></English>
|
<English>Interactions >></English>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Interaction_Torso">
|
||||||
|
<English>Torso >></English>
|
||||||
|
</Key>
|
||||||
<Key ID="STR_ACE_Interaction_Head">
|
<Key ID="STR_ACE_Interaction_Head">
|
||||||
<English>Head >></English>
|
<English>Head >></English>
|
||||||
</Key>
|
</Key>
|
||||||
@ -650,5 +653,8 @@
|
|||||||
<Polish>Interakcja</Polish>
|
<Polish>Interakcja</Polish>
|
||||||
<Spanish>Interactuar</Spanish>
|
<Spanish>Interactuar</Spanish>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Interaction_Passengers">
|
||||||
|
<English>Passengers >></English>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user