mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
manual merge
This commit is contained in:
commit
8d8e2ec10b
@ -1,5 +1,7 @@
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/KoffeinFlummi/ACE3/new-readme/extras/logo.png?token=ACU2mWeJUeshQIVc52XPoNiPpc3PzTauks5Uv24rwA%3D%3D" height="150px" /><br />
|
||||
<img src="https://github.com/KoffeinFlummi/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg" height="80" />
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/KoffeinFlummi/ACE3/releases">
|
||||
<img src="http://img.shields.io/badge/release-3.0-green.svg?style=flat" alt="ACE version">
|
||||
</a>
|
||||
|
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;
|
@ -154,15 +154,10 @@ class CfgVehicles {
|
||||
MACRO_LOADUNLOADCAPTIVE
|
||||
};
|
||||
|
||||
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
|
||||
name = #ITEM; \
|
||||
count = COUNT; \
|
||||
};
|
||||
|
||||
class Box_NATO_Support_F;
|
||||
class ACE_Box_Misc: Box_NATO_Support_F {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_CableTie,12)
|
||||
MACRO_ADDITEM(ACE_CableTie,12);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -27,12 +27,11 @@ if (isServer) then {
|
||||
["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler);
|
||||
["SetSurrendered", {_this call FUNC(setSurrendered)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
//TODO: Medical Integration Events???
|
||||
//Medical Integration Events???
|
||||
["medical_onUnconscious", {_this call ACE_Captives_fnc_handleOnUnconscious}] call EFUNC(common,addEventHandler);
|
||||
|
||||
// [_unit, "knockedOut", {
|
||||
// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut};
|
||||
// }] call ACE_Core_fnc_addCustomEventhandler;
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// [_unit, "wokeUp", {
|
||||
// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp};
|
||||
// }] call ACE_Core_fnc_addCustomEventhandler;
|
||||
["isNotEscorting", {!(GETVAR(_this select 0,GVAR(isEscorting),false))}] call EFUNC(common,addCanInteractWithCondition);
|
||||
["isNotHandcuffed", {!(GETVAR(_this select 0,GVAR(isHandcuffed),false))}] call EFUNC(common,addCanInteractWithCondition);
|
||||
["isNotSurrendering", {!(GETVAR(_this select 0,GVAR(isSurrendering),false))}] call EFUNC(common,addCanInteractWithCondition);
|
||||
|
@ -19,10 +19,9 @@ PREP(doUnloadCaptive);
|
||||
PREP(handleGetIn);
|
||||
PREP(handleGetOut);
|
||||
PREP(handleKilled);
|
||||
PREP(handleKnockedOut);
|
||||
PREP(handleOnUnconscious);
|
||||
PREP(handlePlayerChanged);
|
||||
PREP(handleUnitInitPost);
|
||||
PREP(handleWokeUp);
|
||||
PREP(handleZeusDisplayChanged);
|
||||
PREP(moduleSurrender);
|
||||
PREP(setHandcuffed);
|
||||
|
@ -16,16 +16,3 @@ class CfgPatches {
|
||||
#include "CfgMoves.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
|
||||
|
||||
class ACE_canInteractConditions {
|
||||
class GVAR(isNotEscorting) {
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false)));
|
||||
};
|
||||
class GVAR(isNotHandcuffed) {
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false)));
|
||||
};
|
||||
class GVAR(isNotSurrendering) {
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isSurrendering),false)));
|
||||
};
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ if (_state) then {
|
||||
_unit setVariable [QGVAR(escortedUnit), objNull, true];
|
||||
};
|
||||
};
|
||||
[_escortFnc, 0.2, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler;
|
||||
[_escortFnc, 0, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
} else {
|
||||
_unit setVariable [QGVAR(isEscorting), false, true];
|
||||
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Author: commy2, PabstMirror
|
||||
* Handles when a unit gets knocked out. Ends surrendering.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [bob, true] call ACE_captives_fnc_handleKnockedOut
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
||||
//ToDo: Waiting on medical integration
|
||||
|
||||
PARAMS_1(_unit);
|
||||
|
||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop
|
||||
[_unit, false] call FUNC(setSurrendered);
|
||||
};
|
36
addons/captives/functions/fnc_handleOnUnconscious.sqf
Normal file
36
addons/captives/functions/fnc_handleOnUnconscious.sqf
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Author: commy2, PabstMirror
|
||||
* Handles the "medical_onUnconscious" event
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 0: Is Unconsisisiouses <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [bob, true] call ACE_captives_fnc_handleOnUnconscious
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_isUnconc);
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
systemChat format ["med: %1", _this];
|
||||
|
||||
if (_isUnconc) then {
|
||||
//Knocked out: If surrendering, stop
|
||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
||||
[_unit, false] call FUNC(setSurrendered);
|
||||
};
|
||||
} else {
|
||||
//Woke up: if handcuffed, goto animation
|
||||
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
|
||||
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||
};
|
||||
};
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* TODO
|
||||
*
|
||||
* Arguments:
|
||||
* 0: _unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* The return value <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [bob] call ACE_captives_fnc_handleWokeUp
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
|
||||
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
|
||||
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation);
|
||||
};
|
@ -52,7 +52,7 @@ if (_state) then {
|
||||
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
||||
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
|
||||
PARAMS_2(_unit,_newAnimation);
|
||||
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && (_newAnimation != "Unconscious")) then {
|
||||
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
||||
ERROR("Handcuff animation interrupted");
|
||||
systemChat format ["debug %2: new %1", _newAnimation, time];
|
||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||
@ -71,8 +71,8 @@ if (_state) then {
|
||||
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
||||
_unit setVariable [QGVAR(handcuffAnimEHID), -1];
|
||||
|
||||
if ((vehicle _unit) == _unit) then {
|
||||
//Break out of hands up animation loop (doAnimation handles Unconscious prioity)
|
||||
if (((vehicle _unit) == _unit) && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
||||
//Break out of hands up animation loop
|
||||
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ if (_state) then {
|
||||
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
||||
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
|
||||
PARAMS_2(_unit,_newAnimation);
|
||||
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && (_newAnimation != "Unconscious")) then {
|
||||
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
||||
ERROR("Surrender animation interrupted");
|
||||
systemChat format ["debug %2: new %1", _newAnimation, time];
|
||||
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||
|
@ -7,14 +7,22 @@ class CfgWeapons {
|
||||
simulation = "ItemMineDetector";
|
||||
};
|
||||
|
||||
class Rifle_Base_F;
|
||||
class Rifle;
|
||||
class Rifle_Base_F: Rifle {
|
||||
class WeaponSlotsInfo;
|
||||
};
|
||||
|
||||
class ACE_FakePrimaryWeapon: Rifle_Base_F {
|
||||
scope = 2;
|
||||
displayName = "";
|
||||
model = "";
|
||||
picture = "";
|
||||
magazines[] = {"ACE_FakeMagazine"};
|
||||
discreteDistance[] = {};
|
||||
discreteDistanceInitIndex = 0;
|
||||
displayName = "";
|
||||
picture = "";
|
||||
model = "";
|
||||
magazines[] = {"ACE_FakeMagazine"};
|
||||
scope = 2;
|
||||
|
||||
class WeaponSlotsInfo: WeaponSlotsInfo {
|
||||
mass = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -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 controls {
|
||||
class MapMarkerCreated: RscMapControl {
|
||||
|
@ -20,6 +20,19 @@ if (hasInterface) then {
|
||||
};
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
["fixCollision", DFUNC(fixCollision)] call FUNC(addEventhandler);
|
||||
["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler);
|
||||
["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler);
|
||||
|
||||
["lockVehicle", {
|
||||
_this setVariable [QGVAR(lockStatus), locked _this];
|
||||
_this lock 2;
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
["unlockVehicle", {
|
||||
_this lock (_this getVariable [QGVAR(lockStatus), locked _this]);
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
// hack to get PFH to work in briefing
|
||||
[QGVAR(onBriefingPFH), "onEachFrame", {
|
||||
if (time > 0) exitWith {
|
||||
@ -55,8 +68,6 @@ if (_currentVersion != _previousVersion) then {
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
call COMPILE_FILE(scripts\assignedItemFix);
|
||||
|
||||
call COMPILE_FILE(scripts\initCanInteractFunction);
|
||||
call COMPILE_FILE(scripts\initScrollWheel);
|
||||
|
||||
0 spawn {
|
||||
@ -88,6 +99,7 @@ GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312);
|
||||
GVAR(OldCameraView) = cameraView;
|
||||
GVAR(OldPlayerVehicle) = vehicle ACE_player;
|
||||
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
||||
GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
||||
|
||||
// PFH to raise varios events
|
||||
[{
|
||||
@ -148,6 +160,14 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
||||
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerWeaponChanged" event
|
||||
_newPlayerWeapon = currentWeapon ACE_player;
|
||||
if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerWeapon) = _newPlayerWeapon;
|
||||
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||
|
||||
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
@ -162,11 +182,4 @@ _vehicle setFuel _fuelLevel;
|
||||
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler);
|
||||
["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler);
|
||||
|
||||
["lockVehicle", {
|
||||
_this setVariable [QGVAR(lockStatus), locked _this];
|
||||
_this lock 2;
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
["unlockVehicle", {
|
||||
_this lock (_this getVariable [QGVAR(lockStatus), locked _this]);
|
||||
}] call FUNC(addEventhandler);
|
||||
["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithCondition);
|
||||
|
@ -6,8 +6,7 @@ ADDON = false;
|
||||
// ACE Common Function
|
||||
PREP(addActionEventHandler);
|
||||
PREP(addActionMenuEventHandler);
|
||||
PREP(addCameraEventHandler);
|
||||
PREP(addCustomEventHandler);
|
||||
PREP(addCanInteractWithCondition);
|
||||
PREP(addLineToDebugDraw);
|
||||
PREP(addMapMarkerCreatedEventHandler);
|
||||
PREP(addScrollWheelEventHandler);
|
||||
@ -20,8 +19,6 @@ PREP(beingCarried);
|
||||
PREP(binarizeNumber);
|
||||
PREP(blurScreen);
|
||||
PREP(cachedCall);
|
||||
PREP(callCustomEventHandlers);
|
||||
PREP(callCustomEventHandlersGlobal);
|
||||
PREP(canGetInPosition);
|
||||
PREP(canInteract);
|
||||
PREP(canInteractWith);
|
||||
@ -54,7 +51,10 @@ PREP(execPersistentFnc);
|
||||
PREP(execRemoteFnc);
|
||||
PREP(executePersistent);
|
||||
PREP(filter);
|
||||
PREP(fixCollision);
|
||||
PREP(fixFloating);
|
||||
PREP(fixLoweredRifleAnimation);
|
||||
PREP(fixPosition);
|
||||
PREP(getAllDefinedSetVariables);
|
||||
PREP(getAllGear);
|
||||
PREP(getCaptivityStatus);
|
||||
@ -146,8 +146,7 @@ PREP(readSettingFromModule);
|
||||
PREP(receiveRequest);
|
||||
PREP(removeActionEventHandler);
|
||||
PREP(removeActionMenuEventHandler);
|
||||
PREP(removeCameraEventHandler);
|
||||
PREP(removeCustomEventHandler);
|
||||
PREP(removeCanInteractWithCondition);
|
||||
PREP(removeMapMarkerCreatedEventHandler);
|
||||
PREP(removeScrollWheelEventHandler);
|
||||
PREP(removeSpecificMagazine);
|
||||
@ -253,8 +252,6 @@ if (hasInterface) then {
|
||||
ACE_player = missionNamespace getVariable ["BIS_fnc_moduleRemoteControl_unit", player];
|
||||
uiNamespace setVariable ["ACE_player", ACE_player];
|
||||
|
||||
// Raise custom event. @todo, remove
|
||||
[missionNamespace, "playerChanged", [ACE_player, _oldPlayer]] call FUNC(callCustomEventHandlers);
|
||||
// Raise ACE event
|
||||
["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent);
|
||||
};
|
||||
|
@ -51,12 +51,6 @@ class ACE_Rsc_Control_Base {
|
||||
h = 0;
|
||||
};
|
||||
|
||||
class ACE_canInteractConditions {
|
||||
class GVAR(notOnMap) {
|
||||
condition = "!visibleMap";
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Settings {
|
||||
/*
|
||||
*class GVAR(sampleSetting) {
|
||||
|
@ -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
|
38
addons/common/functions/fnc_addCanInteractWithCondition.sqf
Normal file
38
addons/common/functions/fnc_addCanInteractWithCondition.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Add a condition that gets checked by ace_common_fnc_canInteractWith.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites. (String)
|
||||
* 1: The condition to check. format of "_this" is "[_player, _target]". (Code)
|
||||
*
|
||||
* Return Value:
|
||||
* Unit can interact?
|
||||
*
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_conditionName", "_conditionFunc"];
|
||||
|
||||
_conditionName = toLower (_this select 0);
|
||||
_conditionFunc = _this select 1;
|
||||
|
||||
private ["_conditions", "_conditionNames", "_conditionFuncs"];
|
||||
|
||||
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
||||
|
||||
_conditionNames = _conditions select 0;
|
||||
_conditionFuncs = _conditions select 1;
|
||||
|
||||
private "_index";
|
||||
_index = _conditionNames find _conditionName;
|
||||
|
||||
if (_index == -1) then {
|
||||
_index = count _conditionNames;
|
||||
};
|
||||
|
||||
_conditionNames set [_index, _conditionName];
|
||||
_conditionFuncs set [_index, _conditionFunc];
|
||||
|
||||
GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs];
|
@ -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
|
@ -11,4 +11,4 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
sunOrMoon * sunOrMoon + moonIntensity/5 min 1
|
||||
sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity/5 min 1) * (1 - overcast)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
* 0: Parameters <ARRAY>
|
||||
@ -8,6 +8,7 @@
|
||||
* 2: Namespace to store the cache on <NAMESPACE>
|
||||
* 3: Cache uid <STRING>
|
||||
* 4: Max duration of the cache <NUMBER>
|
||||
* 5: Event that clears the cache <STRING> (Optional)
|
||||
*
|
||||
* Return Value:
|
||||
* 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 {
|
||||
_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
|
||||
diag_log format ["Calculated result: %1 %2", _namespace, _uid];
|
||||
} 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,11 +1,53 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
* Check if the unit can interact.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The player. <OBJECT>
|
||||
* 1: The interaction target. objNull to ignore. <OBJECT>
|
||||
* 2: Exceptions. What general conditions are to skip? <ARRAY> (Optional)
|
||||
*
|
||||
* Return Value:
|
||||
* Unit can interact?
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target", "_owner"];
|
||||
private ["_unit", "_target", "_exceptions"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
_exceptions = if (count _this > 2) then {
|
||||
_this select 2;
|
||||
} else {
|
||||
[];
|
||||
};
|
||||
|
||||
_owner = _target getVariable ["ACE_isUsedBy", objNull];
|
||||
_exceptions = [_exceptions, {toLower _this}] call FUNC(map);
|
||||
|
||||
isNull _owner || {_unit == _owner} || {!isPlayer _owner}
|
||||
// exit if the target is not free to interact
|
||||
private "_owner";
|
||||
_owner = _target getVariable [QGVAR(owner), objNull];
|
||||
|
||||
if (!isNull _owner && {_unit != _owner}) exitWith {false};
|
||||
|
||||
// check general conditions
|
||||
|
||||
private ["_conditions", "_conditionNames", "_conditionFuncs"];
|
||||
|
||||
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
||||
|
||||
_conditionNames = _conditions select 0;
|
||||
_conditionFuncs = _conditions select 1;
|
||||
|
||||
private "_canInteract";
|
||||
_canInteract = true;
|
||||
|
||||
{
|
||||
if (!(_x in _exceptions) && {!([_unit, _target] call (_conditionFuncs select _forEachIndex))}) exitWith {
|
||||
_canInteract = false;
|
||||
};
|
||||
} forEach _conditionNames;
|
||||
|
||||
_canInteract
|
||||
|
21
addons/common/functions/fnc_fixCollision.sqf
Normal file
21
addons/common/functions/fnc_fixCollision.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Attempt to fix physx collisions causing unreasonable impact forces and damage.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// allowDamage requires local object
|
||||
if (!local _this) exitWith {};
|
||||
|
||||
// prevent collision damage, @todo allowDamage API
|
||||
_this allowDamage false;
|
||||
|
||||
// re-allow damage after 2 seconds
|
||||
[{_this allowDamage true}, _this, 2, 0] call EFUNC(common,waitAndExecute);
|
32
addons/common/functions/fnc_fixFloating.sqf
Normal file
32
addons/common/functions/fnc_fixFloating.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Attempt to fix floating physx with disabled damage after setPosXXX commands.
|
||||
*
|
||||
* Arguments:
|
||||
* Physx object (Object)
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_object";
|
||||
|
||||
_object = _this;
|
||||
|
||||
// setHitPointDamage requires local object
|
||||
if (!local _object) exitWith {};
|
||||
|
||||
// save and restore hitpoints, see below why
|
||||
private ["_hitPoints", "_hitPointDamages"];
|
||||
|
||||
_hitPoints = [_object] call FUNC(getHitpoints);
|
||||
_hitPointDamages = [_hitPoints, {_object getHitPointDamage _this}] call FUNC(map);
|
||||
|
||||
// this prevents physx objects from floating when near other physx objects with allowDamage false
|
||||
_object setDamage damage _object;
|
||||
|
||||
{
|
||||
_object setHitPointDamage [_x, _hitPointDamages select _forEachIndex];
|
||||
} forEach _hitPoints;
|
29
addons/common/functions/fnc_fixPosition.sqf
Normal file
29
addons/common/functions/fnc_fixPosition.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Fixes position of an object. E.g. moves object above ground and adjusts to terrain slope. Requires local object.
|
||||
*
|
||||
* Argument:
|
||||
* Object (Object)
|
||||
*
|
||||
* Return value:
|
||||
* NONE
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// setVectorUp requires local object
|
||||
if (!local _this) exitWith {};
|
||||
|
||||
private "_position";
|
||||
_position = getPos _this;
|
||||
|
||||
// don't place the object below the ground
|
||||
if (_position select 2 < -0.1) then {
|
||||
_position set [2, -0.1];
|
||||
_this setPos _position;
|
||||
};
|
||||
|
||||
// adjust position to sloped terrain, if placed on ground
|
||||
if (getPosATL _this select 2 == _position select 2) then {
|
||||
_this setVectorUp surfaceNormal _position;
|
||||
};
|
@ -11,7 +11,7 @@
|
||||
* 3: CODE or STRING - On Failure: Code called or STRING raised as event.
|
||||
* 4: STRING - (Optional) Localized Title
|
||||
* 5: CODE - (Optional) Code to check each frame
|
||||
* 6: ARRAY - (Optional) Exceptions for checking EGVAR(common,canInteract)
|
||||
* 6: ARRAY - (Optional) Exceptions for checking EFUNC(common,canInteractWith)
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
@ -53,6 +53,7 @@ _perFrameFunction = {
|
||||
_elapsedTime = time - _startTime;
|
||||
_errorCode = -1;
|
||||
|
||||
// this does not check: target fell unconscious, target died, target moved inside vehicle / left vehicle, target moved outside of players range, target moves at all.
|
||||
if (isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then {
|
||||
_errorCode = 1;
|
||||
} else {
|
||||
@ -62,7 +63,7 @@ _perFrameFunction = {
|
||||
if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then {
|
||||
_errorCode = 3;
|
||||
} else {
|
||||
if (!(_exceptions call EGVAR(common,canInteract))) then {
|
||||
if (!([_player, objNull, _exceptions] call EFUNC(common,canInteractWith))) then {
|
||||
_errorCode = 4;
|
||||
} else {
|
||||
if (_elapsedTime >= _totalTime) then {
|
||||
@ -75,7 +76,11 @@ _perFrameFunction = {
|
||||
|
||||
if (_errorCode != -1) then {
|
||||
//Error or Success, close dialog and remove PFEH
|
||||
|
||||
//Only close dialog if it's the progressBar:
|
||||
if (!isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then {
|
||||
closeDialog 0;
|
||||
};
|
||||
[_pfhID] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
if (_errorCode == 0) then {
|
||||
|
@ -1,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]];
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Remove a condition that gets checked by ace_common_fnc_canInteractWith.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The conditions id. (String)
|
||||
*
|
||||
* Return Value:
|
||||
* Unit can interact?
|
||||
*
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_conditionName";
|
||||
|
||||
_conditionName = toLower (_this select 0);
|
||||
|
||||
private ["_conditions", "_conditionNames", "_conditionFuncs"];
|
||||
|
||||
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
||||
|
||||
_conditionNames = _conditions select 0;
|
||||
_conditionFuncs = _conditions select 1;
|
||||
|
||||
private "_index";
|
||||
_index = _conditionNames find _conditionName;
|
||||
|
||||
if (_index == -1) exitWith {};
|
||||
|
||||
_conditionNames deleteAt _index;
|
||||
_conditionFuncs deleteAt _index;
|
||||
|
||||
GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs];
|
@ -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,20 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_function", "_configFile", "_count", "_index", "_config", "_configName", "_condition"];
|
||||
|
||||
_function = "private '_exceptions'; _exceptions = _this; alive ACE_player";
|
||||
|
||||
_configFile = configFile >> "ACE_canInteractConditions";
|
||||
_count = count _configFile;
|
||||
|
||||
for "_index" from 0 to (_count -1) do {
|
||||
_config = _configFile select _index;
|
||||
_configName = configName _config;
|
||||
|
||||
_condition = getText (_config >> "condition");
|
||||
|
||||
_function = _function + format ["&& {%1 || {'%2' in _exceptions}}", _condition, _configName];
|
||||
};
|
||||
|
||||
GVAR(canInteract) = compileFinal _function;
|
@ -1,7 +1,7 @@
|
||||
ace_disposable
|
||||
==============
|
||||
|
||||
Makes the NLAW a disposable one-way weapon.
|
||||
Makes the NLAW a disposable one-shot weapon.
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
@ -4,10 +4,8 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(UpdateInventoryDisplay_EHID)) then {
|
||||
GVAR(UpdateInventoryDisplay_EHID) = ["inventoryDisplayLoaded",{
|
||||
["inventoryDisplayLoaded",{
|
||||
_player = ACE_player;
|
||||
[_player, secondaryWeapon _player] call FUNC(takeLoadedATWeapon);
|
||||
[_player] call FUNC(takeLoadedATWeapon);
|
||||
[_player, (_this select 0)] call FUNC(updateInventoryDisplay);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
};
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(aiDropWeaponCallback);
|
||||
PREP(replaceATWeapon);
|
||||
PREP(takeLoadedATWeapon);
|
||||
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.
|
||||
*
|
||||
* Argument:
|
||||
* Input from "Fired" eventhandler
|
||||
* Arguments:
|
||||
* 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
|
||||
*
|
||||
* Example:
|
||||
* [fromBisFiredEH] call ace_disposable_fnc_replaceATWeapon;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_tube", "_projectile"];
|
||||
private ["_unit", "_weapon", "_projectile", "_replacementTube", "_items"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_tube = getText (configFile >> "CfgWeapons" >> (_this select 1) >> "ACE_UsedTube");
|
||||
_weapon = _this select 1;
|
||||
_projectile = _this select 6;
|
||||
|
||||
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;
|
||||
|
||||
_unit addWeapon _tube;
|
||||
_unit selectWeapon _tube;
|
||||
//Replace the orginal weapon with the 'usedTube' weapon
|
||||
_unit addWeapon _replacementTube;
|
||||
//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};
|
||||
} forEach _items;
|
||||
|
||||
// AI
|
||||
|
||||
// AI - Remove the ai's missle launcher tube after the missle has exploded
|
||||
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
|
||||
*
|
||||
* Handle the take event. Add a dummy magazine if a disposable rocket launcher is taken.
|
||||
*
|
||||
* Argument:
|
||||
* Input from "Take" eventhandler
|
||||
* Arguments:
|
||||
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [fromTakeEH] call ace_disposable_fnc_takeLoadedATWeapon;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_launcher", "_config"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_launcher = secondaryWeapon _unit;
|
||||
|
||||
PARAMS_1(_unit);
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
_launcher = secondaryWeapon _unit;
|
||||
_config = configFile >> "CfgWeapons" >> _launcher;
|
||||
|
||||
if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then {
|
||||
|
@ -1,26 +1,28 @@
|
||||
/*
|
||||
* Author: bux, commy2
|
||||
*
|
||||
* Hide or show the secondary weapon magazine inventory slot to prevent unloading of dummy magazines.
|
||||
*
|
||||
* Argument:
|
||||
* 0: The player. (Object)
|
||||
* Arguments:
|
||||
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_disposable_fnc_updateInventoryDisplay;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#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_FiredMissileDummy";
|
||||
|
||||
disableSerialization;
|
||||
_display = [_this, 1, (findDisplay 602)] call BIS_fnc_param;
|
||||
if (isNull _display) exitWith {};
|
||||
|
||||
private ["_launcher", "_control", "_config"];
|
||||
|
1
addons/dragging/$PBOPREFIX$
Normal file
1
addons/dragging/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\dragging
|
47
addons/dragging/CfgEventHandlers.hpp
Normal file
47
addons/dragging/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
|
||||
serverInit = QUOTE(call COMPILE_FILE(XEH_serverInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Init_EventHandlers {
|
||||
class StaticWeapon {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
};
|
||||
};
|
||||
class StaticMortar {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
};
|
||||
};
|
||||
class ReammoBox_F {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Killed_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
killed = QUOTE(_this call DFUNC(handleKilled));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_AnimChanged_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
animChanged = QUOTE(_this call DFUNC(handleAnimChanged));
|
||||
};
|
||||
};
|
||||
};
|
86
addons/dragging/CfgVehicles.hpp
Normal file
86
addons/dragging/CfgVehicles.hpp
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
class CfgVehicles {
|
||||
// Static weapons
|
||||
class LandVehicle;
|
||||
class StaticWeapon: LandVehicle {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(carryPosition[]) = {0,1.2,0};
|
||||
GVAR(carryDirection) = 0;
|
||||
|
||||
GVAR(canDrag) = 1;
|
||||
GVAR(dragPosition[]) = {0,1.2,0};
|
||||
GVAR(dragDirection) = 0;
|
||||
};
|
||||
|
||||
//remove actions from Taru Pods
|
||||
class Pod_Heli_Transport_04_base_F: StaticWeapon {
|
||||
GVAR(canCarry) = 0;
|
||||
GVAR(canDrag) = 0;
|
||||
};
|
||||
|
||||
class StaticMortar;
|
||||
class Mortar_01_base_F: StaticMortar {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(carryPosition[]) = {0,1.2,0};
|
||||
GVAR(carryDirection) = 0;
|
||||
|
||||
GVAR(canDrag) = 1;
|
||||
GVAR(dragPosition[]) = {0,1.2,0};
|
||||
GVAR(dragDirection) = 0;
|
||||
};
|
||||
|
||||
// ammo boxes
|
||||
class ThingX;
|
||||
class ReammoBox_F: ThingX {
|
||||
XEH_ENABLED;
|
||||
GVAR(canCarry) = 0;
|
||||
GVAR(carryPosition[]) = {0,1,1};
|
||||
GVAR(carryDirection) = 0;
|
||||
|
||||
GVAR(canDrag) = 0;
|
||||
GVAR(dragPosition[]) = {0,1.2,0};
|
||||
GVAR(dragDirection) = 0;
|
||||
};
|
||||
|
||||
class Slingload_base_F: ReammoBox_F {
|
||||
GVAR(canCarry) = 0;
|
||||
GVAR(canDrag) = 0;
|
||||
};
|
||||
|
||||
class EAST_Box_Base: ReammoBox_F {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(canDrag) = 1;
|
||||
};
|
||||
class IND_Box_Base: ReammoBox_F {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(canDrag) = 1;
|
||||
};
|
||||
/*class FIA_Box_Base_F: ReammoBox_F {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(canDrag) = 1;
|
||||
};*/
|
||||
class NATO_Box_Base: ReammoBox_F {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(canDrag) = 1;
|
||||
};
|
||||
|
||||
// Remove Larger crate dragging support.
|
||||
// Would be better to allow some sort of joint push/drag functionality
|
||||
// Requiring 2 units to access the larger crates and attaching them together (a crappy method of doing it)
|
||||
// in order to move the bigger ones. Currently simply remove support.
|
||||
// I believe these crates are currently broken (hitbox doesn't work or something) in 1.22 (2014-07-04)
|
||||
class Box_East_AmmoVeh_F: EAST_Box_Base {
|
||||
GVAR(canCarry) = 0;
|
||||
GVAR(canDrag) = 0;
|
||||
};
|
||||
|
||||
class Box_NATO_AmmoVeh_F: NATO_Box_Base {
|
||||
GVAR(canCarry) = 0;
|
||||
GVAR(canDrag) = 0;
|
||||
};
|
||||
|
||||
class Box_IND_AmmoVeh_F: IND_Box_Base {
|
||||
GVAR(canCarry) = 0;
|
||||
GVAR(canDrag) = 0;
|
||||
};
|
||||
};
|
19
addons/dragging/XEH_clientInit.sqf
Normal file
19
addons/dragging/XEH_clientInit.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
// by PabstMirror, commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
[{_this call DFUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler);
|
||||
|
||||
if (isNil "ACE_maxWeightDrag") then {
|
||||
ACE_maxWeightDrag = 800;
|
||||
};
|
||||
|
||||
if (isNil "ACE_maxWeightCarry") then {
|
||||
ACE_maxWeightCarry = 600;
|
||||
};
|
||||
|
||||
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||
|
||||
// release object on player change. This does work when returning to lobby, but not when hard disconnecting.
|
||||
["playerChanged", {_this call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
|
||||
["playerWeaponChanged", {_this call DFUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler);
|
28
addons/dragging/XEH_preInit.sqf
Normal file
28
addons/dragging/XEH_preInit.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(canCarry);
|
||||
PREP(canDrag);
|
||||
PREP(canDrop);
|
||||
PREP(canDrop_carry);
|
||||
PREP(carryObject);
|
||||
PREP(carryObjectPFH);
|
||||
PREP(dragObject);
|
||||
PREP(dragObjectPFH);
|
||||
PREP(dropObject);
|
||||
PREP(dropObject_carry);
|
||||
PREP(getWeight);
|
||||
PREP(handleAnimChanged);
|
||||
PREP(handleKilled);
|
||||
PREP(handlePlayerChanged);
|
||||
PREP(handlePlayerWeaponChanged);
|
||||
PREP(handleScrollWheel);
|
||||
PREP(initObject);
|
||||
PREP(isObjectOnObject);
|
||||
PREP(setCarryable);
|
||||
PREP(setDraggable);
|
||||
PREP(startDrag);
|
||||
PREP(startDragPFH);
|
||||
|
||||
ADDON = true;
|
5
addons/dragging/XEH_serverInit.sqf
Normal file
5
addons/dragging/XEH_serverInit.sqf
Normal file
@ -0,0 +1,5 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
// release object on hard disconnection. Function is identical to killed
|
||||
addMissionEventHandler ["HandleDisconnect", {_this call DFUNC(handleKilled)}];
|
16
addons/dragging/config.cpp
Normal file
16
addons/dragging/config.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common","ace_interaction","ace_interact_menu"};
|
||||
author[] = {"Garth 'L-H' de Wet","commy2"};
|
||||
authorUrl = "https://github.com/commy2/";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
25
addons/dragging/functions/fnc_canCarry.sqf
Normal file
25
addons/dragging/functions/fnc_canCarry.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Check if unit can carry the object. Doesn't check weight.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the carrying (Object)
|
||||
* 1: Object to carry (Object)
|
||||
*
|
||||
* Return value:
|
||||
* Can the unit carry the object? (Bool)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
// a static weapon has to be empty for dragging
|
||||
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
|
||||
|
||||
alive _target && {_target getVariable [QGVAR(canCarry), false]}
|
25
addons/dragging/functions/fnc_canDrag.sqf
Normal file
25
addons/dragging/functions/fnc_canDrag.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Check if unit can drag the object. Doesn't check weight.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the dragging (Object)
|
||||
* 1: Object to drag (Object)
|
||||
*
|
||||
* Return value:
|
||||
* Can the unit drag the object? (Bool)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
// a static weapon has to be empty for dragging
|
||||
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
|
||||
|
||||
alive _target && {_target getVariable [QGVAR(canDrag), false]}
|
22
addons/dragging/functions/fnc_canDrop.sqf
Normal file
22
addons/dragging/functions/fnc_canDrop.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Check if unit can drop the object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that currently drags a object (Object)
|
||||
* 1: Object that is dragged (Object)
|
||||
*
|
||||
* Return value:
|
||||
* Can the unit drop the object? (Bool)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
if !([_unit, _target, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
_unit getVariable [QGVAR(draggedObject), objNull] == _target
|
22
addons/dragging/functions/fnc_canDrop_carry.sqf
Normal file
22
addons/dragging/functions/fnc_canDrop_carry.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Check if unit can drop the carried object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that currently carries a object (Object)
|
||||
* 1: Object that is carried (Object)
|
||||
*
|
||||
* Return value:
|
||||
* Can the unit drop the object? (Bool)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
if !([_unit, _target, ["isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
_unit getVariable [QGVAR(carriedObject), objNull] == _target
|
80
addons/dragging/functions/fnc_carryObject.sqf
Normal file
80
addons/dragging/functions/fnc_carryObject.sqf
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Carry an object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the carrying (Object)
|
||||
* 1: Object to carry (Object)
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
// check weight
|
||||
private "_weight";
|
||||
_weight = [_target] call FUNC(getWeight);
|
||||
|
||||
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
|
||||
[localize "STR_ACE_Dragging_UnableToDrag"] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
// select no weapon and stop sprinting
|
||||
_unit action ["SwitchWeapon", _unit, _unit, 99];
|
||||
|
||||
[_unit, "isDragging", true] call EFUNC(common,setforceWalkStatus);
|
||||
|
||||
// prevent multiple players from accessing the same object
|
||||
[_unit, _target, true] call EFUNC(common,claim);
|
||||
|
||||
// get attachTo offset and direction.
|
||||
private ["_position", "_direction"];
|
||||
|
||||
_position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]];
|
||||
_direction = _target getVariable [QGVAR(carryDirection), 0];
|
||||
|
||||
// add height offset of model
|
||||
private "_offset";
|
||||
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
|
||||
|
||||
_position = _position vectorAdd [0, 0, _offset];
|
||||
|
||||
// attach object
|
||||
_target attachTo [_unit, _position];
|
||||
_target setDir _direction;
|
||||
|
||||
_unit setVariable [QGVAR(isCarrying), true, true];
|
||||
_unit setVariable [QGVAR(carriedObject), _target, true];
|
||||
|
||||
// add scrollwheel action to release object
|
||||
private "_actionID";
|
||||
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
|
||||
|
||||
if (_actionID != -1) then {
|
||||
_unit removeAction _actionID;
|
||||
};
|
||||
|
||||
_actionID = _unit addAction [
|
||||
format ["<t color='#FF0000'>%1</t>", localize "STR_ACE_Dragging_Drop"],
|
||||
QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)])] call FUNC(dropObject_carry)),
|
||||
nil,
|
||||
20,
|
||||
false,
|
||||
true,
|
||||
"",
|
||||
QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)]))
|
||||
];
|
||||
|
||||
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
|
||||
|
||||
// check everything
|
||||
[FUNC(carryObjectPFH), 0, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// reset current dragging height.
|
||||
GVAR(currentHeightChange) = 0;
|
13
addons/dragging/functions/fnc_carryObjectPFH.sqf
Normal file
13
addons/dragging/functions/fnc_carryObjectPFH.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0 select 0;
|
||||
_target = _this select 0 select 1;
|
||||
|
||||
// drop if the crate is destroyed
|
||||
if !([_target] call EFUNC(common,isAlive)) then {
|
||||
[_unit, _target] call FUNC(dropObject_carry);
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
64
addons/dragging/functions/fnc_dragObject.sqf
Normal file
64
addons/dragging/functions/fnc_dragObject.sqf
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Drag an object. Called from ace_dragging_fnc_startDrag
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the dragging (Object)
|
||||
* 1: Object to drag (Object)
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
// get attachTo offset and direction.
|
||||
private ["_position", "_direction"];
|
||||
|
||||
_position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]];
|
||||
_direction = _target getVariable [QGVAR(dragDirection), 0];
|
||||
|
||||
// add height offset of model
|
||||
private "_offset";
|
||||
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
|
||||
|
||||
_position = _position vectorAdd [0, 0, _offset];
|
||||
|
||||
// attach object
|
||||
_target attachTo [_unit, _position];
|
||||
_target setDir _direction;
|
||||
|
||||
_unit setVariable [QGVAR(isDragging), true, true];
|
||||
_unit setVariable [QGVAR(draggedObject), _target, true];
|
||||
|
||||
// add scrollwheel action to release object
|
||||
private "_actionID";
|
||||
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
|
||||
|
||||
if (_actionID != -1) then {
|
||||
_unit removeAction _actionID;
|
||||
};
|
||||
|
||||
_actionID = _unit addAction [
|
||||
format ["<t color='#FF0000'>%1</t>", localize "STR_ACE_Dragging_Drop"],
|
||||
QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])] call FUNC(dropObject)),
|
||||
nil,
|
||||
20,
|
||||
false,
|
||||
true,
|
||||
"",
|
||||
QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)]))
|
||||
];
|
||||
|
||||
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
|
||||
|
||||
// check everything
|
||||
[FUNC(dragObjectPFH), 0, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// reset current dragging height.
|
||||
GVAR(currentHeightChange) = 0;
|
13
addons/dragging/functions/fnc_dragObjectPFH.sqf
Normal file
13
addons/dragging/functions/fnc_dragObjectPFH.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0 select 0;
|
||||
_target = _this select 0 select 1;
|
||||
|
||||
// drop if the crate is destroyed
|
||||
if !([_target] call EFUNC(common,isAlive)) then {
|
||||
[_unit, _target] call FUNC(dropObject);
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
50
addons/dragging/functions/fnc_dropObject.sqf
Normal file
50
addons/dragging/functions/fnc_dropObject.sqf
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Drop a dragged object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that drags the other object (Object)
|
||||
* 1: Dragged object to drop (Object)
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
// remove scroll wheel action
|
||||
_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]);
|
||||
|
||||
private "_inBuilding";
|
||||
_inBuilding = [_unit] call FUNC(isObjectOnObject);
|
||||
|
||||
// play release animation
|
||||
_unit playAction "released";
|
||||
|
||||
// prevent collision damage
|
||||
["fixCollision", _unit, _unit] call EFUNC(common,targetEvent);
|
||||
["fixCollision", _target, _target] call EFUNC(common,targetEvent);
|
||||
|
||||
// release object
|
||||
detach _target;
|
||||
|
||||
_unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||
|
||||
// prevent object from flipping inside buildings
|
||||
if (_inBuilding) then {
|
||||
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(isDragging), false, true];
|
||||
_unit setVariable [QGVAR(draggedObject), objNull, true];
|
||||
|
||||
// make object accesable for other units
|
||||
[objNull, _target, true] call EFUNC(common,claim);
|
||||
|
||||
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
|
||||
["fixFloating", _target, _target] call EFUNC(common,targetEvent);
|
50
addons/dragging/functions/fnc_dropObject_carry.sqf
Normal file
50
addons/dragging/functions/fnc_dropObject_carry.sqf
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Drop a carried object.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that carries the other object (Object)
|
||||
* 1: Carried object to drop (Object)
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
// remove scroll wheel action
|
||||
_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]);
|
||||
|
||||
private "_inBuilding";
|
||||
_inBuilding = [_unit] call FUNC(isObjectOnObject);
|
||||
|
||||
// prevent collision damage
|
||||
["fixCollision", _unit, _unit] call EFUNC(common,targetEvent);
|
||||
["fixCollision", _target, _target] call EFUNC(common,targetEvent);
|
||||
|
||||
// release object
|
||||
detach _target;
|
||||
|
||||
// reselect weapon and re-enable sprint
|
||||
_unit selectWeapon primaryWeapon _unit;
|
||||
|
||||
[_unit, "isDragging", false] call EFUNC(common,setforceWalkStatus);
|
||||
|
||||
// prevent object from flipping inside buildings
|
||||
if (_inBuilding) then {
|
||||
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(isCarrying), false, true];
|
||||
_unit setVariable [QGVAR(carriedObject), objNull, true];
|
||||
|
||||
// make object accesable for other units
|
||||
[objNull, _target, true] call EFUNC(common,claim);
|
||||
|
||||
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
|
||||
["fixFloating", _target, _target] call EFUNC(common,targetEvent);
|
54
addons/dragging/functions/fnc_getWeight.sqf
Normal file
54
addons/dragging/functions/fnc_getWeight.sqf
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Name: AGM_Drag_fnc_GetWeight
|
||||
|
||||
Author(s):
|
||||
L-H, edited by commy2
|
||||
|
||||
Description:
|
||||
Returns the weight of a crate.
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - Crate to get weight of
|
||||
|
||||
Returns:
|
||||
NUMBER - Weight
|
||||
|
||||
Example:
|
||||
_weight = Crate1 call AGM_Drag_fnc_GetWeight;
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_object";
|
||||
|
||||
_object = _this select 0;
|
||||
|
||||
private ["_totalWeight", "_fnc","_fnc_Extra"];
|
||||
_totalWeight = 0;
|
||||
_fnc_Extra = {
|
||||
private ["_weight", "_items"];
|
||||
_items = _this select 0;
|
||||
_weight = 0;
|
||||
{
|
||||
_weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> (_this select 2) >> "mass") * ((_items select 1) select _foreachIndex));
|
||||
} foreach (_items select 0);
|
||||
|
||||
_weight
|
||||
};
|
||||
_fnc = {
|
||||
private ["_weight", "_items"];
|
||||
_items = _this select 0;
|
||||
_weight = 0;
|
||||
{
|
||||
_weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> "mass") * ((_items select 1) select _foreachIndex));
|
||||
} foreach (_items select 0);
|
||||
|
||||
_weight
|
||||
};
|
||||
_totalWeight = ([getMagazineCargo _object, "CfgMagazines"] call _fnc);
|
||||
_totalWeight = _totalWeight + ([getItemCargo _object, "CfgWeapons", "ItemInfo"] call _fnc_Extra);
|
||||
_totalWeight = _totalWeight + ([getWeaponCargo _object, "CfgWeapons", "WeaponSlotsInfo"] call _fnc_Extra);
|
||||
_totalWeight = _totalWeight + ([getBackpackCargo _object, "CfgVehicles"] call _fnc);
|
||||
|
||||
_totalWeight = _totalWeight * 0.5; // Mass in Arma isn't an exact amount but rather a volume/weight value. This attempts to work around that by making it a usable value. (sort of).
|
||||
|
||||
_totalWeight
|
31
addons/dragging/functions/fnc_handleAnimChanged.sqf
Normal file
31
addons/dragging/functions/fnc_handleAnimChanged.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_anim"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_anim = _this select 1;
|
||||
|
||||
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||
|
||||
// drop dragged object when not in valid animation
|
||||
if !(_anim in DRAG_ANIMATIONS) then {
|
||||
private "_draggedObject";
|
||||
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
[_unit, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
if (_unit getVariable [QGVAR(isCarrying), false]) then {
|
||||
|
||||
// drop carried object when not standing
|
||||
if (stance _unit != "STAND") then {
|
||||
private "_carriedObject";
|
||||
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||
};
|
||||
|
||||
};
|
20
addons/dragging/functions/fnc_handleKilled.sqf
Normal file
20
addons/dragging/functions/fnc_handleKilled.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_unit";
|
||||
|
||||
_unit = _this select 0;
|
||||
|
||||
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||
private "_draggedObject";
|
||||
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
[_unit, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
if (_unit getVariable [QGVAR(isCarrying), false]) then {
|
||||
private "_carriedObject";
|
||||
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||
};
|
17
addons/dragging/functions/fnc_handlePlayerChanged.sqf
Normal file
17
addons/dragging/functions/fnc_handlePlayerChanged.sqf
Normal file
@ -0,0 +1,17 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_newPlayer", "_oldPlayer"];
|
||||
|
||||
_newPlayer = _this select 0;
|
||||
_oldPlayer = _this select 1;
|
||||
|
||||
{
|
||||
if (_x getVariable [QGVAR(isDragging), false]) then {
|
||||
[_x, _x getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
if (_x getVariable [QGVAR(isCarrying), false]) then {
|
||||
[_x, _x getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry);
|
||||
};
|
||||
} forEach [_newPlayer, _oldPlayer];
|
31
addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf
Normal file
31
addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_weapon"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_weapon = _this select 1;
|
||||
|
||||
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||
|
||||
// drop dragged object when selecting a non-primary weapon
|
||||
if (_weapon != primaryWeapon _unit) then {
|
||||
private "_draggedObject";
|
||||
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
[_unit, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
if (_unit getVariable [QGVAR(isCarrying), false]) then {
|
||||
|
||||
// drop carried object when selecting any weapon
|
||||
if (_weapon != "") then {
|
||||
private "_carriedObject";
|
||||
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||
};
|
||||
|
||||
};
|
45
addons/dragging/functions/fnc_handleScrollWheel.sqf
Normal file
45
addons/dragging/functions/fnc_handleScrollWheel.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Author: L-H, commy2
|
||||
*
|
||||
* Handles raising and lowering the dragged weapon to be able to place it on top of objects.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Scroll amount (Number)
|
||||
*
|
||||
* Return value:
|
||||
* Handled or not. (Bool)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// requires modifier key to be hold down
|
||||
if (GETMVAR(ACE_Modifier,0) == 0) exitWith {false};
|
||||
|
||||
private "_unit";
|
||||
_unit = ACE_player;
|
||||
|
||||
// EH is always assigned. Exit and don't overwrite input if not carrying
|
||||
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false};
|
||||
|
||||
private "_scrollAmount";
|
||||
|
||||
_scrollAmount = _this select 0;
|
||||
|
||||
// move carried item 15 cm per scroll interval
|
||||
_scrollAmount = _scrollAmount * 0.15;
|
||||
|
||||
private "_carriedItem";
|
||||
_carriedItem = _unit getVariable [QGVAR(carriedObject),objNull];
|
||||
|
||||
private ["_position", "_maxHeight"];
|
||||
|
||||
_position = getPosATL _carriedItem;
|
||||
_maxHeight = (_unit ModelToWorld [0,0,0]) select 2;
|
||||
|
||||
_position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight];
|
||||
|
||||
// move up/down object and reattach at current position
|
||||
detach _carriedItem;
|
||||
_carriedItem setPosATL _position;
|
||||
_carriedItem attachTo [_unit];
|
||||
|
||||
true
|
37
addons/dragging/functions/fnc_initObject.sqf
Normal file
37
addons/dragging/functions/fnc_initObject.sqf
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Initialize variables for drag or carryable objects. Called from init EH.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Any object (Object)
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_object";
|
||||
|
||||
_object = _this select 0;
|
||||
|
||||
private "_config";
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _object;
|
||||
|
||||
if (getNumber (_config >> QGVAR(canDrag)) == 1) then {
|
||||
private ["_position", "_direction"];
|
||||
|
||||
_position = getArray (_config >> QGVAR(dragPosition));
|
||||
_direction = getNumber (_config >> QGVAR(dragDirection));
|
||||
|
||||
[_object, true, _position, _direction] call FUNC(setDraggable);
|
||||
};
|
||||
|
||||
if (getNumber (_config >> QGVAR(canCarry)) == 1) then {
|
||||
private ["_position", "_direction"];
|
||||
|
||||
_position = getArray (_config >> QGVAR(carryPosition));
|
||||
_direction = getNumber (_config >> QGVAR(carryDirection));
|
||||
|
||||
[_object, true, _position, _direction] call FUNC(setCarryable);
|
||||
};
|
6
addons/dragging/functions/fnc_isObjectOnObject.sqf
Normal file
6
addons/dragging/functions/fnc_isObjectOnObject.sqf
Normal file
@ -0,0 +1,6 @@
|
||||
// by commy2
|
||||
|
||||
private "_object";
|
||||
_object = _this select 0;
|
||||
|
||||
(getPosATL _object select 2) - (getPos _object select 2) > 1E-5
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user