From b665fb3dc2a34e7ab61fa719a3f920276138cb6d Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 13 Apr 2019 17:16:24 +0200 Subject: [PATCH 01/30] add disposable launcher framework --- addons/events/CfgMagazines.hpp | 12 ++++++++++++ addons/events/config.cpp | 1 + 2 files changed, 13 insertions(+) create mode 100644 addons/events/CfgMagazines.hpp diff --git a/addons/events/CfgMagazines.hpp b/addons/events/CfgMagazines.hpp new file mode 100644 index 000000000..739054f95 --- /dev/null +++ b/addons/events/CfgMagazines.hpp @@ -0,0 +1,12 @@ +class CfgMagazines { + class CA_LauncherMagazine; + class CBA_FakeLauncherMagazine: CA_LauncherMagazine { + scope = 1; + displayName = ""; + displayNameShort = "-"; + descriptionShort = ""; + modelSpecial = ""; + count = 0; + allowedSlots[] = {}; + }; +}; diff --git a/addons/events/config.cpp b/addons/events/config.cpp index 8ed11c1ac..8ca79531f 100644 --- a/addons/events/config.cpp +++ b/addons/events/config.cpp @@ -15,6 +15,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgFunctions.hpp" +#include "CfgMagazines.hpp" class RscDisplayChat { onKeyDown = QUOTE(\ From e32c51e21111904d1171f1d3fc3d004fef0bacb9 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 13 Apr 2019 17:49:26 +0200 Subject: [PATCH 02/30] fix and simplify launcher dummy magazine --- addons/events/CfgMagazines.hpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/events/CfgMagazines.hpp b/addons/events/CfgMagazines.hpp index 739054f95..43f857d46 100644 --- a/addons/events/CfgMagazines.hpp +++ b/addons/events/CfgMagazines.hpp @@ -2,10 +2,7 @@ class CfgMagazines { class CA_LauncherMagazine; class CBA_FakeLauncherMagazine: CA_LauncherMagazine { scope = 1; - displayName = ""; - displayNameShort = "-"; - descriptionShort = ""; - modelSpecial = ""; + ammo = "RocketBase"; count = 0; allowedSlots[] = {}; }; From 126be1a5409af8054277daa056918c41aafc575d Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 14 Apr 2019 09:29:55 +0200 Subject: [PATCH 03/30] rename 2doptics to optics --- addons/2doptics/$PBOPREFIX$ | 1 - addons/2doptics/cba_optic_big_pip.p3d | Bin 18066 -> 0 bytes addons/2doptics/cba_optic_small_pip.p3d | Bin 18066 -> 0 bytes addons/2doptics/stringtable.xml | 21 ------------------ addons/optics/$PBOPREFIX$ | 1 + .../CfgCarryHandleTypes.hpp | 0 .../{2doptics => optics}/CfgEventHandlers.hpp | 0 .../{2doptics => optics}/CfgOpticsEffect.hpp | 0 addons/{2doptics => optics}/CfgPIPItems.hpp | 0 addons/{2doptics => optics}/RscInGameUI.hpp | 0 addons/{2doptics => optics}/XEH_PREP.sqf | 0 addons/{2doptics => optics}/XEH_preInit.sqf | 0 addons/{2doptics => optics}/XEH_preStart.sqf | 0 .../cba_optic_big_100.p3d | Bin 3476 -> 3468 bytes .../{2doptics => optics}/cba_optic_big_70.p3d | Bin 3475 -> 3467 bytes .../{2doptics => optics}/cba_optic_big_80.p3d | Bin 3475 -> 3467 bytes .../{2doptics => optics}/cba_optic_big_90.p3d | Bin 3475 -> 3467 bytes addons/optics/cba_optic_big_pip.p3d | Bin 0 -> 17778 bytes .../cba_optic_small_100.p3d | Bin 3431 -> 3423 bytes .../cba_optic_small_70.p3d | Bin 3430 -> 3422 bytes .../cba_optic_small_80.p3d | Bin 3430 -> 3422 bytes .../cba_optic_small_90.p3d | Bin 3430 -> 3422 bytes addons/optics/cba_optic_small_pip.p3d | Bin 0 -> 17778 bytes addons/{2doptics => optics}/config.cpp | 0 .../fnc_animateScriptedOptic.sqf | 4 ++-- .../fnc_animateScriptedOpticRecoil.sqf | 4 ++-- .../fnc_changeCarryHandleOpticClass.sqf | 4 ++-- .../fnc_changePIPOpticClass.sqf | 6 ++--- .../{2doptics => optics}/fnc_currentOptic.sqf | 4 ++-- .../fnc_initDisplayInterrupt.sqf | 0 .../fnc_loadScriptedOptic.sqf | 4 ++-- .../fnc_restartCamera.sqf | 6 ++--- .../fnc_setOpticMagnification.sqf | 4 ++-- .../fnc_setOpticMagnificationHelper.sqf | 4 ++-- ...fnc_setOpticMagnificationHelperZeroing.sqf | 4 ++-- .../fnc_updateOpticInfo.sqf | 4 ++-- addons/{2doptics => optics}/initSettings.sqf | 0 .../{2doptics => optics}/reticles/pip.rvmat | 0 .../reticles/scopeblack.rvmat | 0 .../reticles/scopeblack_big_100_ca.paa | Bin .../reticles/scopeblack_big_70_ca.paa | Bin .../reticles/scopeblack_big_80_ca.paa | Bin .../reticles/scopeblack_big_90_ca.paa | Bin .../reticles/scopeblack_ca.paa | Bin .../reticles/scopeblack_small_100_ca.paa | Bin .../reticles/scopeblack_small_70_ca.paa | Bin .../reticles/scopeblack_small_80_ca.paa | Bin .../reticles/scopeblack_small_90_ca.paa | Bin .../{2doptics => optics}/script_component.hpp | 10 ++++----- addons/optics/stringtable.xml | 21 ++++++++++++++++++ 50 files changed, 51 insertions(+), 51 deletions(-) delete mode 100644 addons/2doptics/$PBOPREFIX$ delete mode 100644 addons/2doptics/cba_optic_big_pip.p3d delete mode 100644 addons/2doptics/cba_optic_small_pip.p3d delete mode 100644 addons/2doptics/stringtable.xml create mode 100644 addons/optics/$PBOPREFIX$ rename addons/{2doptics => optics}/CfgCarryHandleTypes.hpp (100%) rename addons/{2doptics => optics}/CfgEventHandlers.hpp (100%) rename addons/{2doptics => optics}/CfgOpticsEffect.hpp (100%) rename addons/{2doptics => optics}/CfgPIPItems.hpp (100%) rename addons/{2doptics => optics}/RscInGameUI.hpp (100%) rename addons/{2doptics => optics}/XEH_PREP.sqf (100%) rename addons/{2doptics => optics}/XEH_preInit.sqf (100%) rename addons/{2doptics => optics}/XEH_preStart.sqf (100%) rename addons/{2doptics => optics}/cba_optic_big_100.p3d (82%) rename addons/{2doptics => optics}/cba_optic_big_70.p3d (82%) rename addons/{2doptics => optics}/cba_optic_big_80.p3d (82%) rename addons/{2doptics => optics}/cba_optic_big_90.p3d (82%) create mode 100644 addons/optics/cba_optic_big_pip.p3d rename addons/{2doptics => optics}/cba_optic_small_100.p3d (82%) rename addons/{2doptics => optics}/cba_optic_small_70.p3d (82%) rename addons/{2doptics => optics}/cba_optic_small_80.p3d (82%) rename addons/{2doptics => optics}/cba_optic_small_90.p3d (82%) create mode 100644 addons/optics/cba_optic_small_pip.p3d rename addons/{2doptics => optics}/config.cpp (100%) rename addons/{2doptics => optics}/fnc_animateScriptedOptic.sqf (97%) rename addons/{2doptics => optics}/fnc_animateScriptedOpticRecoil.sqf (96%) rename addons/{2doptics => optics}/fnc_changeCarryHandleOpticClass.sqf (95%) rename addons/{2doptics => optics}/fnc_changePIPOpticClass.sqf (97%) rename addons/{2doptics => optics}/fnc_currentOptic.sqf (94%) rename addons/{2doptics => optics}/fnc_initDisplayInterrupt.sqf (100%) rename addons/{2doptics => optics}/fnc_loadScriptedOptic.sqf (94%) rename addons/{2doptics => optics}/fnc_restartCamera.sqf (87%) rename addons/{2doptics => optics}/fnc_setOpticMagnification.sqf (91%) rename addons/{2doptics => optics}/fnc_setOpticMagnificationHelper.sqf (78%) rename addons/{2doptics => optics}/fnc_setOpticMagnificationHelperZeroing.sqf (75%) rename addons/{2doptics => optics}/fnc_updateOpticInfo.sqf (96%) rename addons/{2doptics => optics}/initSettings.sqf (100%) rename addons/{2doptics => optics}/reticles/pip.rvmat (100%) rename addons/{2doptics => optics}/reticles/scopeblack.rvmat (100%) rename addons/{2doptics => optics}/reticles/scopeblack_big_100_ca.paa (100%) rename addons/{2doptics => optics}/reticles/scopeblack_big_70_ca.paa (100%) rename addons/{2doptics => optics}/reticles/scopeblack_big_80_ca.paa (100%) rename addons/{2doptics => optics}/reticles/scopeblack_big_90_ca.paa (100%) rename addons/{2doptics => optics}/reticles/scopeblack_ca.paa (100%) rename addons/{2doptics => optics}/reticles/scopeblack_small_100_ca.paa (100%) rename addons/{2doptics => optics}/reticles/scopeblack_small_70_ca.paa (100%) rename addons/{2doptics => optics}/reticles/scopeblack_small_80_ca.paa (100%) rename addons/{2doptics => optics}/reticles/scopeblack_small_90_ca.paa (100%) rename addons/{2doptics => optics}/script_component.hpp (90%) create mode 100644 addons/optics/stringtable.xml diff --git a/addons/2doptics/$PBOPREFIX$ b/addons/2doptics/$PBOPREFIX$ deleted file mode 100644 index 81feffa7b..000000000 --- a/addons/2doptics/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -x\cba\addons\2doptics diff --git a/addons/2doptics/cba_optic_big_pip.p3d b/addons/2doptics/cba_optic_big_pip.p3d deleted file mode 100644 index c03f9a4597ba966f7d3f674bfe3b237993809db2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18066 zcmeI4dt6mj7RT>}%m;x_v{Xa^QxFW51nx!7xu*ES$M~R0F+(6F5D3t;CQ)mYETeI> z(tKnO^ED~W%qO|`=Dk=J_^Q;8rTHqKX-YLdY8rKZ>&m*E*2zESGo883=i~l-*5|IZ z*V<=)&${QHv-dt5hNcehXEvKmekPM?M6Z5B+vC#&I~5-T>x8PhMW))qx_{(caU?LA z?BT(wwt2zx)WQQd?CVE|*w+3r(8l)pNSAu4rrthbGOIt;*4qcKncP}?dbG=}jX%32 zwQ7y#cyBpUtI9O}B~+(YP3l_DL;kN`D|0g+wI6-1Nfq0rIKE$8fY&~Y{->tb+n<1M zn#Mj3er-IR-zd%T=={Ia^!G~Q88vB1u5-!QD}5+G4<{T{51kKD+3t0+LQVR3k=IVO zOjaLXUG24>9llDrY(3$%8xLOPx~Q?|#!q%@<3B!L;np6{KmMTmh^9YF!Wnny!g?O^ zH`o^HW}ba$zstVZYnS8rfeUNA_Fd@znJy>2b`kiV)z}L7gEjHpaekj`j+cq^Z?EaE zQ$(t5#242T{yuKMI>ff>-b3E&=cM9it6f`veb@tMsiCws(vKkxNI@lD-_z4kmD?|k$6>%)QmnhmYDr(P>c zcsZlqegnK({|TJWH=6czzHKzer+nmS`d_sEgu1P8rNZCO`PMb+_>@U1+ex;?YDP|l z*KV=Dg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S6`7iqVWRPm)P8>i|(i|(!CHr8oVpc#q+x<^gfXB zcz;dLZ>YLrG^1pa%reh9KvWpbDD%`GebT(2_AV^Oc#@volswu`LE}lNx?(h=WRlD> z&pJR<7|kg2L~Cd&g!cD1F`sD$oyKdlzvm7g&1YmDC8InC;OdIed6apQj5H?d3!%MT zP9M#$Q_w#>?`TilX3Y5|lVnDyt{9z1$t0PZgNW`wv_I16qxBwISEg%{_F$%B4N5Xe zW`ydB(Rq|il9|Tj#7X;gAM(-q;{fzeLVJR3SQC{@k{O}8VssuQlVm0!Glcg!>i|(< zG-C_&;Sb?`&BUN(`Xy$H(H0{aN81JrFo%ztoKaNRKWkEUak!}?x*iA_T=zKypM&ab z`Xt+Y-;BH*+U^}2+rzYoDt@JcL;Y&UGKY^SDk#L3^cmr%SvYQ9K~{c2@#KuGg2$+v z|G3al|Gz2b@G)tlvP;5EAKZT9FuWh1uTS28&({ju?B{*w+>ZB|^C#DHJKkT-?KqC> zc`q~j+2;Mjyl}Q+(ymx{35AePL>1Uh${GOcOkIVLKv!CAw^Lt>~o^AH?C%5DGocykl zZRzLtdi*|*ZI0*m?C1Aa{N9S=xt`YARt9cm;8q51W#IoY z1LpAl`B}psPRYs3ruB^*Mf=}Z>LzaNGTq;)k-JIMo34odPFmnLZQ9t*eZIkRB_g`a zV_yr~ueg6)rZj%3-0T0W*9zsU1lM~M|C)beckjYCUE%$mTgZ;ua6oB1ai#Lz#nT?U zZg!rXmz`OXofYo+t66%`noZ_uCD}ze`32K5CS**{Db{+X_(P(l(mS{mo U!hD-2rneCTiY^apCuIKq-vxp&I{*Lx diff --git a/addons/2doptics/cba_optic_small_pip.p3d b/addons/2doptics/cba_optic_small_pip.p3d deleted file mode 100644 index fb66e8d104ec6e1e6e7ef7773f0d16f632279bfa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18066 zcmeI4e^gaf7RMi$q9Uju)+h=BnjjMR19-gTUi<;3q)sYYVTAHjMg&Au%voA4OUN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XwM#&_ZWu6Uys4$yR=4lZ6 zqU09CsB)z*Sd9m^3&&WJVMtKgvH59Y+DDxy4X-w1~LVLTaJv6^gMgR1^qdjpuG3S>|k{O|fVs;)S zlVolSB6|MN{>W+%t@qHnGToE32QwXOP?AY9Bh*mL&ZA_K%rqt^PTH^gxQEss)6hQ& z?Fml7ny6%w%m_6Uv-2pKBr^edL3p3D0T2~tGX|iKCJ^4&ObmLaUt*>heKC`9R7zT! zSNO=u*+qqeawgfQhg(9?^K0Dm{f@lnkZo?yHv4&BAMdSW`*wcbzs7sW*yi@UZ;R`BpBBfn&3=yO zeM!6@iQ~AQo>F>p717 z{GEos&u|>qa~%8mdjx-n;5e@5I9`9}b$9l2JGR-+>&(2qEZeiqeqK-IbyV4&ZT9oJ zA+Hz8_H47C*T?AZf!4)jd$!rn>p*OCd#>j-7xuHw>m0nk!8ZH3J^Oh+&+~Y;+0X6S z&+}HEud>a4ZqI(6pYgnmSc1&q8e!X(}+Ig4VFgv&B*(Vg+bHZK!YL;HKUKX#J#rC4y w{DPU;S=lAI)AgRIx%o4Sf99ZgG@4wHBU;drFyH2h>0QKtV#veRtO;ZP4GTXqdH?_b diff --git a/addons/2doptics/stringtable.xml b/addons/2doptics/stringtable.xml deleted file mode 100644 index 455157c0c..000000000 --- a/addons/2doptics/stringtable.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Community Base Addons - 2D Optics - Community Base Addons - 2D-Optiken - Community Base Addons - Optyka 2D - - - CBA 2D Optics - CBA 2D-Optiken - CBA Optyka 2D - - - Use picture in picture optics - Bild in Bild-Optiken verwenden - Picture in Picture 照準器を使う - Używaj optyki typu Obraz w obrazie (PIP) - - - diff --git a/addons/optics/$PBOPREFIX$ b/addons/optics/$PBOPREFIX$ new file mode 100644 index 000000000..c0ff57ca4 --- /dev/null +++ b/addons/optics/$PBOPREFIX$ @@ -0,0 +1 @@ +x\cba\addons\optics diff --git a/addons/2doptics/CfgCarryHandleTypes.hpp b/addons/optics/CfgCarryHandleTypes.hpp similarity index 100% rename from addons/2doptics/CfgCarryHandleTypes.hpp rename to addons/optics/CfgCarryHandleTypes.hpp diff --git a/addons/2doptics/CfgEventHandlers.hpp b/addons/optics/CfgEventHandlers.hpp similarity index 100% rename from addons/2doptics/CfgEventHandlers.hpp rename to addons/optics/CfgEventHandlers.hpp diff --git a/addons/2doptics/CfgOpticsEffect.hpp b/addons/optics/CfgOpticsEffect.hpp similarity index 100% rename from addons/2doptics/CfgOpticsEffect.hpp rename to addons/optics/CfgOpticsEffect.hpp diff --git a/addons/2doptics/CfgPIPItems.hpp b/addons/optics/CfgPIPItems.hpp similarity index 100% rename from addons/2doptics/CfgPIPItems.hpp rename to addons/optics/CfgPIPItems.hpp diff --git a/addons/2doptics/RscInGameUI.hpp b/addons/optics/RscInGameUI.hpp similarity index 100% rename from addons/2doptics/RscInGameUI.hpp rename to addons/optics/RscInGameUI.hpp diff --git a/addons/2doptics/XEH_PREP.sqf b/addons/optics/XEH_PREP.sqf similarity index 100% rename from addons/2doptics/XEH_PREP.sqf rename to addons/optics/XEH_PREP.sqf diff --git a/addons/2doptics/XEH_preInit.sqf b/addons/optics/XEH_preInit.sqf similarity index 100% rename from addons/2doptics/XEH_preInit.sqf rename to addons/optics/XEH_preInit.sqf diff --git a/addons/2doptics/XEH_preStart.sqf b/addons/optics/XEH_preStart.sqf similarity index 100% rename from addons/2doptics/XEH_preStart.sqf rename to addons/optics/XEH_preStart.sqf diff --git a/addons/2doptics/cba_optic_big_100.p3d b/addons/optics/cba_optic_big_100.p3d similarity index 82% rename from addons/2doptics/cba_optic_big_100.p3d rename to addons/optics/cba_optic_big_100.p3d index af31d7368044d5b61fef1a1d51763ed056c8b0e2..b2700fa4cffb69b9e7dc62f1458ef8131024ead2 100644 GIT binary patch delta 37 mcmbOt-6Or>4)f%LoKl;AF#EHD7?YDZV}P_dSWtwkff)c6-wlue delta 49 ucmeB?o+7>B4l|Qc%H})FnXEv1@*QTy$!VOS5T?}RtDLe>(apkKmCOLBmJlfb diff --git a/addons/2doptics/cba_optic_big_70.p3d b/addons/optics/cba_optic_big_70.p3d similarity index 82% rename from addons/2doptics/cba_optic_big_70.p3d rename to addons/optics/cba_optic_big_70.p3d index bc2a960b59909337aae1faa324205e4ea253b6b9..927ef9de9b97f1b6f3971cb4c5593f1002ce5aab 100644 GIT binary patch delta 37 mcmbO%-7UT04)f%LoKl;AF#EHD7?YDZV}P_7SWuX&ff)c6i4BYZ delta 49 vcmeB{o-DoL4l|Qc%H)rnikts3d$2;;lhZguAxx>sS2<;X%*`J;XE6f+ymJwC diff --git a/addons/2doptics/cba_optic_big_80.p3d b/addons/optics/cba_optic_big_80.p3d similarity index 82% rename from addons/2doptics/cba_optic_big_80.p3d rename to addons/optics/cba_optic_big_80.p3d index fe74097c8e86bd64bec4d89cdd96e649a7df059c..c4584a8d425032c57a9c7441798221b6b88b5b53 100644 GIT binary patch delta 37 mcmbO%-7UT04)f%LoKl;AF#EHD7?YDZV}P_7SWuX&ff)c6i4BYZ delta 49 vcmeB{o-DoL4l|Qc%H)rnikts3d$2;;lhZguAxx>sS2<;X%*`J;XE6f+ymJwC diff --git a/addons/2doptics/cba_optic_big_90.p3d b/addons/optics/cba_optic_big_90.p3d similarity index 82% rename from addons/2doptics/cba_optic_big_90.p3d rename to addons/optics/cba_optic_big_90.p3d index 845d731241f92f7c1d515932596ce8d4a51ab5f3..a236017eadb4cbabfe98ed561cc09ffe87a28405 100644 GIT binary patch delta 37 mcmbO%-7UT04)f%LoKl;AF#EHD7?YDZV}P_7SWuX&ff)c6i4BYZ delta 49 vcmeB{o-DoL4l|Qc%H)rnikts3d$2;;lhZguAxx>sS2<;X%*`J;XE6f+ymJwC diff --git a/addons/optics/cba_optic_big_pip.p3d b/addons/optics/cba_optic_big_pip.p3d new file mode 100644 index 0000000000000000000000000000000000000000..5651705eb3f58efaf4f161299394f899900953a1 GIT binary patch literal 17778 zcmeI4dsNj`7RT>}%m;x_v{Xa^QxFW51nxzCziWywe2fp86f*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L07dOgzAcs`I9`7w>fC&9z*8?UG=d4LVLM%4bu6;RO|;y9?6SP zT`@9$l1K8=T$&i^eCk8>u>UszW0TPNR~z;tC6DAqsIC~9KglC`3C0ZJ^SnAZR2a$E z0{#0#`1~%7ujTnIUW(BcqxeSK1`IHVkD8oOkl#ORQg&gusUwCR2pL@SIRu}BYHa!> z+kD^596KFoj*abMT0|AUQ$bh1TVLkz5e0eqICMQT+%yaQ=HzAN<`quP$jW<+hWW1x zP1FCEVh$gZHY&R)-1On?H@e~T=6qf9`EtHa*k(VUujY1qo|-?op4;(xVs6KAT+ios z+0Qngo8|MeY_p%+OFy3v<#U>Bb9=Vg&*vfeTq4^y^Yi&XK8MFPw`ZIEeBO=Eow0p0 zKcDa7b5?9~dp_U9^?aU*l-HkZv!C0upVwWy-r{(!=Q#FrJ+Ci#p3nBp z{5+rLc`e)Ao^AH?{E_EzY~Re!&mDdqvCZv&^+2Nu&8>1P1Gh48D+9MOa4Q4g2_W0&dvPK`WGqTX^x^moyQwQ1AFcAoPMmMam_C0_el z*nY+H(=w&;%cVa5=e<@aUnjWVr})?X8+&@^zvT|^@7h9k)P@5}@jq1k+sps} literal 0 HcmV?d00001 diff --git a/addons/2doptics/cba_optic_small_100.p3d b/addons/optics/cba_optic_small_100.p3d similarity index 82% rename from addons/2doptics/cba_optic_small_100.p3d rename to addons/optics/cba_optic_small_100.p3d index 8a49f6a54de8a7c3a5a92e328254303efbd39eab..fff3b85438a508187f86735679bf7757abbbd685 100644 GIT binary patch delta 37 mcmaDZbzf@39p=dgIi)uLVD@JPF(xN-#sFzcu%H-MATt0huMPsS2^XOqMJpzyqE#U91x-a diff --git a/addons/2doptics/cba_optic_small_70.p3d b/addons/optics/cba_optic_small_70.p3d similarity index 82% rename from addons/2doptics/cba_optic_small_70.p3d rename to addons/optics/cba_optic_small_70.p3d index 8c66292f97b134e0f07969f2b4ce0c40bfd596ea..01bb06c875f8cb6fca41edb4b78bd7666a0e4866 100644 GIT binary patch delta 37 mcmaDRbx&%;9p=dgIi)uLVD@JPF(xN-#sFyxu%IYcATt0hSq=pN delta 49 ucmca7^-OBR9cCt@l+AaTGg*Q3sS2^XNqMJpyyqE#Ts}P<5 diff --git a/addons/2doptics/cba_optic_small_80.p3d b/addons/optics/cba_optic_small_80.p3d similarity index 82% rename from addons/2doptics/cba_optic_small_80.p3d rename to addons/optics/cba_optic_small_80.p3d index 5bfb11f3c59935c06131cd4f3aa43fac84d483a7..1d51305b8100a7a0fa74d40ee6a1c187e5175d5d 100644 GIT binary patch delta 37 mcmaDRbx&%;9p=dgIi)uLVD@JPF(xN-#sFyxu%IYcATt0hSq=pN delta 49 ucmca7^-OBR9cCt@l+AaTGg*Q3sS2^XNqMJpyyqE#Ts}P<5 diff --git a/addons/2doptics/cba_optic_small_90.p3d b/addons/optics/cba_optic_small_90.p3d similarity index 82% rename from addons/2doptics/cba_optic_small_90.p3d rename to addons/optics/cba_optic_small_90.p3d index 6f952af8b99ab2f5bca08ce634abe19a96271055..7d7232d2d781225cb28b49018afb064795658ad1 100644 GIT binary patch delta 37 mcmaDRbx&%;9p=dgIi)uLVD@JPF(xN-#sFyxu%IYcATt0hSq=pN delta 49 ucmca7^-OBR9cCt@l+AaTGg*Q3sS2^XNqMJpyyqE#Ts}P<5 diff --git a/addons/optics/cba_optic_small_pip.p3d b/addons/optics/cba_optic_small_pip.p3d new file mode 100644 index 0000000000000000000000000000000000000000..e61b06c222011784d21d8f8e4270512aa37cfb02 GIT binary patch literal 17778 zcmeI4e^gaf7RMi$q9Uju)+h=BnjjMR19-gTUi<;3q)sYYVTAHjMg&Au%voA4OUNv_V4~xaqVzG?sJNV&1{92%=;%8`mrlMZqsYxMGA5?BQ?UP9Q z$bi(O#Q}@e{1bKh?K8uZwm<8W#QNp%D)qQsIVzu0nrLz9} zSNo{*2b8+?Gm%Bglv!nN{dBjYs>wQi>83tTz5kqJ#ZG;DStqwT+w1yMH}7-~`*Q;i z*(X|WR&oFHQ2*%i$xhZ^Li>KcR|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s?Z^o{~$eL#|fp?#Er_;8y8)A{p{SHW1m!L&kA+@D^dE;dRRPW7upN5bMt0r sW@Hv+&(vF{XXnl;{Dp!1QE6&kmZ(83VZO~1(|d>k$q @@ -14,7 +14,7 @@ Returns: Examples: (begin example) - player call cba_2doptics_fnc_restartCamera; + player call cba_optics_fnc_restartCamera; (end) Author: diff --git a/addons/2doptics/fnc_setOpticMagnification.sqf b/addons/optics/fnc_setOpticMagnification.sqf similarity index 91% rename from addons/2doptics/fnc_setOpticMagnification.sqf rename to addons/optics/fnc_setOpticMagnification.sqf index 683ebf4fe..13b89c64b 100644 --- a/addons/2doptics/fnc_setOpticMagnification.sqf +++ b/addons/optics/fnc_setOpticMagnification.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* ---------------------------------------------------------------------------- -Function: cba_2doptics_fnc_setOpticMagnification +Function: cba_optics_fnc_setOpticMagnification Description: Set magnification of the current optic of the unit. @@ -14,7 +14,7 @@ Returns: Examples: (begin example) - [player, 3] call cba_2doptics_fnc_setOpticMagnification; + [player, 3] call cba_optics_fnc_setOpticMagnification; (end) Author: diff --git a/addons/2doptics/fnc_setOpticMagnificationHelper.sqf b/addons/optics/fnc_setOpticMagnificationHelper.sqf similarity index 78% rename from addons/2doptics/fnc_setOpticMagnificationHelper.sqf rename to addons/optics/fnc_setOpticMagnificationHelper.sqf index a81367970..906abd63d 100644 --- a/addons/2doptics/fnc_setOpticMagnificationHelper.sqf +++ b/addons/optics/fnc_setOpticMagnificationHelper.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* ---------------------------------------------------------------------------- -Function: cba_2doptics_fnc_setOpticMagnificationHelper +Function: cba_optics_fnc_setOpticMagnificationHelper Description: Helper function used in config to set the magnification of a zooming optic. @@ -13,7 +13,7 @@ Returns: Examples: (begin example) - 2 call (uiNamespace getVariable 'cba_2doptics_fnc_setOpticMagnificationHelper') + 2 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelper') (end) Author: diff --git a/addons/2doptics/fnc_setOpticMagnificationHelperZeroing.sqf b/addons/optics/fnc_setOpticMagnificationHelperZeroing.sqf similarity index 75% rename from addons/2doptics/fnc_setOpticMagnificationHelperZeroing.sqf rename to addons/optics/fnc_setOpticMagnificationHelperZeroing.sqf index 0e048fb49..11eb06013 100644 --- a/addons/2doptics/fnc_setOpticMagnificationHelperZeroing.sqf +++ b/addons/optics/fnc_setOpticMagnificationHelperZeroing.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* ---------------------------------------------------------------------------- -Function: cba_2doptics_fnc_setOpticMagnificationHelperZeroing +Function: cba_optics_fnc_setOpticMagnificationHelperZeroing Description: Helper function used in config to remember the zeroing of a zooming optic. @@ -13,7 +13,7 @@ Returns: Examples: (begin example) - 2 call (uiNamespace getVariable 'cba_2doptics_fnc_setOpticMagnificationHelperZeroing') + 2 call (uiNamespace getVariable 'cba_optics_fnc_setOpticMagnificationHelperZeroing') (end) Author: diff --git a/addons/2doptics/fnc_updateOpticInfo.sqf b/addons/optics/fnc_updateOpticInfo.sqf similarity index 96% rename from addons/2doptics/fnc_updateOpticInfo.sqf rename to addons/optics/fnc_updateOpticInfo.sqf index 457c8d17e..c353044c1 100644 --- a/addons/2doptics/fnc_updateOpticInfo.sqf +++ b/addons/optics/fnc_updateOpticInfo.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* ---------------------------------------------------------------------------- -Internal Function: cba_2doptics_fnc_updateOpticInfo +Internal Function: cba_optics_fnc_updateOpticInfo Description: Caches the current optic's parameters in mission namespace variables. @@ -13,7 +13,7 @@ Returns: Examples: (begin example) - player call cba_2doptics_fnc_updateOpticInfo; + player call cba_optics_fnc_updateOpticInfo; (end) Author: diff --git a/addons/2doptics/initSettings.sqf b/addons/optics/initSettings.sqf similarity index 100% rename from addons/2doptics/initSettings.sqf rename to addons/optics/initSettings.sqf diff --git a/addons/2doptics/reticles/pip.rvmat b/addons/optics/reticles/pip.rvmat similarity index 100% rename from addons/2doptics/reticles/pip.rvmat rename to addons/optics/reticles/pip.rvmat diff --git a/addons/2doptics/reticles/scopeblack.rvmat b/addons/optics/reticles/scopeblack.rvmat similarity index 100% rename from addons/2doptics/reticles/scopeblack.rvmat rename to addons/optics/reticles/scopeblack.rvmat diff --git a/addons/2doptics/reticles/scopeblack_big_100_ca.paa b/addons/optics/reticles/scopeblack_big_100_ca.paa similarity index 100% rename from addons/2doptics/reticles/scopeblack_big_100_ca.paa rename to addons/optics/reticles/scopeblack_big_100_ca.paa diff --git a/addons/2doptics/reticles/scopeblack_big_70_ca.paa b/addons/optics/reticles/scopeblack_big_70_ca.paa similarity index 100% rename from addons/2doptics/reticles/scopeblack_big_70_ca.paa rename to addons/optics/reticles/scopeblack_big_70_ca.paa diff --git a/addons/2doptics/reticles/scopeblack_big_80_ca.paa b/addons/optics/reticles/scopeblack_big_80_ca.paa similarity index 100% rename from addons/2doptics/reticles/scopeblack_big_80_ca.paa rename to addons/optics/reticles/scopeblack_big_80_ca.paa diff --git a/addons/2doptics/reticles/scopeblack_big_90_ca.paa b/addons/optics/reticles/scopeblack_big_90_ca.paa similarity index 100% rename from addons/2doptics/reticles/scopeblack_big_90_ca.paa rename to addons/optics/reticles/scopeblack_big_90_ca.paa diff --git a/addons/2doptics/reticles/scopeblack_ca.paa b/addons/optics/reticles/scopeblack_ca.paa similarity index 100% rename from addons/2doptics/reticles/scopeblack_ca.paa rename to addons/optics/reticles/scopeblack_ca.paa diff --git a/addons/2doptics/reticles/scopeblack_small_100_ca.paa b/addons/optics/reticles/scopeblack_small_100_ca.paa similarity index 100% rename from addons/2doptics/reticles/scopeblack_small_100_ca.paa rename to addons/optics/reticles/scopeblack_small_100_ca.paa diff --git a/addons/2doptics/reticles/scopeblack_small_70_ca.paa b/addons/optics/reticles/scopeblack_small_70_ca.paa similarity index 100% rename from addons/2doptics/reticles/scopeblack_small_70_ca.paa rename to addons/optics/reticles/scopeblack_small_70_ca.paa diff --git a/addons/2doptics/reticles/scopeblack_small_80_ca.paa b/addons/optics/reticles/scopeblack_small_80_ca.paa similarity index 100% rename from addons/2doptics/reticles/scopeblack_small_80_ca.paa rename to addons/optics/reticles/scopeblack_small_80_ca.paa diff --git a/addons/2doptics/reticles/scopeblack_small_90_ca.paa b/addons/optics/reticles/scopeblack_small_90_ca.paa similarity index 100% rename from addons/2doptics/reticles/scopeblack_small_90_ca.paa rename to addons/optics/reticles/scopeblack_small_90_ca.paa diff --git a/addons/2doptics/script_component.hpp b/addons/optics/script_component.hpp similarity index 90% rename from addons/2doptics/script_component.hpp rename to addons/optics/script_component.hpp index daeb716d4..802200bea 100644 --- a/addons/2doptics/script_component.hpp +++ b/addons/optics/script_component.hpp @@ -1,16 +1,16 @@ -#define COMPONENT 2doptics +#define COMPONENT optics #include "\x\cba\addons\main\script_mod.hpp" //#define DEBUG_MODE_FULL //#define DISABLE_COMPILE_CACHE -//#define DEBUG_ENABLED_2DOPTICS +//#define DEBUG_ENABLED_OPTICS -#ifdef DEBUG_ENABLED_2DOPTICS +#ifdef DEBUG_ENABLED_OPTICS #define DEBUG_MODE_FULL #endif -#ifdef DEBUG_SETTINGS_2DOPTICS - #define DEBUG_SETTINGS DEBUG_SETTINGS_2DOPTICS +#ifdef DEBUG_SETTINGS_OPTICS + #define DEBUG_SETTINGS DEBUG_SETTINGS_OPTICS #endif #define DEBUG_MODE_NORMAL diff --git a/addons/optics/stringtable.xml b/addons/optics/stringtable.xml new file mode 100644 index 000000000..5a06bd978 --- /dev/null +++ b/addons/optics/stringtable.xml @@ -0,0 +1,21 @@ + + + + + Community Base Addons - Optics + Community Base Addons - Optiken + Community Base Addons - Optyka + + + CBA Optics + CBA Optiken + CBA Optyka + + + Use picture in picture optics + Bild in Bild-Optiken verwenden + Picture in Picture 照準器を使う + Używaj optyki typu Obraz w obrazie (PIP) + + + From f162b2cd8e5637ef2a6fab9204340a977b414794 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 14 Apr 2019 09:33:07 +0200 Subject: [PATCH 04/30] rename 2doptics to optics --- addons/main/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/config.cpp b/addons/main/config.cpp index f7957bf3d..cd8dee9f3 100644 --- a/addons/main/config.cpp +++ b/addons/main/config.cpp @@ -32,7 +32,7 @@ class CfgPatches { "cba_jam", "cba_ui", "cba_versioning", - "cba_2doptics" + "cba_optics" }; versionDesc = "C.B.A."; VERSION_CONFIG; From eec0682e7c7edd7f1d822fc8a78c602e1bf248d7 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 14 Apr 2019 13:03:40 +0200 Subject: [PATCH 05/30] add disposable component --- addons/disposable/$PBOPREFIX$ | 1 + addons/disposable/CfgDisposableLaunchers.hpp | 1 + addons/disposable/CfgEventHandlers.hpp | 17 ++++++ addons/disposable/CfgFunctions.hpp | 7 +++ .../{events => disposable}/CfgMagazines.hpp | 0 addons/disposable/XEH_preInit.sqf | 52 ++++++++++++++++++ addons/disposable/XEH_preStart.sqf | 5 ++ addons/disposable/config.cpp | 19 +++++++ addons/disposable/fnc_firedDisposable.sqf | 54 +++++++++++++++++++ .../disposable/fnc_initDisplayInventory.sqf | 3 ++ addons/disposable/script_component.hpp | 18 +++++++ addons/disposable/stringtable.xml | 9 ++++ addons/events/config.cpp | 1 - addons/main/config.cpp | 3 +- 14 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 addons/disposable/$PBOPREFIX$ create mode 100644 addons/disposable/CfgDisposableLaunchers.hpp create mode 100644 addons/disposable/CfgEventHandlers.hpp create mode 100644 addons/disposable/CfgFunctions.hpp rename addons/{events => disposable}/CfgMagazines.hpp (100%) create mode 100644 addons/disposable/XEH_preInit.sqf create mode 100644 addons/disposable/XEH_preStart.sqf create mode 100644 addons/disposable/config.cpp create mode 100644 addons/disposable/fnc_firedDisposable.sqf create mode 100644 addons/disposable/fnc_initDisplayInventory.sqf create mode 100644 addons/disposable/script_component.hpp create mode 100644 addons/disposable/stringtable.xml diff --git a/addons/disposable/$PBOPREFIX$ b/addons/disposable/$PBOPREFIX$ new file mode 100644 index 000000000..6f08bf7e7 --- /dev/null +++ b/addons/disposable/$PBOPREFIX$ @@ -0,0 +1 @@ +x\cba\addons\disposable diff --git a/addons/disposable/CfgDisposableLaunchers.hpp b/addons/disposable/CfgDisposableLaunchers.hpp new file mode 100644 index 000000000..d34997af2 --- /dev/null +++ b/addons/disposable/CfgDisposableLaunchers.hpp @@ -0,0 +1 @@ +class CBA_DisposableLaunchers {}; diff --git a/addons/disposable/CfgEventHandlers.hpp b/addons/disposable/CfgEventHandlers.hpp new file mode 100644 index 000000000..065090d47 --- /dev/null +++ b/addons/disposable/CfgEventHandlers.hpp @@ -0,0 +1,17 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_DisplayLoad_EventHandlers { + class RscDisplayInventory { + ADDON = QUOTE(_this call (uiNamespace getVariable 'FUNC(initDisplayInventory)')); + }; +}; diff --git a/addons/disposable/CfgFunctions.hpp b/addons/disposable/CfgFunctions.hpp new file mode 100644 index 000000000..e8b842eda --- /dev/null +++ b/addons/disposable/CfgFunctions.hpp @@ -0,0 +1,7 @@ +class CfgFunctions { + class CBA { + class Weapons { + PATHTO_FNC(firedDisposable); + }; + }; +}; diff --git a/addons/events/CfgMagazines.hpp b/addons/disposable/CfgMagazines.hpp similarity index 100% rename from addons/events/CfgMagazines.hpp rename to addons/disposable/CfgMagazines.hpp diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf new file mode 100644 index 000000000..1fa2855f8 --- /dev/null +++ b/addons/disposable/XEH_preInit.sqf @@ -0,0 +1,52 @@ +#include "script_component.hpp" + +if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {}; + +ADDON = false; + +private _fnc_update = { + params ["_unit"]; + if (!local _unit) exitWith {}; + (BWA3_normalLaunchers getVariable secondaryWeapon _unit) params ["_launcher", "_magazine"]; + + if (!isNil "_launcher") then { + private _items = secondaryWeaponItems _unit; + _unit addWeapon _launcher; + _unit addWeaponItem [_launcher, _magazine]; + {_unit addSecondaryWeaponItem _x} forEach _items; + }; +}; + +["loadout", _fnc_update] call CBA_fnc_addPlayerEventHandler; +["CAManBase", "InitPost", _fnc_update] call CBA_fnc_addClassEventHandler; + +private _fnc_arsenalOpened = {isNil { + private _unit = call CBA_fnc_currentUnit; + private _launcher = BWA3_loadedLaunchers getVariable secondaryWeapon _unit; + + if (!isNil "_launcher") then { + private _items = secondaryWeaponItems _unit; + _unit addWeapon _launcher; + {_unit addSecondaryWeaponItem _x} forEach _items; + }; +}}; + +[missionNamespace, "arsenalOpened", _fnc_arsenalOpened] call BIS_fnc_addScriptedEventHandler; +["ace_arsenal_displayOpened", _fnc_arsenalOpened] call CBA_fnc_addEventHandler; + +BWA3_normalLaunchers = [] call CBA_fnc_createNamespace; +BWA3_loadedLaunchers = [] call CBA_fnc_createNamespace; + +{ + private _launcher = configName _x; + private _magazine = getArray (configFile >> "CfgWeapons" >> _launcher >> "magazines") select 0; + private _loadedLauncher = getText _x; + + BWA3_loadedLaunchers setVariable [_launcher, _loadedLauncher]; + + if (isNil {BWA3_normalLaunchers getVariable _loadedLauncher}) then { + BWA3_normalLaunchers setVariable [_loadedLauncher, [_launcher, _magazine]]; + }; +} forEach configProperties [configFile >> "BWA3_CfgLoadedLaunchers"]; + +ADDON = true; diff --git a/addons/disposable/XEH_preStart.sqf b/addons/disposable/XEH_preStart.sqf new file mode 100644 index 000000000..3564c51ff --- /dev/null +++ b/addons/disposable/XEH_preStart.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +PREP(initDisplayInventory); diff --git a/addons/disposable/config.cpp b/addons/disposable/config.cpp new file mode 100644 index 000000000..ef5115852 --- /dev/null +++ b/addons/disposable/config.cpp @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + author = "$STR_CBA_Author"; + name = CSTRING(component); + url = "$STR_CBA_URL"; + units[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"cba_common"}; + version = VERSION; + authors[] = {"commy2"}; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgFunctions.hpp" +#include "CfgDisposableLaunchers.hpp" +#include "CfgMagazines.hpp" diff --git a/addons/disposable/fnc_firedDisposable.sqf b/addons/disposable/fnc_firedDisposable.sqf new file mode 100644 index 000000000..f2ab49c5e --- /dev/null +++ b/addons/disposable/fnc_firedDisposable.sqf @@ -0,0 +1,54 @@ +#include "script_component.hpp" +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_firedDisposable + +Description: + Handles firing a disposable weapon. + +Parameters: + _unit - Unit that fired the disposable weapon + _weapon - Disposable weapon + _muzzle - Muzzle fired by the disposable weapon + _mode - Current weapon mode of the disposable weapon + _ammo - Ammo fired by the disposable weapon + _magazine - Current magazine of the disposable weapon + _projectile - Fired projectile + _unit - Always same as element 0 + +Returns: + Nothing. + +Examples: + (begin example) + class EventHandlers { + fired = "_this call CBA_fnc_firedDisposable"; + }; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ + +params ["_unit", "_weapon", "_muzzle"]; + +systemChat str [_unit, _weapon]; + +/* +[{ + params ["_params", "_usedLauncher"]; + _params params ["_unit", "_launcher"]; + + if (!local _unit) exitWith {}; + + private _launcherItems = secondaryWeaponItems _unit select {_x != ""}; + + _unit removeWeapon _launcher; + _unit addWeapon _usedLauncher; + + { + _unit addSecondaryWeaponItem _x; + } forEach _launcherItems; + + _unit selectWeapon _usedLauncher; +}, _this, 1] call CBA_fnc_waitAndExecute; +*/ diff --git a/addons/disposable/fnc_initDisplayInventory.sqf b/addons/disposable/fnc_initDisplayInventory.sqf new file mode 100644 index 000000000..104d3be16 --- /dev/null +++ b/addons/disposable/fnc_initDisplayInventory.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +params ["_display"]; diff --git a/addons/disposable/script_component.hpp b/addons/disposable/script_component.hpp new file mode 100644 index 000000000..4b4250eaf --- /dev/null +++ b/addons/disposable/script_component.hpp @@ -0,0 +1,18 @@ +#define COMPONENT disposable +#include "\x\cba\addons\main\script_mod.hpp" + +//#define DEBUG_MODE_FULL +//#define DISABLE_COMPILE_CACHE +//#define DEBUG_ENABLED_DISPOSABLE + +#ifdef DEBUG_ENABLED_DISPOSABLE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_DISPOSABLE + #define DEBUG_SETTINGS DEBUG_SETTINGS_DISPOSABLE +#endif + +#define DEBUG_MODE_NORMAL +#define DEBUG_SYNCHRONOUS +#include "\x\cba\addons\main\script_macros.hpp" diff --git a/addons/disposable/stringtable.xml b/addons/disposable/stringtable.xml new file mode 100644 index 000000000..b1007cd04 --- /dev/null +++ b/addons/disposable/stringtable.xml @@ -0,0 +1,9 @@ + + + + + Community Base Addons - Disposable Weapons + Community Base Addons - Einwegwaffen + + + diff --git a/addons/events/config.cpp b/addons/events/config.cpp index 8ca79531f..8ed11c1ac 100644 --- a/addons/events/config.cpp +++ b/addons/events/config.cpp @@ -15,7 +15,6 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgFunctions.hpp" -#include "CfgMagazines.hpp" class RscDisplayChat { onKeyDown = QUOTE(\ diff --git a/addons/main/config.cpp b/addons/main/config.cpp index cd8dee9f3..a43dfa85a 100644 --- a/addons/main/config.cpp +++ b/addons/main/config.cpp @@ -32,7 +32,8 @@ class CfgPatches { "cba_jam", "cba_ui", "cba_versioning", - "cba_optics" + "cba_optics", + "cba_disposable" }; versionDesc = "C.B.A."; VERSION_CONFIG; From f6ba624dc2b0b23a3d6964731bed3ebce7416cdf Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 19 Apr 2019 14:27:58 +0200 Subject: [PATCH 06/30] disposable arsenal handling --- addons/disposable/XEH_preInit.sqf | 64 +++++++++++++++++++++---------- addons/disposable/config.cpp | 3 +- addons/optics/XEH_preInit.sqf | 4 +- addons/optics/config.cpp | 2 +- 4 files changed, 49 insertions(+), 24 deletions(-) diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 1fa2855f8..1b0387624 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -1,52 +1,76 @@ #include "script_component.hpp" -if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {}; - ADDON = false; +if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {}; + private _fnc_update = { params ["_unit"]; if (!local _unit) exitWith {}; - (BWA3_normalLaunchers getVariable secondaryWeapon _unit) params ["_launcher", "_magazine"]; + (GVAR(NormalLaunchers) getVariable secondaryWeapon _unit) params ["_launcher", "_magazine"]; if (!isNil "_launcher") then { - private _items = secondaryWeaponItems _unit; + private _launcherItems = secondaryWeaponItems _unit; + private _launcherMagazines = [_magazine] + (secondaryWeaponMagazine _unit select [1, 1e7]); + _unit addWeapon _launcher; - _unit addWeaponItem [_launcher, _magazine]; - {_unit addSecondaryWeaponItem _x} forEach _items; + { + _unit addSecondaryWeaponItem _x; + } forEach _launcherItems; + + { + _unit addWeaponItem [_launcher, _x]; + } forEach _launcherMagazines; }; }; ["loadout", _fnc_update] call CBA_fnc_addPlayerEventHandler; ["CAManBase", "InitPost", _fnc_update] call CBA_fnc_addClassEventHandler; +["CAManBase", "Take", _fnc_update] call CBA_fnc_addClassEventHandler; -private _fnc_arsenalOpened = {isNil { +// Arsenal +[QGVAR(arsenalOpened), { private _unit = call CBA_fnc_currentUnit; - private _launcher = BWA3_loadedLaunchers getVariable secondaryWeapon _unit; + private _launcher = GVAR(LoadedLaunchers) getVariable secondaryWeapon _unit; if (!isNil "_launcher") then { - private _items = secondaryWeaponItems _unit; + private _launcherItems = secondaryWeaponItems _unit; + private _launcherMagazines = secondaryWeaponMagazine _unit select [1, 1e7]; + _unit addWeapon _launcher; - {_unit addSecondaryWeaponItem _x} forEach _items; + { + _unit addSecondaryWeaponItem _x; + } forEach _launcherItems; + + { + _unit addWeaponItem [_launcher, _x]; + } forEach _launcherMagazines; + }; +}] call CBA_fnc_addEventHandler; + +[missionNamespace, "arsenalOpened", { + isNil { + QGVAR(arsenalOpened) call CBA_fnc_localEvent; }; -}}; +}] call BIS_fnc_addScriptedEventHandler; -[missionNamespace, "arsenalOpened", _fnc_arsenalOpened] call BIS_fnc_addScriptedEventHandler; -["ace_arsenal_displayOpened", _fnc_arsenalOpened] call CBA_fnc_addEventHandler; +//["ace_arsenal_displayOpened", _fnc_arsenalOpened] call CBA_fnc_addEventHandler; -BWA3_normalLaunchers = [] call CBA_fnc_createNamespace; -BWA3_loadedLaunchers = [] call CBA_fnc_createNamespace; +GVAR(NormalLaunchers) = [] call CBA_fnc_createNamespace; +GVAR(LoadedLaunchers) = [] call CBA_fnc_createNamespace; +GVAR(UsedLaunchers) = [] call CBA_fnc_createNamespace; { private _launcher = configName _x; private _magazine = getArray (configFile >> "CfgWeapons" >> _launcher >> "magazines") select 0; - private _loadedLauncher = getText _x; + getArray _x params ["_loadedLauncher", "_usedLauncher"]; - BWA3_loadedLaunchers setVariable [_launcher, _loadedLauncher]; + GVAR(LoadedLaunchers) setVariable [_launcher, _loadedLauncher]; + GVAR(UsedLaunchers) setVariable [_launcher, _usedLauncher]; - if (isNil {BWA3_normalLaunchers getVariable _loadedLauncher}) then { - BWA3_normalLaunchers setVariable [_loadedLauncher, [_launcher, _magazine]]; + if (isNil {GVAR(NormalLaunchers) getVariable _loadedLauncher}) then { + GVAR(NormalLaunchers) setVariable [_loadedLauncher, [_launcher, _magazine]]; }; -} forEach configProperties [configFile >> "BWA3_CfgLoadedLaunchers"]; +} forEach configProperties [configFile >> "CBA_DisposableLaunchers", "isArray _x"]; ADDON = true; diff --git a/addons/disposable/config.cpp b/addons/disposable/config.cpp index ef5115852..de951ffe2 100644 --- a/addons/disposable/config.cpp +++ b/addons/disposable/config.cpp @@ -6,8 +6,9 @@ class CfgPatches { name = CSTRING(component); url = "$STR_CBA_URL"; units[] = {}; + weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"cba_common"}; + requiredAddons[] = {"cba_common","cba_events"}; version = VERSION; authors[] = {"commy2"}; }; diff --git a/addons/optics/XEH_preInit.sqf b/addons/optics/XEH_preInit.sqf index f91013751..a90002115 100644 --- a/addons/optics/XEH_preInit.sqf +++ b/addons/optics/XEH_preInit.sqf @@ -1,13 +1,13 @@ #include "script_component.hpp" +ADDON = false; + #include "initSettings.sqf" if (!hasInterface) exitWith {}; if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo []) exitWith {}; if (configProperties [configFile >> "CBA_CarryHandleTypes"] isEqualTo []) exitWith {}; -ADDON = false; - #include "XEH_PREP.sqf" QGVAR(pauseOpticLayer) cutText ["", "PLAIN"]; diff --git a/addons/optics/config.cpp b/addons/optics/config.cpp index cf90c6170..e4ac057a4 100644 --- a/addons/optics/config.cpp +++ b/addons/optics/config.cpp @@ -8,7 +8,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"cba_common","cba_jr"}; + requiredAddons[] = {"cba_common","cba_events","cba_jr"}; version = VERSION; authors[] = {"commy2"}; }; From 09fee918604d61d3db37e1888820810a309512af Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 19 Apr 2019 15:14:51 +0200 Subject: [PATCH 07/30] fix a bug --- addons/disposable/XEH_preInit.sqf | 2 -- addons/optics/fnc_restartCamera.sqf | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 1b0387624..48c0f5cbb 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -54,8 +54,6 @@ private _fnc_update = { }; }] call BIS_fnc_addScriptedEventHandler; -//["ace_arsenal_displayOpened", _fnc_arsenalOpened] call CBA_fnc_addEventHandler; - GVAR(NormalLaunchers) = [] call CBA_fnc_createNamespace; GVAR(LoadedLaunchers) = [] call CBA_fnc_createNamespace; GVAR(UsedLaunchers) = [] call CBA_fnc_createNamespace; diff --git a/addons/optics/fnc_restartCamera.sqf b/addons/optics/fnc_restartCamera.sqf index eacf32981..53becf7fb 100644 --- a/addons/optics/fnc_restartCamera.sqf +++ b/addons/optics/fnc_restartCamera.sqf @@ -23,6 +23,7 @@ Author: if (!GVAR(usePipOptics)) exitWith {}; if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo []) exitWith {}; +if (isNull (uiNamespace getVariable ["RscDisplayMission", displayNull])) exitWith {}; params ["_unit", ["_reset", true]]; From a0144e26287b2435db8bd0f681997bcbe83bd8e8 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 19 Apr 2019 18:12:47 +0200 Subject: [PATCH 08/30] replace with used launcher script --- addons/disposable/XEH_preInit.sqf | 4 ++-- addons/disposable/fnc_firedDisposable.sqf | 28 ++++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 48c0f5cbb..40c70aa79 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -29,7 +29,7 @@ private _fnc_update = { ["CAManBase", "Take", _fnc_update] call CBA_fnc_addClassEventHandler; // Arsenal -[QGVAR(arsenalOpened), { +/*[QGVAR(arsenalOpened), { private _unit = call CBA_fnc_currentUnit; private _launcher = GVAR(LoadedLaunchers) getVariable secondaryWeapon _unit; @@ -52,7 +52,7 @@ private _fnc_update = { isNil { QGVAR(arsenalOpened) call CBA_fnc_localEvent; }; -}] call BIS_fnc_addScriptedEventHandler; +}] call BIS_fnc_addScriptedEventHandler;*/ GVAR(NormalLaunchers) = [] call CBA_fnc_createNamespace; GVAR(LoadedLaunchers) = [] call CBA_fnc_createNamespace; diff --git a/addons/disposable/fnc_firedDisposable.sqf b/addons/disposable/fnc_firedDisposable.sqf index f2ab49c5e..8e79920bd 100644 --- a/addons/disposable/fnc_firedDisposable.sqf +++ b/addons/disposable/fnc_firedDisposable.sqf @@ -31,24 +31,30 @@ Author: params ["_unit", "_weapon", "_muzzle"]; -systemChat str [_unit, _weapon]; +private _usedLauncher = GVAR(UsedLaunchers) getVariable _weapon; +if (isNil "_usedLauncher") exitWith {}; -/* [{ - params ["_params", "_usedLauncher"]; - _params params ["_unit", "_launcher"]; - + params ["_unit", "_launcher", "_usedLauncher"]; if (!local _unit) exitWith {}; - private _launcherItems = secondaryWeaponItems _unit select {_x != ""}; + private _isSelected = currentWeapon _unit == _launcher; - _unit removeWeapon _launcher; - _unit addWeapon _usedLauncher; + private _launcherItems = secondaryWeaponItems _unit; + private _launcherMagazines = secondaryWeaponMagazine _unit; + _unit addWeapon _usedLauncher; { _unit addSecondaryWeaponItem _x; } forEach _launcherItems; - _unit selectWeapon _usedLauncher; -}, _this, 1] call CBA_fnc_waitAndExecute; -*/ + { + _unit addWeaponItem [_usedLauncher, _x]; + } forEach _launcherMagazines; + + if (_isSelected) then { + _unit selectWeapon _usedLauncher; + }; +}, [_unit, _weapon, _usedLauncher], 1] call CBA_fnc_waitAndExecute; + +// @todo drop From 1971152cbf6abb2bc120f724808073adcfcb215c Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 19 Apr 2019 19:53:12 +0200 Subject: [PATCH 09/30] auto drop launcher --- addons/disposable/fnc_firedDisposable.sqf | 79 +++++++++++++++++------ 1 file changed, 60 insertions(+), 19 deletions(-) diff --git a/addons/disposable/fnc_firedDisposable.sqf b/addons/disposable/fnc_firedDisposable.sqf index 8e79920bd..8b68b9690 100644 --- a/addons/disposable/fnc_firedDisposable.sqf +++ b/addons/disposable/fnc_firedDisposable.sqf @@ -7,7 +7,7 @@ Description: Parameters: _unit - Unit that fired the disposable weapon - _weapon - Disposable weapon + _launcher - Disposable weapon _muzzle - Muzzle fired by the disposable weapon _mode - Current weapon mode of the disposable weapon _ammo - Ammo fired by the disposable weapon @@ -29,32 +29,73 @@ Author: commy2 ---------------------------------------------------------------------------- */ -params ["_unit", "_weapon", "_muzzle"]; +params ["_unit", "_launcher", "_muzzle", "", "", "", "_projectile"]; -private _usedLauncher = GVAR(UsedLaunchers) getVariable _weapon; +private _usedLauncher = GVAR(UsedLaunchers) getVariable _launcher; if (isNil "_usedLauncher") exitWith {}; [{ - params ["_unit", "_launcher", "_usedLauncher"]; - if (!local _unit) exitWith {}; + params ["_unit", "_launcher", "_usedLauncher", "_projectile"]; - private _isSelected = currentWeapon _unit == _launcher; + // switch to used tube + if (local _unit) then { + private _isSelected = currentWeapon _unit == _launcher; - private _launcherItems = secondaryWeaponItems _unit; - private _launcherMagazines = secondaryWeaponMagazine _unit; + private _launcherItems = secondaryWeaponItems _unit; + private _launcherMagazines = secondaryWeaponMagazine _unit; - _unit addWeapon _usedLauncher; - { - _unit addSecondaryWeaponItem _x; - } forEach _launcherItems; + _unit addWeapon _usedLauncher; + { + _unit addSecondaryWeaponItem _x; + } forEach _launcherItems; - { - _unit addWeaponItem [_usedLauncher, _x]; - } forEach _launcherMagazines; + { + _unit addWeaponItem [_usedLauncher, _x]; + } forEach _launcherMagazines; - if (_isSelected) then { - _unit selectWeapon _usedLauncher; + if (_isSelected) then { + _unit selectWeapon _usedLauncher; + }; }; -}, [_unit, _weapon, _usedLauncher], 1] call CBA_fnc_waitAndExecute; -// @todo drop + // automatically drop + [{ + params ["_unit", "_usedLauncher", "_projectile"]; + + // quit if dead or weapon is gone + if (!alive _unit || secondaryWeapon _unit != _usedLauncher) exitWith {true}; + + if (local _unit && { + if (_unit == call CBA_fnc_currentUnit) then { + cameraView != "GUNNER" + } else { + isNull _projectile + }; + }) exitWith { + _unit removeWeapon _usedLauncher; + + private _dir = getDir _unit - 180; + + private _container = createVehicle ["WeaponHolderSimulated", [0,0,0], [], 0, "CAN_COLLIDE"]; + _container addWeaponCargoGlobal [_usedLauncher, 1]; + + _container setDir (_dir + 90); + _container setPosASL AGLToASL (_unit modelToWorld (_unit selectionPosition "rightshoulder" vectorAdd [0, 0.2, 0.1])); + _container setVelocity (velocity _unit vectorAdd ([sin _dir, cos _dir, 0] vectorMultiply 1.5)); + + /* + addWeaponWithAttachmentsCargoGlobal [ + _usedLauncher, + _silencer, _pointer, _optic, _bipod, [ + _magazine1, _ammo1, + _magazine2, _ammo2 + ], + 1]; + */ + + true // quit + }; + + false // continue + }, {}, [_unit, _usedLauncher, _projectile]] call CBA_fnc_waitUntilAndExecute; +}, [_unit, _launcher, _usedLauncher, _projectile], 1] call CBA_fnc_waitAndExecute; From 38c49581c8bdc3c1150aec1c3fbea4c8aac09a9e Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 20 Apr 2019 18:17:28 +0200 Subject: [PATCH 10/30] disable secondary weapon magazine slot for disposable launchers --- addons/disposable/fnc_initDisplayInventory.sqf | 11 +++++++++++ addons/disposable/script_component.hpp | 2 ++ 2 files changed, 13 insertions(+) diff --git a/addons/disposable/fnc_initDisplayInventory.sqf b/addons/disposable/fnc_initDisplayInventory.sqf index 104d3be16..2a03f37e7 100644 --- a/addons/disposable/fnc_initDisplayInventory.sqf +++ b/addons/disposable/fnc_initDisplayInventory.sqf @@ -1,3 +1,14 @@ #include "script_component.hpp" params ["_display"]; + +private _fnc_update = { + params ["_display"]; + private _control = _display displayCtrl IDC_FG_SW_MAGAZINE; + + private _unit = call CBA_fnc_currentUnit; + _control ctrlEnable isNil {GVAR(LoadedLaunchers) getVariable secondaryWeapon _unit};systemChat str [_control, ctrlEnabled _control]; +}; + +_display displayAddEventHandler ["MouseMoving", _fnc_update]; +_display displayAddEventHandler ["MouseHolding", _fnc_update]; diff --git a/addons/disposable/script_component.hpp b/addons/disposable/script_component.hpp index 4b4250eaf..045c08e9d 100644 --- a/addons/disposable/script_component.hpp +++ b/addons/disposable/script_component.hpp @@ -16,3 +16,5 @@ #define DEBUG_MODE_NORMAL #define DEBUG_SYNCHRONOUS #include "\x\cba\addons\main\script_macros.hpp" + +#include "\a3\ui_f\hpp\defineResincl.inc" From 3746349b3a4b637eb4ed3b7c9e6a60154ae89042 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 20 Apr 2019 18:18:10 +0200 Subject: [PATCH 11/30] disable secondary weapon magazine slot for disposable launchers --- addons/disposable/fnc_initDisplayInventory.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/disposable/fnc_initDisplayInventory.sqf b/addons/disposable/fnc_initDisplayInventory.sqf index 2a03f37e7..ef8c017aa 100644 --- a/addons/disposable/fnc_initDisplayInventory.sqf +++ b/addons/disposable/fnc_initDisplayInventory.sqf @@ -7,7 +7,7 @@ private _fnc_update = { private _control = _display displayCtrl IDC_FG_SW_MAGAZINE; private _unit = call CBA_fnc_currentUnit; - _control ctrlEnable isNil {GVAR(LoadedLaunchers) getVariable secondaryWeapon _unit};systemChat str [_control, ctrlEnabled _control]; + _control ctrlEnable isNil {GVAR(LoadedLaunchers) getVariable secondaryWeapon _unit}; }; _display displayAddEventHandler ["MouseMoving", _fnc_update]; From 6651dbc17d86d74ae022822a6ea03260250a8230 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 21 Apr 2019 10:50:24 +0200 Subject: [PATCH 12/30] fix a thing, delete unused --- addons/disposable/XEH_preInit.sqf | 26 ------------------------- addons/optics/RscInGameUI.hpp | 2 +- addons/optics/fnc_loadScriptedOptic.sqf | 23 +++++++++++++--------- addons/optics/fnc_updateOpticInfo.sqf | 2 ++ 4 files changed, 17 insertions(+), 36 deletions(-) diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 40c70aa79..758c53789 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -28,32 +28,6 @@ private _fnc_update = { ["CAManBase", "InitPost", _fnc_update] call CBA_fnc_addClassEventHandler; ["CAManBase", "Take", _fnc_update] call CBA_fnc_addClassEventHandler; -// Arsenal -/*[QGVAR(arsenalOpened), { - private _unit = call CBA_fnc_currentUnit; - private _launcher = GVAR(LoadedLaunchers) getVariable secondaryWeapon _unit; - - if (!isNil "_launcher") then { - private _launcherItems = secondaryWeaponItems _unit; - private _launcherMagazines = secondaryWeaponMagazine _unit select [1, 1e7]; - - _unit addWeapon _launcher; - { - _unit addSecondaryWeaponItem _x; - } forEach _launcherItems; - - { - _unit addWeaponItem [_launcher, _x]; - } forEach _launcherMagazines; - }; -}] call CBA_fnc_addEventHandler; - -[missionNamespace, "arsenalOpened", { - isNil { - QGVAR(arsenalOpened) call CBA_fnc_localEvent; - }; -}] call BIS_fnc_addScriptedEventHandler;*/ - GVAR(NormalLaunchers) = [] call CBA_fnc_createNamespace; GVAR(LoadedLaunchers) = [] call CBA_fnc_createNamespace; GVAR(UsedLaunchers) = [] call CBA_fnc_createNamespace; diff --git a/addons/optics/RscInGameUI.hpp b/addons/optics/RscInGameUI.hpp index 1dbafc4c2..54ed3bcd2 100644 --- a/addons/optics/RscInGameUI.hpp +++ b/addons/optics/RscInGameUI.hpp @@ -10,7 +10,7 @@ class RscInGameUI { }; class CBA_ScriptedOptic: RscWeaponZeroing { - onLoad = QUOTE(call FUNC(loadScriptedOptic)); + onLoad = QUOTE([ARR_2(_this select 0, true)] call FUNC(loadScriptedOptic)); controls[] = {"CA_FOVMode","ScopeBlack","Reticle","BodyNight","BodyDay","TrippleHeadLeft","TrippleHeadRight","CA_Zeroing","Magnification","ActiveDisplayHelper"}; // Idea by Taosenai. This control can be used to determine whether the scope or the collimator is used. diff --git a/addons/optics/fnc_loadScriptedOptic.sqf b/addons/optics/fnc_loadScriptedOptic.sqf index 577f7c27b..e45834840 100644 --- a/addons/optics/fnc_loadScriptedOptic.sqf +++ b/addons/optics/fnc_loadScriptedOptic.sqf @@ -20,10 +20,13 @@ Author: commy2 ---------------------------------------------------------------------------- */ -private _unit = call CBA_fnc_currentUnit; -_unit call FUNC(updateOpticInfo); +params [["_display", displayNull], ["_initDisplay", false]]; -params ["_display"]; +if (_initDisplay) then { + private _unit = call CBA_fnc_currentUnit; + + _unit call FUNC(updateOpticInfo); +}; private _ctrlRedDot = _display displayCtrl IDC_RED_DOT; private _ctrlReticle = _display displayCtrl IDC_RETICLE; @@ -69,13 +72,15 @@ _ctrlBodyNight ctrlSetText GVAR(OpticBodyTextureNight); _ctrlBodyNight ctrlSetPosition _bodyPosition; _ctrlBodyNight ctrlCommit 0; -[missionNamespace, "Draw3D", { - if (isNull _thisArgs) exitWith { - removeMissionEventHandler ["Draw3D", _thisId]; - }; +if (_initDisplay) then { + [missionNamespace, "Draw3D", { + if (isNull _thisArgs) exitWith { + removeMissionEventHandler ["Draw3D", _thisId]; + }; - _thisArgs call FUNC(animateScriptedOptic); -}, _display] call CBA_fnc_addBISEventHandler; + _thisArgs call FUNC(animateScriptedOptic); + }, _display] call CBA_fnc_addBISEventHandler; +}; //INFO("Scripted optic weapon info display loaded."); diff --git a/addons/optics/fnc_updateOpticInfo.sqf b/addons/optics/fnc_updateOpticInfo.sqf index c353044c1..1e94d6d46 100644 --- a/addons/optics/fnc_updateOpticInfo.sqf +++ b/addons/optics/fnc_updateOpticInfo.sqf @@ -93,6 +93,8 @@ GVAR(ppEffects) = getArray (_config >> "opticsPPEffects") apply { _ppEffect }; +[uiNamespace getVariable QGVAR(ScriptedOpticDisplay), false] call FUNC(loadScriptedOptic); + //INFO_1("Updated optic info %1.",_optic); nil From eeaf031414552072f58ad21ff45243d5734c4232 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 21 Apr 2019 12:03:38 +0200 Subject: [PATCH 13/30] fix addWeapon leeching magazines --- addons/disposable/XEH_preInit.sqf | 5 +--- addons/disposable/fnc_firedDisposable.sqf | 2 +- addons/disposable/script_component.hpp | 2 ++ addons/optics/fnc_changePIPOpticClass.sqf | 36 +++++++++++------------ addons/optics/script_component.hpp | 20 +++++++++++++ 5 files changed, 42 insertions(+), 23 deletions(-) diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 758c53789..1e9371599 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -11,16 +11,13 @@ private _fnc_update = { if (!isNil "_launcher") then { private _launcherItems = secondaryWeaponItems _unit; - private _launcherMagazines = [_magazine] + (secondaryWeaponMagazine _unit select [1, 1e7]); _unit addWeapon _launcher; { _unit addSecondaryWeaponItem _x; } forEach _launcherItems; - { - _unit addWeaponItem [_launcher, _x]; - } forEach _launcherMagazines; + _unit addWeaponItem [_launcher, _magazine]; }; }; diff --git a/addons/disposable/fnc_firedDisposable.sqf b/addons/disposable/fnc_firedDisposable.sqf index 8b68b9690..e72b5dc27 100644 --- a/addons/disposable/fnc_firedDisposable.sqf +++ b/addons/disposable/fnc_firedDisposable.sqf @@ -42,7 +42,7 @@ if (isNil "_usedLauncher") exitWith {}; private _isSelected = currentWeapon _unit == _launcher; private _launcherItems = secondaryWeaponItems _unit; - private _launcherMagazines = secondaryWeaponMagazine _unit; + private _launcherMagazines = WEAPON_MAGAZINES(_unit,secondaryWeapon _unit); _unit addWeapon _usedLauncher; { diff --git a/addons/disposable/script_component.hpp b/addons/disposable/script_component.hpp index 045c08e9d..ccaca1431 100644 --- a/addons/disposable/script_component.hpp +++ b/addons/disposable/script_component.hpp @@ -18,3 +18,5 @@ #include "\x\cba\addons\main\script_macros.hpp" #include "\a3\ui_f\hpp\defineResincl.inc" + +#define WEAPON_MAGAZINES(unit,weapon) (weaponsItems (unit) select {_x select 0 == (weapon)} param [0, []] select {_x isEqualType []}) diff --git a/addons/optics/fnc_changePIPOpticClass.sqf b/addons/optics/fnc_changePIPOpticClass.sqf index ca08cb4a9..e73d79226 100644 --- a/addons/optics/fnc_changePIPOpticClass.sqf +++ b/addons/optics/fnc_changePIPOpticClass.sqf @@ -26,13 +26,13 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Gun, switch to pip weapon. private _gun = primaryWeapon _unit; private _gunItems = primaryWeaponItems _unit; - private _gunMagazine = primaryWeaponMagazine _unit; + private _gunMagazines = WEAPON_MAGAZINES(_unit,_gun); private _pipGun = GVAR(PIPOptics) getVariable _gun; if (!isNil "_pipGun") then { private _muzzle = currentMuzzle _unit; - _unit addWeapon _pipGun; + ADD_GUN(_unit,_pipGun); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -41,7 +41,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { { _unit addWeaponItem [_pipGun, _x]; - } forEach _gunMagazine; + } forEach _gunMagazines; INFO_2("Switched %1 to %2.",_gun,_pipGun); }; @@ -49,13 +49,13 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Launcher, switch to pip weapon. private _launcher = secondaryWeapon _unit; private _launcherItems = secondaryWeaponItems _unit; - private _launcherMagazine = secondaryWeaponMagazine _unit; + private _launcherMagazines = WEAPON_MAGAZINES(_unit,_launcher); private _pipLauncher = GVAR(PIPOptics) getVariable _launcher; if (!isNil "_pipLauncher") then { private _muzzle = currentMuzzle _unit; - _unit addWeapon _pipLauncher; + ADD_LAUNCHER(_unit,_pipLauncher); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -64,7 +64,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { { _unit addWeaponItem [_pipLauncher, _x]; - } forEach _launcherMagazine; + } forEach _launcherMagazines; INFO_2("Switched %1 to %2.",_launcher,_pipLauncher); }; @@ -72,13 +72,13 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Pistol, switch to pip weapon. private _pistol = handgunWeapon _unit; private _pistolItems = handgunItems _unit; - private _pistolMagazine = handgunMagazine _unit; + private _pistolMagazines = WEAPON_MAGAZINES(_unit,_pistol); private _pipPistol = GVAR(PIPOptics) getVariable _pistol; if (!isNil "_pipPistol") then { private _muzzle = currentMuzzle _unit; - _unit addWeapon _pipPistol; + ADD_PISTOL(_unit,_pipPistol); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -87,7 +87,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { { _unit addWeaponItem [_pipPistol, _x]; - } forEach _pistolMagazine; + } forEach _pistolMagazines; INFO_2("Switched %1 to %2.",_pistol,_pipPistol); }; @@ -107,13 +107,13 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Gun, switch to normal weapon. private _gun = primaryWeapon _unit; private _gunItems = primaryWeaponItems _unit; - private _gunMagazine = primaryWeaponMagazine _unit; + private _gunMagazines = WEAPON_MAGAZINES(_unit,_gun); private _normalGun = GVAR(NonPIPOptics) getVariable _gun; if (!isNil "_normalGun") then { private _muzzle = currentMuzzle _unit; - _unit addWeapon _normalGun; + ADD_GUN(_unit,_normalGun); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -122,7 +122,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { { _unit addWeaponItem [_normalGun, _x]; - } forEach _gunMagazine; + } forEach _gunMagazines; INFO_2("Switched %1 to %2.",_gun,_normalGun); }; @@ -130,13 +130,13 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Launcher, switch to normal weapon. private _launcher = secondaryWeapon _unit; private _launcherItems = secondaryWeaponItems _unit; - private _launcherMagazine = secondaryWeaponMagazine _unit; + private _launcherMagazines = WEAPON_MAGAZINES(_unit,_launcher); private _normalLauncher = GVAR(NonPIPOptics) getVariable _launcher; if (!isNil "_normalLauncher") then { private _muzzle = currentMuzzle _unit; - _unit addWeapon _normalLauncher; + ADD_LAUNCHER(_unit,_normalLauncher); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -145,7 +145,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { { _unit addWeaponItem [_normalLauncher, _x]; - } forEach _launcherMagazine; + } forEach _launcherMagazines; INFO_2("Switched %1 to %2.",_launcher,_normalLauncher); }; @@ -153,13 +153,13 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Pistol, switch to normal weapon. private _pistol = handgunWeapon _unit; private _pistolItems = handgunItems _unit; - private _pistolMagazine = handgunMagazine _unit; + private _pistolMagazines = WEAPON_MAGAZINES(_unit,_pistol); private _normalPistol = GVAR(NonPIPOptics) getVariable _pistol; if (!isNil "_normalPistol") then { private _muzzle = currentMuzzle _unit; - _unit addWeapon _normalPistol; + ADD_PISTOL(_unit,_normalPistol); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -168,7 +168,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { { _unit addWeaponItem [_normalPistol, _x]; - } forEach _pistolMagazine; + } forEach _pistolMagazines; INFO_2("Switched %1 to %2.",_pistol,_normalPistol); }; diff --git a/addons/optics/script_component.hpp b/addons/optics/script_component.hpp index 802200bea..410239fdc 100644 --- a/addons/optics/script_component.hpp +++ b/addons/optics/script_component.hpp @@ -19,6 +19,26 @@ #define PARSE(value) (call compile format ["%1", value]) #define AMBIENT_BRIGHTNESS (sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + moonIntensity / 5 * (1 - overcast) min 1) // idea by Falke +#define WEAPON_MAGAZINES(unit,weapon) (weaponsItems (unit) select {_x select 0 == (weapon)} param [0, []] select {_x isEqualType []}) + +// addWeapon, but without leeching magazines +#define ADD_GUN(unit,gun) (call {\ + private _loadout = getUnitLoadout (unit);\ + _loadout select 0 set [0, gun];\ + (unit) setUnitLoadout _loadout;\ +}) + +#define ADD_LAUNCHER(unit,launcher) (call {\ + private _loadout = getUnitLoadout (unit);\ + _loadout select 1 set [0, launcher];\ + (unit) setUnitLoadout _loadout;\ +}) + +#define ADD_PISTOL(unit,pistol) (call {\ + private _loadout = getUnitLoadout (unit);\ + _loadout select 2 set [0, pistol];\ + (unit) setUnitLoadout _loadout;\ +}) // control ids #define IDC_RETICLE 4000 From 6cd1016533dcdbb893d9a2601154a861b7cdc56f Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 21 Apr 2019 18:35:49 +0200 Subject: [PATCH 14/30] simplify setUnitLoadout --- addons/optics/script_component.hpp | 40 +++++++++++++++++------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/addons/optics/script_component.hpp b/addons/optics/script_component.hpp index 410239fdc..514396fc4 100644 --- a/addons/optics/script_component.hpp +++ b/addons/optics/script_component.hpp @@ -22,23 +22,29 @@ #define WEAPON_MAGAZINES(unit,weapon) (weaponsItems (unit) select {_x select 0 == (weapon)} param [0, []] select {_x isEqualType []}) // addWeapon, but without leeching magazines -#define ADD_GUN(unit,gun) (call {\ - private _loadout = getUnitLoadout (unit);\ - _loadout select 0 set [0, gun];\ - (unit) setUnitLoadout _loadout;\ -}) - -#define ADD_LAUNCHER(unit,launcher) (call {\ - private _loadout = getUnitLoadout (unit);\ - _loadout select 1 set [0, launcher];\ - (unit) setUnitLoadout _loadout;\ -}) - -#define ADD_PISTOL(unit,pistol) (call {\ - private _loadout = getUnitLoadout (unit);\ - _loadout select 2 set [0, pistol];\ - (unit) setUnitLoadout _loadout;\ -}) +#define ADD_GUN(unit,gun) (unit) setUnitLoadout [\ + [gun, nil, nil, nil, nil, nil, nil],\ + nil,\ + nil,\ + nil, nil, nil,\ + nil, nil, nil, nil\ +] + +#define ADD_LAUNCHER(unit,launcher) (unit) setUnitLoadout [\ + nil,\ + [launcher, nil, nil, nil, nil, nil, nil],\ + nil,\ + nil, nil, nil,\ + nil, nil, nil, nil\ +] + +#define ADD_PISTOL(unit,pistol) (unit) setUnitLoadout [\ + nil,\ + nil,\ + [pistol, nil, nil, nil, nil, nil, nil],\ + nil, nil, nil,\ + nil, nil, nil, nil\ +] // control ids #define IDC_RETICLE 4000 From c41f1a2aace9298fbf82d24a627330e7596947be Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 22 Apr 2019 10:10:10 +0200 Subject: [PATCH 15/30] cba_optics_fnc_addWeapon --- addons/optics/XEH_PREP.sqf | 1 + addons/optics/fnc_addWeapon.sqf | 68 +++++++++++++++++++++++ addons/optics/fnc_changePIPOpticClass.sqf | 12 ++-- addons/optics/script_component.hpp | 25 --------- 4 files changed, 75 insertions(+), 31 deletions(-) create mode 100644 addons/optics/fnc_addWeapon.sqf diff --git a/addons/optics/XEH_PREP.sqf b/addons/optics/XEH_PREP.sqf index d42fb08db..ad99e6231 100644 --- a/addons/optics/XEH_PREP.sqf +++ b/addons/optics/XEH_PREP.sqf @@ -9,3 +9,4 @@ PREP(changeCarryHandleOpticClass); PREP(setOpticMagnification); PREP(setOpticMagnificationHelper); PREP(setOpticMagnificationHelperZeroing); +PREP(addWeapon); diff --git a/addons/optics/fnc_addWeapon.sqf b/addons/optics/fnc_addWeapon.sqf new file mode 100644 index 000000000..db71ff230 --- /dev/null +++ b/addons/optics/fnc_addWeapon.sqf @@ -0,0 +1,68 @@ +#include "script_component.hpp" +/* ---------------------------------------------------------------------------- +Function: CBA_optics_fnc_addWeapon + +Description: + Adds weapon to unit without taking a magazine. + + Does not work on vehicles. + Attempts to keep magazine ids for unrelated magazines. + +Parameters: + _unit - Unit to add the weapon to + _weapon - Weapon to add + +Returns: + Nothing. + +Examples: + (begin example) + class EventHandlers { + [player, "arifle_mx_F"] CBA_optics_fnc_addWeapon; + }; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ + +params ["_unit", "_weapon"]; + +// config case +private _compatibleMagazines = _weapon call CBA_fnc_compatibleMagazines; + +private _uniform = uniformContainer _unit; +private _uniformMagazines = magazinesAmmoCargo _uniform select { + (_x select 0) in _compatibleMagazines // also config case +}; + +private _vest = vestContainer _unit; +private _vestMagazines = magazinesAmmoCargo _vest select { + (_x select 0) in _compatibleMagazines +}; + +private _backpack = backpackContainer _unit; +private _backpackMagazines = magazinesAmmoCargo _backpack select { + (_x select 0) in _compatibleMagazines +}; + +{ + _unit removeMagazines _x; +} forEach _compatibleMagazines; + +_unit addWeapon _weapon; + +{ + _x params ["_magazine", "_ammo"]; + _uniform addMagazineAmmoCargo [_magazine, 1, _ammo]; +} forEach _uniformMagazines; + +{ + _x params ["_magazine", "_ammo"]; + _vest addMagazineAmmoCargo [_magazine, 1, _ammo]; +} forEach _vestMagazines; + +{ + _x params ["_magazine", "_ammo"]; + _backpack addMagazineAmmoCargo [_magazine, 1, _ammo]; +} forEach _backpackMagazines; diff --git a/addons/optics/fnc_changePIPOpticClass.sqf b/addons/optics/fnc_changePIPOpticClass.sqf index e73d79226..7d16b2253 100644 --- a/addons/optics/fnc_changePIPOpticClass.sqf +++ b/addons/optics/fnc_changePIPOpticClass.sqf @@ -32,7 +32,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { if (!isNil "_pipGun") then { private _muzzle = currentMuzzle _unit; - ADD_GUN(_unit,_pipGun); + [_unit, _pipGun] call FUNC(addWeapon); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -55,7 +55,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { if (!isNil "_pipLauncher") then { private _muzzle = currentMuzzle _unit; - ADD_LAUNCHER(_unit,_pipLauncher); + [_unit, _pipLauncher] call FUNC(addWeapon); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -78,7 +78,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { if (!isNil "_pipPistol") then { private _muzzle = currentMuzzle _unit; - ADD_PISTOL(_unit,_pipPistol); + [_unit, _pipPistol] call FUNC(addWeapon); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -113,7 +113,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { if (!isNil "_normalGun") then { private _muzzle = currentMuzzle _unit; - ADD_GUN(_unit,_normalGun); + [_unit, _normalGun] call FUNC(addWeapon); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -136,7 +136,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { if (!isNil "_normalLauncher") then { private _muzzle = currentMuzzle _unit; - ADD_LAUNCHER(_unit,_normalLauncher); + [_unit, _normalLauncher] call FUNC(addWeapon); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { @@ -159,7 +159,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { if (!isNil "_normalPistol") then { private _muzzle = currentMuzzle _unit; - ADD_PISTOL(_unit,_normalPistol); + [_unit, _normalPistol] call FUNC(addWeapon); if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; { diff --git a/addons/optics/script_component.hpp b/addons/optics/script_component.hpp index 514396fc4..2a3b1a1d4 100644 --- a/addons/optics/script_component.hpp +++ b/addons/optics/script_component.hpp @@ -21,31 +21,6 @@ #define AMBIENT_BRIGHTNESS (sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + moonIntensity / 5 * (1 - overcast) min 1) // idea by Falke #define WEAPON_MAGAZINES(unit,weapon) (weaponsItems (unit) select {_x select 0 == (weapon)} param [0, []] select {_x isEqualType []}) -// addWeapon, but without leeching magazines -#define ADD_GUN(unit,gun) (unit) setUnitLoadout [\ - [gun, nil, nil, nil, nil, nil, nil],\ - nil,\ - nil,\ - nil, nil, nil,\ - nil, nil, nil, nil\ -] - -#define ADD_LAUNCHER(unit,launcher) (unit) setUnitLoadout [\ - nil,\ - [launcher, nil, nil, nil, nil, nil, nil],\ - nil,\ - nil, nil, nil,\ - nil, nil, nil, nil\ -] - -#define ADD_PISTOL(unit,pistol) (unit) setUnitLoadout [\ - nil,\ - nil,\ - [pistol, nil, nil, nil, nil, nil, nil],\ - nil, nil, nil,\ - nil, nil, nil, nil\ -] - // control ids #define IDC_RETICLE 4000 #define IDC_BODY 4001 From a5fabe47bfb21b39f8620bc98f81a4b755589ee6 Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 22 Apr 2019 10:12:35 +0200 Subject: [PATCH 16/30] cba_optics_fnc_addWeapon --- addons/optics/fnc_addWeapon.sqf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/optics/fnc_addWeapon.sqf b/addons/optics/fnc_addWeapon.sqf index db71ff230..645527dee 100644 --- a/addons/optics/fnc_addWeapon.sqf +++ b/addons/optics/fnc_addWeapon.sqf @@ -17,9 +17,7 @@ Returns: Examples: (begin example) - class EventHandlers { - [player, "arifle_mx_F"] CBA_optics_fnc_addWeapon; - }; + [player, "arifle_mx_F"] CBA_optics_fnc_addWeapon; (end) Author: From 32d648841568e3a45a1840ef6fdf46d819fbc1cc Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 22 Apr 2019 10:43:38 +0200 Subject: [PATCH 17/30] optimize and keep weapon mode when toggling to pip / normal weapon with optic --- addons/optics/fnc_changePIPOpticClass.sqf | 84 ++++++++++++++++------- 1 file changed, 60 insertions(+), 24 deletions(-) diff --git a/addons/optics/fnc_changePIPOpticClass.sqf b/addons/optics/fnc_changePIPOpticClass.sqf index 7d16b2253..6bcb0b777 100644 --- a/addons/optics/fnc_changePIPOpticClass.sqf +++ b/addons/optics/fnc_changePIPOpticClass.sqf @@ -25,15 +25,21 @@ params ["_unit"]; if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Gun, switch to pip weapon. private _gun = primaryWeapon _unit; - private _gunItems = primaryWeaponItems _unit; - private _gunMagazines = WEAPON_MAGAZINES(_unit,_gun); - private _pipGun = GVAR(PIPOptics) getVariable _gun; if (!isNil "_pipGun") then { + private _gunItems = primaryWeaponItems _unit; + private _gunMagazines = WEAPON_MAGAZINES(_unit,_gun); + private _muzzle = currentMuzzle _unit; + private _mode = currentWeaponMode _unit; + + if (_muzzle == currentWeapon _unit) then { + _muzzle = _pipGun; + }; + [_unit, _pipGun] call FUNC(addWeapon); - if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; + [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { _unit addPrimaryWeaponItem _x; @@ -48,15 +54,21 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Launcher, switch to pip weapon. private _launcher = secondaryWeapon _unit; - private _launcherItems = secondaryWeaponItems _unit; - private _launcherMagazines = WEAPON_MAGAZINES(_unit,_launcher); - private _pipLauncher = GVAR(PIPOptics) getVariable _launcher; if (!isNil "_pipLauncher") then { + private _launcherItems = secondaryWeaponItems _unit; + private _launcherMagazines = WEAPON_MAGAZINES(_unit,_launcher); + private _muzzle = currentMuzzle _unit; + private _mode = currentWeaponMode _unit; + + if (_muzzle == currentWeapon _unit) then { + _muzzle = _pipLauncher; + }; + [_unit, _pipLauncher] call FUNC(addWeapon); - if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; + [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { _unit addSecondaryWeaponItem _x; @@ -71,15 +83,21 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Pistol, switch to pip weapon. private _pistol = handgunWeapon _unit; - private _pistolItems = handgunItems _unit; - private _pistolMagazines = WEAPON_MAGAZINES(_unit,_pistol); - private _pipPistol = GVAR(PIPOptics) getVariable _pistol; if (!isNil "_pipPistol") then { + private _pistolItems = handgunItems _unit; + private _pistolMagazines = WEAPON_MAGAZINES(_unit,_pistol); + private _muzzle = currentMuzzle _unit; + private _mode = currentWeaponMode _unit; + + if (_muzzle == currentWeapon _unit) then { + _muzzle = _pipPistol; + }; + [_unit, _pipPistol] call FUNC(addWeapon); - if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; + [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { _unit addHandgunItem _x; @@ -106,15 +124,21 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { } else { // Gun, switch to normal weapon. private _gun = primaryWeapon _unit; - private _gunItems = primaryWeaponItems _unit; - private _gunMagazines = WEAPON_MAGAZINES(_unit,_gun); - private _normalGun = GVAR(NonPIPOptics) getVariable _gun; if (!isNil "_normalGun") then { + private _gunItems = primaryWeaponItems _unit; + private _gunMagazines = WEAPON_MAGAZINES(_unit,_gun); + private _muzzle = currentMuzzle _unit; + private _mode = currentWeaponMode _unit; + + if (_muzzle == currentWeapon _unit) then { + _muzzle = _normalGun; + }; + [_unit, _normalGun] call FUNC(addWeapon); - if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; + [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { _unit addPrimaryWeaponItem _x; @@ -129,15 +153,21 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Launcher, switch to normal weapon. private _launcher = secondaryWeapon _unit; - private _launcherItems = secondaryWeaponItems _unit; - private _launcherMagazines = WEAPON_MAGAZINES(_unit,_launcher); - private _normalLauncher = GVAR(NonPIPOptics) getVariable _launcher; if (!isNil "_normalLauncher") then { + private _launcherItems = secondaryWeaponItems _unit; + private _launcherMagazines = WEAPON_MAGAZINES(_unit,_launcher); + private _muzzle = currentMuzzle _unit; + private _mode = currentWeaponMode _unit; + + if (_muzzle == currentWeapon _unit) then { + _muzzle = _normalLauncher; + }; + [_unit, _normalLauncher] call FUNC(addWeapon); - if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; + [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { _unit addSecondaryWeaponItem _x; @@ -152,15 +182,21 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Pistol, switch to normal weapon. private _pistol = handgunWeapon _unit; - private _pistolItems = handgunItems _unit; - private _pistolMagazines = WEAPON_MAGAZINES(_unit,_pistol); - private _normalPistol = GVAR(NonPIPOptics) getVariable _pistol; if (!isNil "_normalPistol") then { + private _pistolItems = handgunItems _unit; + private _pistolMagazines = WEAPON_MAGAZINES(_unit,_pistol); + private _muzzle = currentMuzzle _unit; + private _mode = currentWeaponMode _unit; + + if (_muzzle == currentWeapon _unit) then { + _muzzle = _normalPistol; + }; + [_unit, _normalPistol] call FUNC(addWeapon); - if (_muzzle isEqualType "") then {_unit selectWeapon _muzzle}; + [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { _unit addHandgunItem _x; From 393176206e59578575016f99e9bff512fb67c240 Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 23 Apr 2019 20:01:51 +0200 Subject: [PATCH 18/30] report mags of all muzzles --- addons/optics/fnc_addWeapon.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/optics/fnc_addWeapon.sqf b/addons/optics/fnc_addWeapon.sqf index 645527dee..1127ee157 100644 --- a/addons/optics/fnc_addWeapon.sqf +++ b/addons/optics/fnc_addWeapon.sqf @@ -27,7 +27,7 @@ Author: params ["_unit", "_weapon"]; // config case -private _compatibleMagazines = _weapon call CBA_fnc_compatibleMagazines; +private _compatibleMagazines = [_weapon, true] call CBA_fnc_compatibleMagazines; private _uniform = uniformContainer _unit; private _uniformMagazines = magazinesAmmoCargo _uniform select { From b83a61d441ed627ade852562fba98d161c316aec Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 09:49:40 +0200 Subject: [PATCH 19/30] replace loaded launcher mags with loaded launchers --- addons/disposable/XEH_PREP.sqf | 1 + addons/disposable/XEH_preInit.sqf | 15 ++++++- addons/disposable/XEH_preStart.sqf | 4 ++ .../disposable/fnc_replaceMagazineCargo.sqf | 39 +++++++++++++++++++ addons/optics/XEH_preInit.sqf | 8 ++-- addons/optics/XEH_preStart.sqf | 11 +++--- 6 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 addons/disposable/XEH_PREP.sqf create mode 100644 addons/disposable/fnc_replaceMagazineCargo.sqf diff --git a/addons/disposable/XEH_PREP.sqf b/addons/disposable/XEH_PREP.sqf new file mode 100644 index 000000000..a893c9d2c --- /dev/null +++ b/addons/disposable/XEH_PREP.sqf @@ -0,0 +1 @@ +PREP(replaceMagazineCargo); diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 1e9371599..88241981d 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -4,6 +4,8 @@ ADDON = false; if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {}; +#include "XEH_PREP.sqf" + private _fnc_update = { params ["_unit"]; if (!local _unit) exitWith {}; @@ -28,10 +30,15 @@ private _fnc_update = { GVAR(NormalLaunchers) = [] call CBA_fnc_createNamespace; GVAR(LoadedLaunchers) = [] call CBA_fnc_createNamespace; GVAR(UsedLaunchers) = [] call CBA_fnc_createNamespace; +GVAR(magazines) = []; +GVAR(MagazineLaunchers) = [] call CBA_fnc_createNamespace; + +private _cfgWeapons = configFile >> "CfgWeapons"; +private _cfgMagazines = configFile >> "CfgMagazines"; { private _launcher = configName _x; - private _magazine = getArray (configFile >> "CfgWeapons" >> _launcher >> "magazines") select 0; + private _magazine = configName (_cfgMagazines >> (getArray (_cfgWeapons >> _launcher >> "magazines") select 0)); getArray _x params ["_loadedLauncher", "_usedLauncher"]; GVAR(LoadedLaunchers) setVariable [_launcher, _loadedLauncher]; @@ -40,6 +47,12 @@ GVAR(UsedLaunchers) = [] call CBA_fnc_createNamespace; if (isNil {GVAR(NormalLaunchers) getVariable _loadedLauncher}) then { GVAR(NormalLaunchers) setVariable [_loadedLauncher, [_launcher, _magazine]]; }; + + if (GVAR(magazines) pushBackUnique _magazine != -1) then { + GVAR(MagazineLaunchers) setVariable [_magazine, _loadedLauncher]; + }; } forEach configProperties [configFile >> "CBA_DisposableLaunchers", "isArray _x"]; +["All", "InitPost", FUNC(replaceMagazineCargo)] call CBA_fnc_addClassEventHandler; + ADDON = true; diff --git a/addons/disposable/XEH_preStart.sqf b/addons/disposable/XEH_preStart.sqf index 3564c51ff..db66c41e3 100644 --- a/addons/disposable/XEH_preStart.sqf +++ b/addons/disposable/XEH_preStart.sqf @@ -1,5 +1,9 @@ #include "script_component.hpp" +if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {}; + +#include "XEH_PREP.sqf" + if (!hasInterface) exitWith {}; PREP(initDisplayInventory); diff --git a/addons/disposable/fnc_replaceMagazineCargo.sqf b/addons/disposable/fnc_replaceMagazineCargo.sqf new file mode 100644 index 000000000..0cb12fbbd --- /dev/null +++ b/addons/disposable/fnc_replaceMagazineCargo.sqf @@ -0,0 +1,39 @@ +#include "script_component.hpp" +/* ---------------------------------------------------------------------------- +Internal Function: cba_disposable_fnc_replaceMagazineCargo + +Description: + Replaces disposable launcher magazines with loaded disposable launchers. + +Parameters: + _box - Any object with cargo + +Returns: + Nothing. + +Examples: + (begin example) + _box call cba_disposable_fnc_replaceMagazineCargo + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ + +params ["_box"]; +if (!local _box) exitWith {}; + +if (magazineCargo _box arrayIntersect GVAR(magazines) isEqualTo []) exitWith {}; + +private _magazines = magazinesAmmoCargo _box; +clearMagazineCargoGlobal _box; + +{ + _x params ["_magazine", "_ammo"]; + + if (_magazine in GVAR(magazines)) then { + _box addWeaponCargoGlobal [GVAR(MagazineLaunchers) getVariable _magazine, 1]; + } else { + _box addMagazineAmmoCargo [_magazine, 1, _ammo]; + }; +} forEach _magazines; diff --git a/addons/optics/XEH_preInit.sqf b/addons/optics/XEH_preInit.sqf index a90002115..e6663ed6c 100644 --- a/addons/optics/XEH_preInit.sqf +++ b/addons/optics/XEH_preInit.sqf @@ -4,12 +4,14 @@ ADDON = false; #include "initSettings.sqf" -if (!hasInterface) exitWith {}; -if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo []) exitWith {}; -if (configProperties [configFile >> "CBA_CarryHandleTypes"] isEqualTo []) exitWith {}; +if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo [] && { + configProperties [configFile >> "CBA_CarryHandleTypes"] isEqualTo [] +}) exitWith {}; #include "XEH_PREP.sqf" +if (!hasInterface) exitWith {}; + QGVAR(pauseOpticLayer) cutText ["", "PLAIN"]; GVAR(camera) = objNull; diff --git a/addons/optics/XEH_preStart.sqf b/addons/optics/XEH_preStart.sqf index b84e75bbf..669623d2f 100644 --- a/addons/optics/XEH_preStart.sqf +++ b/addons/optics/XEH_preStart.sqf @@ -1,11 +1,12 @@ #include "script_component.hpp" +if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo [] && { + configProperties [configFile >> "CBA_CarryHandleTypes"] isEqualTo [] +}) exitWith {}; + +#include "XEH_PREP.sqf" + if (!hasInterface) exitWith {}; // Do not move this below these checks, or this missing function can be exploited. PREP(initDisplayInterrupt); - -if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo []) exitWith {}; -if (configProperties [configFile >> "CBA_CarryHandleTypes"] isEqualTo []) exitWith {}; - -#include "XEH_PREP.sqf" From 0db4829eb108059324724f167d947ba2ed0b37a3 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 13:50:41 +0200 Subject: [PATCH 20/30] add shared function CBA_fnc_addWeaponWithoutMagazines --- addons/common/CfgFunctions.hpp | 1 + .../fnc_addWeaponWithoutMagazines.sqf} | 4 ++-- addons/disposable/XEH_preInit.sqf | 3 ++- addons/disposable/fnc_firedDisposable.sqf | 11 ++++++----- addons/optics/XEH_PREP.sqf | 1 - addons/optics/fnc_changePIPOpticClass.sqf | 12 ++++++------ 6 files changed, 17 insertions(+), 15 deletions(-) rename addons/{optics/fnc_addWeapon.sqf => common/fnc_addWeaponWithoutMagazines.sqf} (93%) diff --git a/addons/common/CfgFunctions.hpp b/addons/common/CfgFunctions.hpp index b8724d694..d5daad8b9 100644 --- a/addons/common/CfgFunctions.hpp +++ b/addons/common/CfgFunctions.hpp @@ -62,6 +62,7 @@ class CfgFunctions { class Inventory { PATHTO_FNC(addWeapon); + PATHTO_FNC(addWeaponWithoutMagazines); PATHTO_FNC(addMagazine); PATHTO_FNC(addItem); PATHTO_FNC(compatibleMagazines); diff --git a/addons/optics/fnc_addWeapon.sqf b/addons/common/fnc_addWeaponWithoutMagazines.sqf similarity index 93% rename from addons/optics/fnc_addWeapon.sqf rename to addons/common/fnc_addWeaponWithoutMagazines.sqf index 1127ee157..20743d0b8 100644 --- a/addons/optics/fnc_addWeapon.sqf +++ b/addons/common/fnc_addWeaponWithoutMagazines.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* ---------------------------------------------------------------------------- -Function: CBA_optics_fnc_addWeapon +Function: CBA_fnc_addWeaponWithoutMagazines Description: Adds weapon to unit without taking a magazine. @@ -17,7 +17,7 @@ Returns: Examples: (begin example) - [player, "arifle_mx_F"] CBA_optics_fnc_addWeapon; + [player, "arifle_mx_F"] CBA_fnc_addWeaponWithoutMagazines; (end) Author: diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 88241981d..b694783d2 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -14,7 +14,8 @@ private _fnc_update = { if (!isNil "_launcher") then { private _launcherItems = secondaryWeaponItems _unit; - _unit addWeapon _launcher; + [_unit, _launcher] call CBA_fnc_addWeaponWithoutMagazines; + { _unit addSecondaryWeaponItem _x; } forEach _launcherItems; diff --git a/addons/disposable/fnc_firedDisposable.sqf b/addons/disposable/fnc_firedDisposable.sqf index e72b5dc27..d49ba2ade 100644 --- a/addons/disposable/fnc_firedDisposable.sqf +++ b/addons/disposable/fnc_firedDisposable.sqf @@ -44,7 +44,12 @@ if (isNil "_usedLauncher") exitWith {}; private _launcherItems = secondaryWeaponItems _unit; private _launcherMagazines = WEAPON_MAGAZINES(_unit,secondaryWeapon _unit); - _unit addWeapon _usedLauncher; + [_unit, _usedLauncher] call CBA_fnc_addWeaponWithoutMagazines; + + if (_isSelected) then { + _unit selectWeapon _usedLauncher; + }; + { _unit addSecondaryWeaponItem _x; } forEach _launcherItems; @@ -52,10 +57,6 @@ if (isNil "_usedLauncher") exitWith {}; { _unit addWeaponItem [_usedLauncher, _x]; } forEach _launcherMagazines; - - if (_isSelected) then { - _unit selectWeapon _usedLauncher; - }; }; // automatically drop diff --git a/addons/optics/XEH_PREP.sqf b/addons/optics/XEH_PREP.sqf index ad99e6231..d42fb08db 100644 --- a/addons/optics/XEH_PREP.sqf +++ b/addons/optics/XEH_PREP.sqf @@ -9,4 +9,3 @@ PREP(changeCarryHandleOpticClass); PREP(setOpticMagnification); PREP(setOpticMagnificationHelper); PREP(setOpticMagnificationHelperZeroing); -PREP(addWeapon); diff --git a/addons/optics/fnc_changePIPOpticClass.sqf b/addons/optics/fnc_changePIPOpticClass.sqf index 6bcb0b777..06ca045f8 100644 --- a/addons/optics/fnc_changePIPOpticClass.sqf +++ b/addons/optics/fnc_changePIPOpticClass.sqf @@ -38,7 +38,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _pipGun; }; - [_unit, _pipGun] call FUNC(addWeapon); + [_unit, _pipGun] call CBA_fnc_addWeaponWithoutMagazines; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -67,7 +67,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _pipLauncher; }; - [_unit, _pipLauncher] call FUNC(addWeapon); + [_unit, _pipLauncher] call CBA_fnc_addWeaponWithoutMagazines; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -96,7 +96,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _pipPistol; }; - [_unit, _pipPistol] call FUNC(addWeapon); + [_unit, _pipPistol] call CBA_fnc_addWeaponWithoutMagazines; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -137,7 +137,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _normalGun; }; - [_unit, _normalGun] call FUNC(addWeapon); + [_unit, _normalGun] call CBA_fnc_addWeaponWithoutMagazines; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -166,7 +166,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _normalLauncher; }; - [_unit, _normalLauncher] call FUNC(addWeapon); + [_unit, _normalLauncher] call CBA_fnc_addWeaponWithoutMagazines; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -195,7 +195,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _normalPistol; }; - [_unit, _normalPistol] call FUNC(addWeapon); + [_unit, _normalPistol] call CBA_fnc_addWeaponWithoutMagazines; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { From 0496b48d996285f5f4fafbadefc8f66ef8b45893 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 15:45:36 +0200 Subject: [PATCH 21/30] add shared function CBA_fnc_addWeaponWithoutItems --- addons/common/CfgFunctions.hpp | 2 +- ...ines.sqf => fnc_addWeaponWithoutItems.sqf} | 21 ++++++++++++++++--- addons/disposable/XEH_preInit.sqf | 2 +- addons/disposable/fnc_firedDisposable.sqf | 2 +- addons/optics/fnc_changePIPOpticClass.sqf | 12 +++++------ 5 files changed, 27 insertions(+), 12 deletions(-) rename addons/common/{fnc_addWeaponWithoutMagazines.sqf => fnc_addWeaponWithoutItems.sqf} (74%) diff --git a/addons/common/CfgFunctions.hpp b/addons/common/CfgFunctions.hpp index d5daad8b9..d8283148e 100644 --- a/addons/common/CfgFunctions.hpp +++ b/addons/common/CfgFunctions.hpp @@ -62,7 +62,7 @@ class CfgFunctions { class Inventory { PATHTO_FNC(addWeapon); - PATHTO_FNC(addWeaponWithoutMagazines); + PATHTO_FNC(addWeaponWithoutItems); PATHTO_FNC(addMagazine); PATHTO_FNC(addItem); PATHTO_FNC(compatibleMagazines); diff --git a/addons/common/fnc_addWeaponWithoutMagazines.sqf b/addons/common/fnc_addWeaponWithoutItems.sqf similarity index 74% rename from addons/common/fnc_addWeaponWithoutMagazines.sqf rename to addons/common/fnc_addWeaponWithoutItems.sqf index 20743d0b8..9caf7edf2 100644 --- a/addons/common/fnc_addWeaponWithoutMagazines.sqf +++ b/addons/common/fnc_addWeaponWithoutItems.sqf @@ -1,9 +1,9 @@ #include "script_component.hpp" /* ---------------------------------------------------------------------------- -Function: CBA_fnc_addWeaponWithoutMagazines +Function: CBA_fnc_addWeaponWithoutItems Description: - Adds weapon to unit without taking a magazine. + Adds weapon to unit without attachments and without taking a magazine. Does not work on vehicles. Attempts to keep magazine ids for unrelated magazines. @@ -17,7 +17,7 @@ Returns: Examples: (begin example) - [player, "arifle_mx_F"] CBA_fnc_addWeaponWithoutMagazines; + [player, "arifle_mx_F"] CBA_fnc_addWeaponWithoutItems; (end) Author: @@ -50,6 +50,21 @@ private _backpackMagazines = magazinesAmmoCargo _backpack select { _unit addWeapon _weapon; +if (primaryWeapon _unit == _weapon) then { + removeAllPrimaryWeaponItems _unit; +}; + +if (secondaryWeapon _unit == _weapon) then { + // 'removeAllSecondaryWeaponItems' does not exist + { + _unit removeSecondaryWeaponItem _x; + } forEach secondaryWeaponItems _unit; +}; + +if (handgunWeapon _unit == _weapon) then { + removeAllHandgunItems _unit; +}; + { _x params ["_magazine", "_ammo"]; _uniform addMagazineAmmoCargo [_magazine, 1, _ammo]; diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index b694783d2..9f45ebcec 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -14,7 +14,7 @@ private _fnc_update = { if (!isNil "_launcher") then { private _launcherItems = secondaryWeaponItems _unit; - [_unit, _launcher] call CBA_fnc_addWeaponWithoutMagazines; + [_unit, _launcher] call CBA_fnc_addWeaponWithoutItems; { _unit addSecondaryWeaponItem _x; diff --git a/addons/disposable/fnc_firedDisposable.sqf b/addons/disposable/fnc_firedDisposable.sqf index d49ba2ade..f8aab892b 100644 --- a/addons/disposable/fnc_firedDisposable.sqf +++ b/addons/disposable/fnc_firedDisposable.sqf @@ -44,7 +44,7 @@ if (isNil "_usedLauncher") exitWith {}; private _launcherItems = secondaryWeaponItems _unit; private _launcherMagazines = WEAPON_MAGAZINES(_unit,secondaryWeapon _unit); - [_unit, _usedLauncher] call CBA_fnc_addWeaponWithoutMagazines; + [_unit, _usedLauncher] call CBA_fnc_addWeaponWithoutItems; if (_isSelected) then { _unit selectWeapon _usedLauncher; diff --git a/addons/optics/fnc_changePIPOpticClass.sqf b/addons/optics/fnc_changePIPOpticClass.sqf index 06ca045f8..052564076 100644 --- a/addons/optics/fnc_changePIPOpticClass.sqf +++ b/addons/optics/fnc_changePIPOpticClass.sqf @@ -38,7 +38,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _pipGun; }; - [_unit, _pipGun] call CBA_fnc_addWeaponWithoutMagazines; + [_unit, _pipGun] call CBA_fnc_addWeaponWithoutItems; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -67,7 +67,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _pipLauncher; }; - [_unit, _pipLauncher] call CBA_fnc_addWeaponWithoutMagazines; + [_unit, _pipLauncher] call CBA_fnc_addWeaponWithoutItems; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -96,7 +96,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _pipPistol; }; - [_unit, _pipPistol] call CBA_fnc_addWeaponWithoutMagazines; + [_unit, _pipPistol] call CBA_fnc_addWeaponWithoutItems; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -137,7 +137,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _normalGun; }; - [_unit, _normalGun] call CBA_fnc_addWeaponWithoutMagazines; + [_unit, _normalGun] call CBA_fnc_addWeaponWithoutItems; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -166,7 +166,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _normalLauncher; }; - [_unit, _normalLauncher] call CBA_fnc_addWeaponWithoutMagazines; + [_unit, _normalLauncher] call CBA_fnc_addWeaponWithoutItems; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { @@ -195,7 +195,7 @@ if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { _muzzle = _normalPistol; }; - [_unit, _normalPistol] call CBA_fnc_addWeaponWithoutMagazines; + [_unit, _normalPistol] call CBA_fnc_addWeaponWithoutItems; [_unit, _muzzle, _mode] call CBA_fnc_selectWeapon; { From e4cdd722dd9c99f442b0e244b4c1b3200f564b8e Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 16:18:38 +0200 Subject: [PATCH 22/30] add launcher mags and attachments to dropped container --- addons/disposable/fnc_firedDisposable.sqf | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/addons/disposable/fnc_firedDisposable.sqf b/addons/disposable/fnc_firedDisposable.sqf index f8aab892b..b747e3835 100644 --- a/addons/disposable/fnc_firedDisposable.sqf +++ b/addons/disposable/fnc_firedDisposable.sqf @@ -73,6 +73,9 @@ if (isNil "_usedLauncher") exitWith {}; isNull _projectile }; }) exitWith { + private _launcherItems = secondaryWeaponItems _unit; + private _launcherMagazines = WEAPON_MAGAZINES(_unit,secondaryWeapon _unit); + _unit removeWeapon _usedLauncher; private _dir = getDir _unit - 180; @@ -85,7 +88,7 @@ if (isNil "_usedLauncher") exitWith {}; _container setVelocity (velocity _unit vectorAdd ([sin _dir, cos _dir, 0] vectorMultiply 1.5)); /* - addWeaponWithAttachmentsCargoGlobal [ + _container addWeaponWithAttachmentsCargoGlobal [ _usedLauncher, _silencer, _pointer, _optic, _bipod, [ _magazine1, _ammo1, @@ -94,6 +97,18 @@ if (isNil "_usedLauncher") exitWith {}; 1]; */ + { + _container addItemCargoGlobal [_x, 1]; + } forEach _launcherItems; + + { + _x params ["_magazine", "_ammo"]; + + if (_ammo > 0) then { + _container addMagazineAmmoCargo [_x, 1, _ammo]; + }; + } forEach _launcherMagazines; + true // quit }; From c8e45f106481948cf3b1a3c512c75052c740b77e Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 16:47:40 +0200 Subject: [PATCH 23/30] handle prequipped backpacks --- addons/disposable/fnc_replaceMagazineCargo.sqf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/addons/disposable/fnc_replaceMagazineCargo.sqf b/addons/disposable/fnc_replaceMagazineCargo.sqf index 0cb12fbbd..751e8538f 100644 --- a/addons/disposable/fnc_replaceMagazineCargo.sqf +++ b/addons/disposable/fnc_replaceMagazineCargo.sqf @@ -23,6 +23,21 @@ Author: params ["_box"]; if (!local _box) exitWith {}; +private _uniformContainer = uniformContainer _box; +if (!isNull _uniformContainer) then { + _uniformContainer call FUNC(replaceMagazineCargo); +}; + +private _vestContainer = vestContainer _box; +if (!isNull _vestContainer) then { + _vestContainer call FUNC(replaceMagazineCargo); +}; + +private _backpackContainer = backpackContainer _box; +if (!isNull _backpackContainer) then { + _backpackContainer call FUNC(replaceMagazineCargo); +}; + if (magazineCargo _box arrayIntersect GVAR(magazines) isEqualTo []) exitWith {}; private _magazines = magazinesAmmoCargo _box; From ca99085dccc72f21c73e247670d15cdada74ead3 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 16:49:39 +0200 Subject: [PATCH 24/30] handle prequipped backpacks stored themselves in cargo --- addons/disposable/XEH_preInit.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 9f45ebcec..9fbc3403e 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -55,5 +55,6 @@ private _cfgMagazines = configFile >> "CfgMagazines"; } forEach configProperties [configFile >> "CBA_DisposableLaunchers", "isArray _x"]; ["All", "InitPost", FUNC(replaceMagazineCargo)] call CBA_fnc_addClassEventHandler; +["CAManBase", "Take", FUNC(replaceMagazineCargo)] call CBA_fnc_addClassEventHandler; ADDON = true; From 72d6838fff3431e26949db7f91119369c33030c1 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 16:52:26 +0200 Subject: [PATCH 25/30] handle prequipped backpacks stored themselves in cargo --- addons/disposable/XEH_preInit.sqf | 1 - addons/disposable/fnc_replaceMagazineCargo.sqf | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 9fbc3403e..9f45ebcec 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -55,6 +55,5 @@ private _cfgMagazines = configFile >> "CfgMagazines"; } forEach configProperties [configFile >> "CBA_DisposableLaunchers", "isArray _x"]; ["All", "InitPost", FUNC(replaceMagazineCargo)] call CBA_fnc_addClassEventHandler; -["CAManBase", "Take", FUNC(replaceMagazineCargo)] call CBA_fnc_addClassEventHandler; ADDON = true; diff --git a/addons/disposable/fnc_replaceMagazineCargo.sqf b/addons/disposable/fnc_replaceMagazineCargo.sqf index 751e8538f..1be85e5df 100644 --- a/addons/disposable/fnc_replaceMagazineCargo.sqf +++ b/addons/disposable/fnc_replaceMagazineCargo.sqf @@ -38,6 +38,10 @@ if (!isNull _backpackContainer) then { _backpackContainer call FUNC(replaceMagazineCargo); }; +{ + _x call FUNC(replaceMagazineCargo); +} forEach everyBackpack _box; + if (magazineCargo _box arrayIntersect GVAR(magazines) isEqualTo []) exitWith {}; private _magazines = magazinesAmmoCargo _box; From 60748585b18ba40a839f82e55e9366de04584769 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 17:23:29 +0200 Subject: [PATCH 26/30] drop used launcher setting --- addons/common/stringtable.xml | 5 +++++ addons/disposable/XEH_preInit.sqf | 2 ++ addons/disposable/XEH_preStart.sqf | 7 +++---- addons/disposable/fnc_firedDisposable.sqf | 4 ++++ addons/disposable/initSettings.sqf | 12 ++++++++++++ addons/disposable/stringtable.xml | 18 +++++++++++++++++- addons/events/initSettings.sqf | 2 +- addons/events/stringtable.xml | 5 ----- addons/optics/XEH_preStart.sqf | 8 +++----- addons/optics/initSettings.sqf | 4 ++-- addons/optics/stringtable.xml | 5 ----- 11 files changed, 49 insertions(+), 23 deletions(-) create mode 100644 addons/disposable/initSettings.sqf diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index 6b17c3925..40edd6fb8 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -20,5 +20,10 @@ Önce bir görev başlatmalısınız. ミッションを開始しておく必要があります。 + + CBA Weapons + CBA Waffen + CBA Bronie + diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 9f45ebcec..603466d6b 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -2,6 +2,8 @@ ADDON = false; +#include "initSettings.sqf" + if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {}; #include "XEH_PREP.sqf" diff --git a/addons/disposable/XEH_preStart.sqf b/addons/disposable/XEH_preStart.sqf index db66c41e3..6e8139e83 100644 --- a/addons/disposable/XEH_preStart.sqf +++ b/addons/disposable/XEH_preStart.sqf @@ -1,9 +1,8 @@ #include "script_component.hpp" +// Do not move this below these checks, or this missing function can be exploited. +PREP(initDisplayInventory); + if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {}; #include "XEH_PREP.sqf" - -if (!hasInterface) exitWith {}; - -PREP(initDisplayInventory); diff --git a/addons/disposable/fnc_firedDisposable.sqf b/addons/disposable/fnc_firedDisposable.sqf index b747e3835..dd69b3dc3 100644 --- a/addons/disposable/fnc_firedDisposable.sqf +++ b/addons/disposable/fnc_firedDisposable.sqf @@ -60,6 +60,8 @@ if (isNil "_usedLauncher") exitWith {}; }; // automatically drop + if (GVAR(dropUsedLauncher) isEqualTo 0) exitWith {}; + [{ params ["_unit", "_usedLauncher", "_projectile"]; @@ -73,6 +75,8 @@ if (isNil "_usedLauncher") exitWith {}; isNull _projectile }; }) exitWith { + if (GVAR(dropUsedLauncher) isEqualTo 1 && {_unit == call CBA_fnc_currentUnit}) exitWith {true}; + private _launcherItems = secondaryWeaponItems _unit; private _launcherMagazines = WEAPON_MAGAZINES(_unit,secondaryWeapon _unit); diff --git a/addons/disposable/initSettings.sqf b/addons/disposable/initSettings.sqf new file mode 100644 index 000000000..5a02aa491 --- /dev/null +++ b/addons/disposable/initSettings.sqf @@ -0,0 +1,12 @@ +[ + QGVAR(dropUsedLauncher), + "LIST", + LLSTRING(DropUsedLauncher), + ELSTRING(common,WeaponsCategory), + [ + [0,1,2], + [LLSTRING(DropNever), LLSTRING(DropAIOnly), LLSTRING(DropSelectedAnotherWeapon)], + 2 + ], + 0 // isGlobal +] call EFUNC(settings,init); diff --git a/addons/disposable/stringtable.xml b/addons/disposable/stringtable.xml index b1007cd04..8dba855c3 100644 --- a/addons/disposable/stringtable.xml +++ b/addons/disposable/stringtable.xml @@ -1,9 +1,25 @@ - + Community Base Addons - Disposable Weapons Community Base Addons - Einwegwaffen + + Drop Used Disposable Launcher + Benutzten Einwegwerfer ablegen + + + Never + Niemals + + + AI Only + Nur KI + + + Selected Another Weapon + Andere Waffe ausgewählt + diff --git a/addons/events/initSettings.sqf b/addons/events/initSettings.sqf index 0f8c6e118..19370088d 100644 --- a/addons/events/initSettings.sqf +++ b/addons/events/initSettings.sqf @@ -2,7 +2,7 @@ QGVAR(repetitionMode), "LIST", [LLSTRING(RepetitionMode), LLSTRING(RepetitionModeTooltip)], - LLSTRING(WeaponsCategory), + ELSTRING(common,WeaponsCategory), [[0, 1, 2], [ [LLSTRING(RepetitionModeOptic), LLSTRING(RepetitionModeOpticTooltip)], // Exit optic view [LLSTRING(RepetitionModeTriggerRelease), LLSTRING(RepetitionModeTriggerReleaseTooltip)], // Stop holding trigger diff --git a/addons/events/stringtable.xml b/addons/events/stringtable.xml index adcbc5540..53ac7c160 100644 --- a/addons/events/stringtable.xml +++ b/addons/events/stringtable.xml @@ -12,11 +12,6 @@ Community Base Addons - Zdarzenia Community Base Addons - Durumlar - - CBA Weapons - CBA Waffen - CBA Bronie - Weapon Repetition Mode Repetierwaffe laden diff --git a/addons/optics/XEH_preStart.sqf b/addons/optics/XEH_preStart.sqf index 669623d2f..ae827bb36 100644 --- a/addons/optics/XEH_preStart.sqf +++ b/addons/optics/XEH_preStart.sqf @@ -1,12 +1,10 @@ #include "script_component.hpp" +// Do not move this below these checks, or this missing function can be exploited. +PREP(initDisplayInterrupt); + if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo [] && { configProperties [configFile >> "CBA_CarryHandleTypes"] isEqualTo [] }) exitWith {}; #include "XEH_PREP.sqf" - -if (!hasInterface) exitWith {}; - -// Do not move this below these checks, or this missing function can be exploited. -PREP(initDisplayInterrupt); diff --git a/addons/optics/initSettings.sqf b/addons/optics/initSettings.sqf index 3128836ca..bcd39081e 100644 --- a/addons/optics/initSettings.sqf +++ b/addons/optics/initSettings.sqf @@ -1,8 +1,8 @@ [ QGVAR(usePipOptics), "CHECKBOX", - LSTRING(UsePIP), - LSTRING(Category), + LLSTRING(UsePIP), + ELSTRING(common,WeaponsCategory), true, // default value 2, // isGlobal { diff --git a/addons/optics/stringtable.xml b/addons/optics/stringtable.xml index 5a06bd978..ed169b5f1 100644 --- a/addons/optics/stringtable.xml +++ b/addons/optics/stringtable.xml @@ -6,11 +6,6 @@ Community Base Addons - Optiken Community Base Addons - Optyka - - CBA Optics - CBA Optiken - CBA Optyka - Use picture in picture optics Bild in Bild-Optiken verwenden From e5a51e5eee18df9b18cd1f3abc8c8c36f1c1ccc3 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 19:26:17 +0200 Subject: [PATCH 27/30] handle Arsenal --- addons/disposable/XEH_PREP.sqf | 1 + addons/disposable/XEH_preInit.sqf | 29 +++++------- .../fnc_changeDisposableLauncherClass.sqf | 47 +++++++++++++++++++ .../fnc_changeCarryHandleOpticClass.sqf | 1 + addons/optics/fnc_changePIPOpticClass.sqf | 1 + 5 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 addons/disposable/fnc_changeDisposableLauncherClass.sqf diff --git a/addons/disposable/XEH_PREP.sqf b/addons/disposable/XEH_PREP.sqf index a893c9d2c..6904997ca 100644 --- a/addons/disposable/XEH_PREP.sqf +++ b/addons/disposable/XEH_PREP.sqf @@ -1 +1,2 @@ PREP(replaceMagazineCargo); +PREP(changeDisposableLauncherClass); diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 603466d6b..52d330e4d 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -8,27 +8,20 @@ if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exi #include "XEH_PREP.sqf" -private _fnc_update = { +["loadout", { params ["_unit"]; - if (!local _unit) exitWith {}; - (GVAR(NormalLaunchers) getVariable secondaryWeapon _unit) params ["_launcher", "_magazine"]; + _unit call FUNC(changeDisposableLauncherClass); +}] call CBA_fnc_addPlayerEventHandler; - if (!isNil "_launcher") then { - private _launcherItems = secondaryWeaponItems _unit; - - [_unit, _launcher] call CBA_fnc_addWeaponWithoutItems; - - { - _unit addSecondaryWeaponItem _x; - } forEach _launcherItems; - - _unit addWeaponItem [_launcher, _magazine]; - }; -}; +["CAManBase", "InitPost", { + params ["_unit"]; + _unit call FUNC(changeDisposableLauncherClass); +}] call CBA_fnc_addClassEventHandler; -["loadout", _fnc_update] call CBA_fnc_addPlayerEventHandler; -["CAManBase", "InitPost", _fnc_update] call CBA_fnc_addClassEventHandler; -["CAManBase", "Take", _fnc_update] call CBA_fnc_addClassEventHandler; +["CAManBase", "Take", { + params ["_unit"]; + _unit call FUNC(changeDisposableLauncherClass); +}] call CBA_fnc_addClassEventHandler; GVAR(NormalLaunchers) = [] call CBA_fnc_createNamespace; GVAR(LoadedLaunchers) = [] call CBA_fnc_createNamespace; diff --git a/addons/disposable/fnc_changeDisposableLauncherClass.sqf b/addons/disposable/fnc_changeDisposableLauncherClass.sqf new file mode 100644 index 000000000..5e7eb1b69 --- /dev/null +++ b/addons/disposable/fnc_changeDisposableLauncherClass.sqf @@ -0,0 +1,47 @@ +#include "script_component.hpp" +/* ---------------------------------------------------------------------------- +Internal Function: cba_disposable_fnc_changeDisposableLauncherClass + +Description: + Switch loaded launcher class to class that can be fired with magazine. + +Parameters: + _unit - The avatar + +Returns: + Nothing. + +Examples: + (begin example) + player call cba_disposable_fnc_changeDisposableLauncherClass; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ + +params ["_unit"]; +if (!local _unit) exitWith {}; + +private _launcher = GVAR(NormalLaunchers) getVariable secondaryWeapon _unit; + +if (!isNil "_launcher") then { + _launcher params ["_launcher", "_magazine"]; + + private _launcherItems = secondaryWeaponItems _unit; + private _launcherMagazines = WEAPON_MAGAZINES(_unit,secondaryWeapon _unit); + + if (!isNil "_magazine") then { + _launcherMagazines pushBack _magazine; + }; + + [_unit, _launcher] call CBA_fnc_addWeaponWithoutItems; + + { + _unit addSecondaryWeaponItem _x; + } forEach _launcherItems; + + { + _unit addWeaponItem [_launcher, _x]; + } forEach _launcherMagazines; +}; diff --git a/addons/optics/fnc_changeCarryHandleOpticClass.sqf b/addons/optics/fnc_changeCarryHandleOpticClass.sqf index 057c115ae..da6ffed3e 100644 --- a/addons/optics/fnc_changeCarryHandleOpticClass.sqf +++ b/addons/optics/fnc_changeCarryHandleOpticClass.sqf @@ -21,6 +21,7 @@ Author: ---------------------------------------------------------------------------- */ params ["_unit"]; +if (!local _unit) exitWith {}; private _gun = primaryWeapon _unit; private _gunOptic = primaryWeaponItems _unit select 2; diff --git a/addons/optics/fnc_changePIPOpticClass.sqf b/addons/optics/fnc_changePIPOpticClass.sqf index 052564076..c2f0ab7d7 100644 --- a/addons/optics/fnc_changePIPOpticClass.sqf +++ b/addons/optics/fnc_changePIPOpticClass.sqf @@ -21,6 +21,7 @@ Author: ---------------------------------------------------------------------------- */ params ["_unit"]; +if (!local _unit) exitWith {}; if (GVAR(usePipOptics) && {!GVAR(inArsenal)}) then { // Gun, switch to pip weapon. From 2d012f7d2dde3a161e01c32221f36b27988e625f Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 26 Apr 2019 23:12:38 +0200 Subject: [PATCH 28/30] fix a problem with backpacks --- addons/disposable/fnc_replaceMagazineCargo.sqf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/disposable/fnc_replaceMagazineCargo.sqf b/addons/disposable/fnc_replaceMagazineCargo.sqf index 1be85e5df..a8bd0f595 100644 --- a/addons/disposable/fnc_replaceMagazineCargo.sqf +++ b/addons/disposable/fnc_replaceMagazineCargo.sqf @@ -47,11 +47,15 @@ if (magazineCargo _box arrayIntersect GVAR(magazines) isEqualTo []) exitWith {}; private _magazines = magazinesAmmoCargo _box; clearMagazineCargoGlobal _box; +private _isBackpack = getNumber (configFile >> "CfgVehicles" >> typeOf _box >> "isBackpack") != -1; + { _x params ["_magazine", "_ammo"]; if (_magazine in GVAR(magazines)) then { - _box addWeaponCargoGlobal [GVAR(MagazineLaunchers) getVariable _magazine, 1]; + if !(_isBackpack) then { + _box addWeaponCargoGlobal [GVAR(MagazineLaunchers) getVariable _magazine, 1]; + }; } else { _box addMagazineAmmoCargo [_magazine, 1, _ammo]; }; From e5bc3ce09b4426bc1309943082cf4aa8133b39d9 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 27 Apr 2019 16:18:15 +0200 Subject: [PATCH 29/30] support for vehicle optics --- addons/optics/XEH_preInit.sqf | 5 +++++ addons/optics/fnc_currentOptic.sqf | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/addons/optics/XEH_preInit.sqf b/addons/optics/XEH_preInit.sqf index e6663ed6c..6eb436c01 100644 --- a/addons/optics/XEH_preInit.sqf +++ b/addons/optics/XEH_preInit.sqf @@ -41,6 +41,11 @@ GVAR(ppEffects) = []; _unit call FUNC(changeCarryHandleOpticClass); }] call CBA_fnc_addPlayerEventHandler; +["vehicle", { + params ["_unit"]; + _unit call FUNC(updateOpticInfo); +}] call CBA_fnc_addPlayerEventHandler; + [QGVAR(UsingOptic), { params ["_display", "_isUsingOptic"]; if (_isUsingOptic) then { diff --git a/addons/optics/fnc_currentOptic.sqf b/addons/optics/fnc_currentOptic.sqf index e41d3452c..8d7c4effa 100644 --- a/addons/optics/fnc_currentOptic.sqf +++ b/addons/optics/fnc_currentOptic.sqf @@ -27,6 +27,16 @@ Author: params ["_unit"]; +private _vehicle = vehicle _unit; +private _vehicleOptic = ""; + +if (_vehicle != _unit) then { + // todo: turrets + _vehicleOptic = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "CBA_ScriptedOpticClass"); +}; + +if (_vehicleOptic != "") exitWith {_vehicleOptic}; + private _weapon = currentWeapon _unit; private _gun = primaryWeapon _unit; From 98c1a12d8fa3541542b82074644b589408f07437 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 27 Apr 2019 16:21:50 +0200 Subject: [PATCH 30/30] global to disable mag replacement --- addons/disposable/fnc_replaceMagazineCargo.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/disposable/fnc_replaceMagazineCargo.sqf b/addons/disposable/fnc_replaceMagazineCargo.sqf index a8bd0f595..cc56439fe 100644 --- a/addons/disposable/fnc_replaceMagazineCargo.sqf +++ b/addons/disposable/fnc_replaceMagazineCargo.sqf @@ -22,6 +22,7 @@ Author: params ["_box"]; if (!local _box) exitWith {}; +if (missionNamespace getVariable [QGVAR(disableMagazineReplacement), false]) exitWith {}; private _uniformContainer = uniformContainer _box; if (!isNull _uniformContainer) then {