diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..f6f23b8d1b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + diff --git a/AUTHORS.txt b/AUTHORS.txt index 74d75babdd..f62618e359 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -10,8 +10,8 @@ commy2 esteldunedain Felix Wiegand Garth "L-H" de Wet -Jo David -PabstMirror +bux578 +PabstMirror # CONTRIBUTORS 11RDP-LoupVert diff --git a/TO_MERGE/ace/sys_cargo/$PBOPREFIX$ b/TO_MERGE/ace/sys_cargo/$PBOPREFIX$ new file mode 100644 index 0000000000..b279a734a5 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\sys_cargo \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/ACE_readme.txt b/TO_MERGE/ace/sys_cargo/ACE_readme.txt new file mode 100644 index 0000000000..2308056ca7 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/ACE_readme.txt @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +# # +# ADVANCED COMBAT ENVIRONMENT FILE # +# # +///////////////////////////////////////////////////////////////////////////////// + + +#===========# +| Component | +#===========# + +ace_sys_crewserved + +#================# +| Main author(s) | +#================# + +rocko - Maintenance, Configs, Dialogs + +#=================# +| Contact details | +#=================# + +Mail: rocko@dev-heaven.net +Page: http://dev-heaven.net/projects/show/ace-mod2 + + + +///////////////////////////////////////////////////////////////////////////////// +# # +# ADVANCED COMBAT ENVIRONMENT FILE # +# # +///////////////////////////////////////////////////////////////////////////////// +// // +# Copyright 2009 A.C.E MOD, ALL RIGHTS RESERVED # +// // +// This product is licensed for personal use only. Commercial distribution // +// prohibited. Military use prohibited. Use prohibited if any component // +// of this distribution removed or modified without express written consent // +// of the developer. For further licensing details please refer to the // +// End User License Agreement provided within this PBO file. // +// Any questions or comments, please contact contact@acemod.net // +// // +///////////////////////////////////////////////////////////////////////////////// diff --git a/TO_MERGE/ace/sys_cargo/CfgEventHandlers.hpp b/TO_MERGE/ace/sys_cargo/CfgEventHandlers.hpp new file mode 100644 index 0000000000..fe968e32f4 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/CfgEventHandlers.hpp @@ -0,0 +1,27 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; +class Extended_Killed_EventHandlers { + class AllVehicles { + class ADDON { + killed = QUOTE(_this call FUNC(clearCargo)); + exclude[] = {"Man"}; //Exclude Animals and Humans + }; + }; +}; + +class Extended_InitPost_EventHandlers { + class AllVehicles { + class ADDON { + Init = QUOTE(if (alive (_this select 0)) then {_this call FUNC(init)}); + exclude[] = {"Man"}; //Exclude Animals and Humans + }; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/CfgFunctions.hpp b/TO_MERGE/ace/sys_cargo/CfgFunctions.hpp new file mode 100644 index 0000000000..44de214529 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/CfgFunctions.hpp @@ -0,0 +1,31 @@ +// ----------------------------------------------------------------------------- +// Automatically generated by 'functions_config.rb' +// DO NOT MANUALLY EDIT THIS FILE! +// ----------------------------------------------------------------------------- + +class CfgFunctions { + class ACE { + class Cargo { + // ACE_fnc_canLoadCargo + class canLoadCargo { + description = "Checks if vehicle is able to load cargo"; + file = "\z\ace\Addons\sys_cargo\fnc_canLoadCargo.sqf"; + }; + // ACE_fnc_listCargo + class listCargo { + description = "Lists cargo of a vehicle."; + file = "\z\ace\Addons\sys_cargo\fnc_listCargo.sqf"; + }; + // ACE_fnc_loadCargo + class loadCargo { + description = "Load cargo into vehicles."; + file = "\z\ace\Addons\sys_cargo\fnc_loadCargo.sqf"; + }; + // ACE_fnc_unloadCargo + class unloadCargo { + description = "Unloads cargo from a vehicle."; + file = "\z\ace\Addons\sys_cargo\fnc_unloadCargo.sqf"; + }; + }; + }; +}; diff --git a/TO_MERGE/ace/sys_cargo/CfgVehicles.hpp b/TO_MERGE/ace/sys_cargo/CfgVehicles.hpp new file mode 100644 index 0000000000..df5c64a0de --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/CfgVehicles.hpp @@ -0,0 +1,89 @@ +class CfgVehicles { + // TODO: add more cases ? + class All; + class Land; + class Man: Land { ACE_NOCARGOLOAD; }; + class LandVehicle: Land { ACE_LOAD_ONLY; }; + class Tank: LandVehicle { ACE_GEAR_ONLY; }; // Tank must be also ACE_LOAD_ONLY, because some obvious APCs like Bradley are inherited from class Tank instead of Tracked_APC + // TODO: Add exceptions for real class Tank !! + //class T72_Base: Tank + //class ZSU_Base: Tank + //class M1A1: Tank + //class T34: Tank + //class MLRS: Tank + //class 2S6M_Tunguska: Tank + //class M113_Base: Tank { ACE_LOAD_ONLY; }; + //class M2A2_Base: Tank { ACE_LOAD_ONLY; }; + //class T55_Base: Tank + //class BAF_FV510_D: Tank { ACE_LOAD_ONLY; }; + + class Tracked_APC: Tank { ACE_LOAD_ONLY; }; + class Car: LandVehicle { ACE_LOAD_ONLY; }; + //class BIS_alice_emptydoor: Car { ACE_NOCARGOLOAD; }; // FU DOOR + class PaperCar: Car { ACE_NOCARGOLOAD; }; + class Wheeled_APC: Car { ACE_LOAD_ONLY; }; + class Motorcycle: Landvehicle { ACE_CARGO_ONLY; }; + class StaticWeapon: LandVehicle { ACE_CARGO_ONLY; }; + //class StaticCanon: StaticWeapon { ACE_NOCARGOLOAD; }; + class Air; + class Helicopter: Air { ACE_LOAD_ONLY; }; + class ParachuteBase: Helicopter { ACE_NOCARGOLOAD; }; + class Plane: Air { ACE_LOAD_ONLY; }; + class Ship; + class SmallShip: Ship { ACE_LOAD_ONLY; }; + class BigShip: Ship { ACE_LOAD_ONLY; }; + class Ship_F; + class Boat_F: Ship_F { ACE_LOAD_ONLY; }; + + class Rubber_duck_base_F: Boat_F { + ACE_CARGO_ONLY; + ACE_Weight = 260; + }; + class Boat_Armed_01_base_F: Boat_F { ACE_LOAD_ONLY; }; + class Static: All { ACE_NOCARGOLOAD; }; + class Strategic; + class ReammoBox: Strategic { ACE_CARGO_ONLY; }; + class Library_WeaponHolder: Strategic { ACE_NOCARGOLOAD; }; + class WeaponHolder: ReammoBox { ACE_NOCARGOLOAD; }; + class Thing: All { ACE_NOCARGOLOAD; }; + class Wreck: Thing { ACE_NOCARGOLOAD; }; + class ACE_Object: Thing { ACE_NOCARGOLOAD; }; + + // TODO: Move to another hpp file + class thingX: Thing { ACE_NOCARGOLOAD; }; + class RoadCone_F: thingX { ACE_CARGO_ONLY; ACE_Weight = 1; }; + class FloatingStructure_F; + class RoadCone_L_F: FloatingStructure_F { ACE_CARGO_ONLY; ACE_Weight = 1; }; + + + + class ReammoBox_F: thingX { ACE_CARGO_ONLY; }; + /*class FoldChair: Thing { + ACE_CARGO_ONLY; + ACE_Weight = 1; + class Useractions { + class Sit { + displayname = "Sit"; + radius = 2; + position = "Component1"; + onlyforPlayer = 1; + condition = "alive this"; + statement= "player setPosASL getPosASL this; player setDir ((getDir this)+90); player switchMove 'ACE_CoolSit'; player call ace_sys_cargo_fnc_standup"; + }; + }; + };*/ + + // TODO: Add more stuff, like RoadCones, BarbedWire, Other small items to be carried + // Stuff that is to be CARRIED: + /* + - Arty Shells - done + - Fuel Can - done + - RoadCone -done + - Signs (TODO: Need to specify which ones) + - Barbed wire (TODO: Need rolled model to be unrolles for sys_razorwire or so) + - Sparewheel for small cars + - Suitcase + - + - Anything that comes to mind then + */ +}; diff --git a/TO_MERGE/ace/sys_cargo/Defines.hpp b/TO_MERGE/ace/sys_cargo/Defines.hpp new file mode 100644 index 0000000000..dd7d2d1b98 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/Defines.hpp @@ -0,0 +1,318 @@ +#define CT_STATIC 0 +#define CT_BUTTON 1 +#define CT_EDIT 2 +#define CT_SLIDER 3 +#define CT_COMBO 4 +#define CT_LISTBOX 5 +#define CT_TOOLBOX 6 +#define CT_CHECKBOXES 7 +#define CT_PROGRESS 8 +#define CT_HTML 9 +#define CT_STATIC_SKEW 10 +#define CT_ACTIVETEXT 11 +#define CT_TREE 12 +#define CT_STRUCTURED_TEXT 13 +#define CT_CONTEXT_MENU 14 +#define CT_CONTROLS_GROUP 15 +#define CT_XKEYDESC 40 +#define CT_XBUTTON 41 +#define CT_XLISTBOX 42 +#define CT_XSLIDER 43 +#define CT_XCOMBO 44 +#define CT_ANIMATED_TEXTURE 45 +#define CT_OBJECT 80 +#define CT_OBJECT_ZOOM 81 +#define CT_OBJECT_CONTAINER 82 +#define CT_OBJECT_CONT_ANIM 83 +#define CT_LINEBREAK 98 +#define CT_USER 99 +#define CT_MAP 100 +#define CT_MAP_MAIN 101 +#define ST_POS 0x0F +#define ST_HPOS 0x03 +#define ST_VPOS 0x0C +#define ST_LEFT 0x00 +#define ST_RIGHT 0x01 +#define ST_CENTER 0x02 +#define ST_DOWN 0x04 +#define ST_UP 0x08 +#define ST_VCENTER 0x0c +#define ST_TYPE 0xF0 +#define ST_SINGLE 0 +#define ST_MULTI 16 +#define ST_TITLE_BAR 32 +#define ST_PICTURE 48 +#define ST_FRAME 64 +#define ST_BACKGROUND 80 +#define ST_GROUP_BOX 96 +#define ST_GROUP_BOX2 112 +#define ST_HUD_BACKGROUND 128 +#define ST_TILE_PICTURE 144 +#define ST_WITH_RECT 160 +#define ST_LINE 176 +#define ST_SHADOW 0x100 +#define ST_NO_RECT 0x200 +#define ST_KEEP_ASPECT_RATIO 0x800 +#define ST_TITLE ST_TITLE_BAR + ST_CENTER +#define SL_DIR 0x400 +#define SL_VERT 0 +#define SL_HORZ 0x400 +#define SL_TEXTURES 0x10 +#define LB_TEXTURES 0x10 +#define LB_MULTI 0x20 +#define FontM "PuristaMedium" +#define FontHTML "PuristaMedium" + + +class ACE_CARGO_RscBgFrame { + type=CT_STATIC; + idc=-1; + style=ST_FRAME; + colorBackground[]={0.4, 0.4, 0.4, 0.75}; + colorText[]={0, 0, 0, 1}; + font=FontM; + SizeEX=0.025; + text=""; +}; +class ACE_CARGO_RscBackground { + colorBackground[]={0.4, 0.4, 0.4, 0.75}; + text=""; + type=CT_STATIC; + idc=-1; + style=ST_LEFT; + colorText[]={1, 1, 1, 1}; + font=FontM; + sizeEx=0.04; +}; +class ACE_CARGO_RscPicture { + type=CT_STATIC; + idc=-1; + style=ST_PICTURE; + colorBackground[]={0, 0, 0, 0}; + colorText[]={1, 1, 1, 1}; + font=FontM; + sizeEx=0.02; + text=""; +}; +class ACE_CARGO_RscButton { + type=CT_BUTTON; + idc=-1; + style=ST_CENTER; + colorText[]={0, 0, 0, 1}; + font=FontHTML; + sizeEx=0.025; + soundPush[]={"", 0.2, 1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1}; + default=false; + text=""; + action=""; + colorActive[]={0, 0, 0, 0}; + colorDisabled[]={0, 0, 0, 0.1}; + colorBackground[]={0,0,0,0.3}; + colorBackgroundActive[]={0,0,0,0.4}; + colorBackgroundDisabled[]={0,0,0,0.3}; + colorFocused[]={0.84,1,0.55,1}; + colorShadow[]={1, 1, 1, 0.1}; + colorBorder[]={0, 0, 0, 0.1}; + offsetX=0; + offsetY=0; + offsetPressedX=0; + offsetPressedY=0; + borderSize=0; + soundEnter[]={"", 0.15, 1}; +}; +class ACE_CARGO_RscButton2:ACE_CARGO_RscButton { + x=-1.0; + y=-1.0; + idc=-1; + w=0.01; + h=0.01; + default=true; +}; +class ACE_CARGO_RscShortcutButton { + type = 16; + idc = -1; + style = 0; + default = 0; + w = 0.183825; + h = 0.104575; + color[] = {0.543,0.5742,0.4102,1}; + color2[] = {0.95,0.95,0.95,1}; + colorBackground[] = {1,1,1,1}; + colorbackground2[] = {1,1,1,0.4}; + colorDisabled[] = {1,1,1,0.25}; + periodFocus = 1.2; + periodOver = 0.8; + class HitZone { + left = 0.004; + top = 0.029; + right = 0.004; + bottom = 0.029; + }; + class ShortcutPos { + left = 0.0145; + top = 0.026; + w = 0.0392157; + h = 0.0522876; + }; + class TextPos { + left = 0.05; + top = 0.034; + right = 0.005; + bottom = 0.005; + }; + animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa"; + animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\disabled_ca.paa"; + animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\over_ca.paa"; + animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\focus_ca.paa"; + animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\down_ca.paa"; + animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa"; + period = 0.4; + font = "PuristaMedium"; + size = 0.03921; + sizeEx = 0.03921; + text = ""; + soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1}; + action = ""; + class Attributes { + font = "PuristaMedium"; + color = "#E5E5E5"; + align = "left"; + shadow = "true"; + }; + class AttributesImage { + font = "PuristaMedium"; + color = "#E5E5E5"; + align = "left"; + }; + textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)"; +}; +class ACE_CARGO_RscShortcutButtonMain: ACE_CARGO_RscShortcutButton { + type = 16; + idc = -1; + style = 0; + default = 0; + w = 0.313726; + h = 0.104575; + color[] = {0.543,0.5742,0.4102,1}; + colorDisabled[] = {1,1,1,0.25}; + colorFocused[] = {1, 1, 1, 0};//Check + colorBackgroundFocused[] = {1, 1, 1, 0};//Check + class HitZone { + left = 0; + top = 0; + right = 0; + bottom = 0; + }; + class ShortcutPos { + left = 0.0204; + top = 0.026; + w = 0.0392157; + h = 0.0522876; + }; + class TextPos { + left = 0.08; + top = 0.034; + right = 0.005; + bottom = 0.005; + }; + animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa"; + animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\disabled_ca.paa"; + animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\over_ca.paa"; + animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\focus_ca.paa"; + animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\down_ca.paa"; + animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa"; + period = 0.5; + font = "PuristaMedium"; + size = 0.03921; + sizeEx = 0.03921; + text = ""; + soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1}; + action = ""; + class Attributes { + font = "PuristaMedium"; + color = "#E5E5E5"; + align = "left"; + shadow = "false"; + }; + class AttributesImage { + font = "PuristaMedium"; + color = "#E5E5E5"; + align = "false"; + }; +}; +class ACE_CARGO_RscEdit { + type=CT_EDIT; + idc=-1; + style=ST_LEFT; + font=FontHTML; + sizeEx=0.02; + colorText[]={0, 0, 0, 1}; + colorSelection[]={0.5, 0.5, 0.5, 1}; + autocomplete=false; + text=""; +}; +class ACE_CARGO_RscLB_C { + style=ST_LEFT; + idc=-1; + colorSelect[]={0.4, 0.4, 0.4, 1}; + colorSelectBackground[]={0.2, 0.2, 0.2, 1}; + colorText[]={0.2, 0.2, 0.2, 1}; + colorBackground[]={0.4, 0.4, 0.4, 1}; + font=FontHTML; + sizeEx=0.025; + rowHeight=0.04; +}; +class ACE_CARGO_RscListBox:ACE_CARGO_RscLB_C { + soundSelect[]={"", 0.1, 1}; + type=CT_LISTBOX; +}; +class ACE_CARGO_RscCombo: ACE_CARGO_RscLB_C { + sizeEx=0.02; + type=CT_COMBO; + wholeHeight=0.3; + soundSelect[]={"", 0.15, 1}; + soundExpand[]={"", 0.15, 1}; + soundCollapse[]={"", 0.15, 1}; + maxHistoryDelay = 1; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + class ScrollBar { + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; + color[] ={0,0,0,0.6}; + colorActive[] ={0,0,0,1}; + colorDisabled[] ={0,0,0,0.3}; + colorSelectBackground[] ={0.543,0.5742,0.4102,1}; +}; +class ACE_CARGO_RscSliderH { + access=0; + type=CT_SLIDER; + idc=-1; + sizeEx=0.025; + style=1024; + color[]={0.2, 0.2, 0.2, 1}; + colorActive[]={1, 1, 1, 1}; +}; +class ACE_CARGO_RscSliderV { + access=0; + type=CT_SLIDER; + idc=-1; + sizeEx=0.025; + style=0; + color[]={0.2, 0.2, 0.2, 1}; + colorActive[]={1, 1, 1, 1}; +}; \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/Dialog.hpp b/TO_MERGE/ace/sys_cargo/Dialog.hpp new file mode 100644 index 0000000000..4cb6e7b39f --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/Dialog.hpp @@ -0,0 +1,178 @@ +/* ace_sys_cargo | (c) 2013 by rocko */ + +#include "Defines.hpp" + +#define __X SafeZoneX +#define __Y SafeZoneY +#define __W SafeZoneW +#define __H SafeZoneH + +#define UICOMBO 5 // LISTBOX + +class ACE_CARGOUIList { + w = 0.275; + h = 0.04; + colorSelect[] = {0.023529,0,0.0313725,1}; + colorText[] = {0.023529,0,0.0313725,1}; + colorBackground[] = {0.95,0.95,0.95,1}; + colorSelectBackground[] = {0.543,0.5742,0.4102,1}; + colorScrollbar[] = {0.023529,0,0.0313725,1}; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + wholeHeight = 0.45; + color[] = {0,0,0,0.6}; + colorActive[] = {0,0,0,1}; + colorDisabled[] = {0,0,0,0.3}; + font = "PuristaMedium"; + sizeEx = 0.029; + soundSelect[] = {"",0.1,1}; + soundExpand[] = {"",0.1,1}; + soundCollapse[] = {"",0.1,1}; + maxHistoryDelay = 1; + class listScrollBar { + color[] = {1, 1, 1, 0.6}; + colorActive[] = {1, 1, 1, 1}; + colorDisabled[] = {1, 1, 1, 0.3}; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; +}; + +class ACE_CARGOUIComboBox: ACE_CARGOUIList { + type = UICOMBO; + style = 0; + idc = -1; + sizeEx = 0.025; + wholeHeight = 0.3; +}; + +class ACE_CARGO_RscText { + type = CT_STATIC; + idc = -1; + style = ST_LEFT; + x = 0.0; + y = 0.0; + w = 0.3; + h = 0.03; + sizeEx = 0.023; + colorBackground[] = {0.5, 0.5, 0.5, 0.75}; + colorText[] = { 0, 0, 0, 1 }; + font = "PuristaMedium"; + text = ""; +}; + +class ACE_Cargo_List { + name="ACE_Cargo_List"; + idd=-1; + movingEnable=0; + objects[]={}; + onLoad = "uiNamespace setVariable ['ACE_Cargo_List', _this select 0];['back'] call ace_sys_cargo_fnc_onload"; + onUnload = "[ace_sys_cargo_vehicle,objnull,0,0] call ace_sys_cargo_fnc_cbusy;"; + class controlsBackground { + class BG: ACE_CARGO_RscText { + idc = -1; + type = 0; + style = 48; + x = 0.270792 * safezoneW + safezoneX; + y = 0.224911 * safezoneH + safezoneY; + w = 0.455752 * safezoneW; + h = 0.547272 * safezoneH; + colorText[] = {1, 1, 1, 1}; + colorBackground[] = {0,0,0,0}; + text = "z\ace\addons\sys_cargo\data\rsc\ace_ui_background_ca.paa"; + font = "PuristaMedium"; + sizeEx = 0.032; + }; + }; + class controls { + class Title: ACE_CARGO_RscText { + idc = 30; + x = 0.289755 * safezoneW + safezoneX; + y = 0.231139 * safezoneH + safezoneY; + w = 0.0458417 * safezoneW; + h = 0.0550178 * safezoneH; + sizeEx = 0.05; + colorBackground[] = {1, 1, 1, 0.0}; + colorText[] = {0.643, 0.5742, 0.4102, 1.0}; + text = ""; + }; + class Content: ACE_CARGOUIComboBox { + idc = 99; + text = ""; + x = 0.277061 * safezoneW + safezoneX; + y = 0.283526 * safezoneH + safezoneY; + w = 0.416083 * safezoneW; + h = 0.322891 * safezoneH; + colorSelect[] = {1, 1, 1, 1}; + colorText[] = {1, 1, 1, 1}; + colorBackground[] = {0.8,0.8,0.8,1}; + colorSelectBackground[] = {0, 0, 0, 1}; + colorScrollbar[] = {0.2, 0.2, 0.2, 1}; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + wholeHeight = 0.45; + rowHeight = 0.06; + color[] = {0.8, 0.8, 0.8, 1}; + colorActive[] = {0,0,0,1}; + colorDisabled[] = {0,0,0,0.3}; + font = "PuristaMedium"; + sizeEx = 0.035; + soundSelect[] = {"",0.1,1}; + soundExpand[] = {"",0.1,1}; + soundCollapse[] = {"",0.1,1}; + maxHistoryDelay = 1; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + + class listScrollBar { + color[] = {1, 1, 1, 0.6}; + colorActive[] = {1, 1, 1, 1}; + colorDisabled[] = {1, 1, 1, 0.3}; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; + //onLBSelChanged = QUOTE([_this,'back'] call FUNC(lbselchanged)); + onLBSelChanged = "[_this,'back'] call ace_sys_cargo_fnc_lbselchanged"; + }; + + class Apply_B: ACE_CARGO_RscShortcutButtonMain { + idc=10; + x = 0.451603 * safezoneW + safezoneX; + y = 0.618615 * safezoneH + safezoneY; + w = 0.103494 * safezoneW; + h = 0.0451332 * safezoneH; + size = 0.02; + sizeEx = 0.02; + text = $STR_DIAG_ACE_CARGO_UNLOAD; + //action = QUOTE([GVAR(vehicle),'back'] call FUNC(unload)); + action = "[ace_sys_cargo_vehicle,'back'] call ace_sys_cargo_fnc_unload"; + }; + + class Quit_B: Apply_B { + idc = 20; + x = 0.566379 * safezoneW + safezoneX; + text = $STR_DIAG_ACE_CARGO_CANCEL; + action = "closeDialog 0;"; + }; + }; +}; + +class ACE_CargoFront_List: ACE_Cargo_List { + name="ACE_CargoFront_List"; + onLoad = "uiNamespace setVariable ['ACE_CargoFront_List', _this select 0];['front'] call ace_sys_cargo_fnc_onload"; + class controls: controls { + class Title: Title {}; + class Content: Content { + onLBSelChanged = "[_this,'front'] call ace_sys_cargo_fnc_lbselchanged"; + }; + class Apply_B: Apply_B { + action = "[ace_sys_cargo_vehicle,'front'] call ace_sys_cargo_fnc_unload"; + }; + class Quit_B: Quit_B {}; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/XEH_postInit.sqf b/TO_MERGE/ace/sys_cargo/XEH_postInit.sqf new file mode 100644 index 0000000000..ae0cc4c176 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/XEH_postInit.sqf @@ -0,0 +1,9 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +#include "script_component.hpp" + +ADDON = false; + +//["All", [ace_sys_interaction_key], 2, [QPATHTO_F(fnc_menuDef), "main"]] call CBA_ui_fnc_add; + +ADDON = true; \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/XEH_preInit.sqf b/TO_MERGE/ace/sys_cargo/XEH_preInit.sqf new file mode 100644 index 0000000000..6b5bef730b --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/XEH_preInit.sqf @@ -0,0 +1,295 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +#include "\a3\editor_f\Data\Scripts\dikCodes.h" + +#define __CONF_MAGAZINES configFile >> "CfgMagazines" +#define __CONF_WEAPONS configFile >> "CfgWeapons" + +ADDON = false; + +if (!isDedicated) then { + ["All", [ace_sys_interaction_key], 2, [QPATHTO_F(fnc_menuDef), "main"]] call CBA_ui_fnc_add; +}; + +PREP(carry); +PREP(carry2); +PREP(drag); +PREP(push); +PREP(load); +PREP(loadCargo); // Workaround +PREP(unloadCargo); // Workaround +PREP(listCargo); // Workaround +PREP(unload); +PREP(onload); +PREP(view); + +PREP(init); + +[QGVAR(setvel), {(_this select 0) setVelocity (_this select 1)}] call ACE_fnc_addReceiverOnlyEventhandler; + +// TODO: Complete rewrite needed: +/* +Function should determine wether an object can be dragged or carried or carried in pairs +Push option ONLY for boat type vehicles (to drop them back into water) + +Carrying objects should be 0 - 30 kg (Carring above 20 kilo slows you down) +Dragging should be 30 - 80 kg +Carrying in pairs should be 80 - 180 kg + +An object that can be dragged should also be able to be carried in pairs + +Everything > 180 kg, needs to be loaded and transported by another vehicle or lifted by air + +*/ + +FUNC(determineCargo) = { +// TODO: Make easier.... +// Immobile: 0 +// Carry: 1 Light objects weight exceeds no more than 20 kg!!! +// Drag: 2 Heavy objects that could not be CARRIED, weight > 15 kg < 100kg +// Push: 3 Heavy objects that could not be CARRIED or DRAGGED, weight > 100 kg! +// Carry with 2 people: 4 Heavy objects (if _type is ((2 && > 80) || (3 && < 200) && _helper) but a second player (_helper) is close ~5 meters) + +// Rev. 2: +// Carry: 1 (0-30 kg) +// Drag: 2 (30-80kg) +// Carry 2 4 (80-145kg) +// Drag OR Carry 2 5 (30-145kg and because its cool) // One override comes from CSW direct, other entities should get a special config entry (e.g ammoboxes etc) + + private ["_weight","_volume","_canDrag","_canCarry","_canPush","_type"]; + + // Calculate volume of cargo to determine weight. + PARAMS_2(_target,_method); + _volume = 0; + _weight = 0; + _canDrag = false; + _canPush = false; + _canCarry = false; + if (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> "ACE_canBeCargo") == 1) then { + _weight = [_target] call FUNC(weight); + + _canCarry = (_weight < __MAXCARRYWEIGHT); + _canDrag = (!_canCarry && {(_weight + __MAXCARRYWEIGHT) <= __MAXDRAGWEIGHT}); + + TRACE_2("DC",_volume,_weight); + switch (true) do { + // PUSH for Boats + case (_target isKindOf "Zodiac" || {_target isKindOf "PBX"}): { _canDrag = false; _canPush = true; _canCarry = false; }; + case (_target isKindOf "ACE_Stretcher"): { _canDrag = false; _canPush = false; _canCarry = false; }; + }; + // Check sys_crewserved override + if (getNumber(configFile >> "CfgVehicles" >> typeOf _target >> "ACE" >>"ACE_CREWSERVED" >> "canDrag") == 1) then { + _canDrag = true; _canPush = false; _canCarry = false; + }; + if (getNumber(configFile >> "CfgVehicles" >> typeOf _target >> "ACE" >>"ACE_CREWSERVED" >> "canCarry") == 1) then { + _canDrag = true; _canPush = false; _canCarry = true; + }; + // Check if a shot mortar + if (_target getVariable ["ace_sys_arty_shoton",false]) then { + _canDrag = false; _canCarry = false; + }; + }; + + if (_canCarry && {!_canDrag} && {!_canPush}) then { _type = 1; }; + if (!_canCarry && {_canDrag} && {!_canPush}) then { _type = 2; }; + if (_canPush && {!_canDrag} && {!_canCarry}) then { _type = 3; }; + if (!_canPush && {!_canDrag} && {!_canCarry}) then { _type = 0; }; + if (!_canCarry && {!_canDrag} && {!_canPush} && {_weight <= __MAXCARRYWEIGHTBY2}) then { _type = 4; }; + if (_canCarry && {_canDrag} && {!_canPush} && {_weight <= __MAXCARRYWEIGHTBY2}) then { _type = 5; }; + + + if (_method == "set") then { + _target setVariable [QGVAR(type),_type,true]; + }; + TRACE_1("DC Carrying method",_type); + _type +}; + +FUNC(clearCargo) = { + private ["_cargolist","_cargofrontlist"]; + PARAMS_1(_vehicle); + _cargolist = [_vehicle] call ACE_fnc_listCargo; + _cargofrontlist = _vehicle getVariable [QGVAR(content_front),[]]; + if (count _cargolist < 1 && {count _cargofrontlist < 1}) exitWith {}; + { + deleteVehicle _x; + } foreach _cargolist + _cargofrontlist; + // TODO: Determine explosives loaded? Create Secondaries for loaded shells, ammoboxes, ammocans etc + // Perhaps should be called from external with explosions, sys_destruction ... + _vehicle setVariable [QGVAR(content),[],true]; + _vehicle setVariable [QGVAR(content_front),[],true]; +}; + +FUNC(determineFrontCargo) = { + PARAMS_1(_vehicle); + private ["_frontLoadingCapability","_l1","_l2","_pl1","_pl2","_pos","_chksum","_max","_cur","_capacity_full"]; + _frontLoadingCapability = true; + if !((typeOf _vehicle) isKindOf "Car") exitWith { // Only on class Car for now... + [false,true,[0,0,0]] + }; + // TODO: Get class ACE value + // Find position between frontlights + _l1 = getText(configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> "Left" >> "selection"); + _l2 = getText(configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> "Right" >> "selection"); + _pl1 = _vehicle selectionPosition _l1; + _pl2 = _vehicle selectionPosition _l2; + _pos = [0,(_pl1 select 1)+0.1,(_pl2 select 2)-0.4]; + _chksum = (_pos select 0)+(_pos select 1)+(_pos select 2); + // TODO: Error if model not conform or has no lights + + // Return position to attach and bool value for 2 in 1 function + if (_chksum == 0.1) then { + _frontLoadingCapability = false; + }; + //_max = getNumber(configFile >> "CfgVehicles" >> typeOf _vehicle >> "ACE" >> "ACE_CARGO" >> "FrontLoadingCapacity"); + _max = 1; + _cur = _vehicle getVariable [QGVAR(content_front),[]]; + _cur = count _cur; + _capacity_free = if (_max - _cur == 0) then {false} else {true}; + [_frontLoadingCapability,_capacity_free,_pos] +}; + +FUNC(attachToFront) = { + PARAMS_2(_cargo,_vehicle); + private ["_currentFrontCargo","_pos"]; + _pos = (_vehicle call FUNC(determineFrontCargo)) select 2; + [_cargo,"set"] call FUNC(determineCargo); + ["","","",["stop",player getVariable QGVAR(carried_object)]] call FUNC(carry); + _cargo attachTo [_vehicle,_pos,""]; + _cargo setVariable [QGVAR(attached_front),true,true]; + _currentFrontCargo = _vehicle getVariable [QGVAR(content_front),[]]; + _currentFrontCargo set [count _currentFrontCargo,_cargo]; + _vehicle setVariable [QGVAR(content_front),_currentFrontCargo]; +}; + +FUNC(detachFront) = { + PARAMS_1(_cargo); + //private "_currentFrontCargo"; + detach _cargo; + _cargo setVariable [QGVAR(attached_front),false,true]; + //_currentFrontCargo = _vehicle getVariable [QGVAR(content_front),[]]; + //if (count _currentFrontCargo < 1) exitWith {}; + //_currentFrontCargo - [_cargo]; + //_vehicle setVariable [QGVAR(content_front),_currentFrontCargo]; +}; + +// TODO: Outsource funcs to external + +// Busy func +FUNC(busy) = { + PARAMS_2(_v,_s); + if (_s == 1) then { + _v setVariable [QGVAR(busy), true, true]; + } else { + _v setVariable [QGVAR(busy), false, true]; + }; +}; + +// Easy set/reset busy states +FUNC(cbusy) = { + PARAMS_4(_v,_c,_sv,_sc); + if (_sv == 1) then { [_v,1] call FUNC(busy); } else { [_v,0] call FUNC(busy); }; + if (_sc == 1) then { [_c,1] call FUNC(busy); } else { [_c,0] call FUNC(busy); }; +}; + +// Volume stuff +FUNC(volume) = { + PARAMS_1(_target); + _bbox = boundingBox _target; + _bc = abs((_bbox select 0) select 0) + abs((_bbox select 1) select 0); + _lc = abs((_bbox select 0) select 1) + abs((_bbox select 1) select 1); + _hc = abs((_bbox select 0) select 2) + abs((_bbox select 1) select 2); + _volume = (_lc * _bc * _hc); + TRACE_1("V Volume",_volume); + _volume; +}; + +// Weight stuff +FUNC(weight) = { + PARAMS_1(_cargo); + private ["_content_weight","_w1","_w2","_volume","_baseweight","_weight"]; + _content_weight = { + PARAMS_2(_items,_type); + private ["_cargo_weight","_item"]; + _cargo_weight = 0; + _item = _items select 0; + if (count _item > 0) then { + _count = _items select 1; + for "_i" from 0 to (count _item - 1) do { + _item_x = _item select _i; + _count_x = _count select _i; + _ItemWeight = switch _type do { + case "m": { 0.075 * getNumber(__CONF_MAGAZINES >> _item_x >> "mass") }; + default { 0.075* getNumber(__CONF_WEAPONS >> _item_x >> "mass") }; + }; + _ItemWeight = _ItemWeight * _count_x; + _cargo_weight = _cargo_weight + _ItemWeight; + }; + //_cargo_weight = _cargo_weight + _cargo_weight; + }; + _cargo_weight; + }; + _w1 = [getMagazineCargo _cargo, "m"] call _content_weight; + _w2 = [getWeaponCargo _cargo, "w"] call _content_weight; + #ifdef DEBUG_MODE_FULL + diag_log format["Weight of all weapons in box: %1",_w2]; + diag_log format["Weight of all magazines in box: %1",_w1]; + #endif + _volume = _cargo call FUNC(volume); + // Check if a weight value was defined and use this prior to calculated weight + _baseweight = if (isNumber(configFile >> "CfgVehicles" >> typeOf _cargo >> "mass")) then { + 0.075 * getNumber(configFile >> "CfgVehicles" >> typeOf _cargo >> "mass"); + } else { + (_volume * 0.5); + }; + TRACE_1("W Weight",_baseweight); + _weight = _baseweight + _w1 + _w2; + _weight; +}; + +GVAR(busy) = { + _this getVariable [QGVAR(busy), false] +}; +GVAR(BOXBusy) = { + PARAMS_2(_box,_busy); + _box setVariable [QGVAR(BOXBusy), _busy == 1, true]; +}; + +FUNC(dragkeydown) = { + // Eventhandler to stop "C" key press while dragging + PARAMS_5(_control,_dikCode,_shift,_ctrl,_alt); + _dikCode_check = actionKeys "TactToggle" + actionKeys "stand" + actionKeys "prone" + actionkeys "crouch" + actionkeys "moveup" + actionkeys "movedown"; //stop standing up while dragging + (_dikCode in _dikCode_check) +}; + +FUNC(lbselchanged) = { + private ["_disp", "_ctrl","_ui"]; + PARAMS_2(_data,_location); + _ui = if (_location == "back") then { "ACE_Cargo_List" } else { "ACE_CargoFront_List" }; + _disp = uiNamespace getVariable _ui; + _ctrl = _disp displayCtrl 10; + if ((_data select 1) != -1) then { + if (!(ctrlEnabled _ctrl) && !(player in crew GVAR(vehicle) || player getVariable [QGVAR(carrying),false])) then { + _ctrl ctrlEnable true; + _ctrl ctrlCommit 0; + }; + } else { + if (ctrlEnabled _ctrl) then { + _ctrl ctrlEnable false; + _ctrl ctrlCommit 0; + }; + }; +}; + +//FUNC(respawn) = { +// (findDisplay 46) displayRemoveEventHandler ["KeyDown", GVAR(drag_keyDownEHId)]; +//}; + +//FUNC(standup) = { +// PARAMS_1(_unit); +// _unit addAction ["Stand up", QPATHTO_F(fnc_exec), _unit, 0, false, true, "", "local _target"]; +//}; + +ADDON = true; diff --git a/TO_MERGE/ace/sys_cargo/box/$PBOPREFIX$ b/TO_MERGE/ace/sys_cargo/box/$PBOPREFIX$ new file mode 100644 index 0000000000..4f2ee63135 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/box/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\sys_cargo\box \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/box/config.cpp b/TO_MERGE/ace/sys_cargo/box/config.cpp new file mode 100644 index 0000000000..766b9ba034 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/box/config.cpp @@ -0,0 +1,12 @@ +#include "script_component.hpp" +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {QUOTE(MAIN_ADDON)}; + version = VERSION; + }; +}; + + diff --git a/TO_MERGE/ace/sys_cargo/box/license.txt b/TO_MERGE/ace/sys_cargo/box/license.txt new file mode 100644 index 0000000000..7113bf4340 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/box/license.txt @@ -0,0 +1,79 @@ +License (short) +=============== + +You are free: +- to Share to copy, distribute and transmit the work + +Under the following conditions: +- Attribution You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). +- Noncommercial You may not use this work for commercial purposes. +- No Derivative Works You may not alter, transform, or build upon this work. + +With the understanding that: + +Waiver Any of the above conditions can be waived if you get permission from the copyright holder. + +Public Domain Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. + +Other Rights In no way are any of the following rights affected by the license: + - Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; + - The author's moral rights; + - Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. + +Notice For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. + + +Full license text +================= + +THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. + +BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. + +1. Definitions + +"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. +"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License. +"Distribute" means to make available to the public the original and copies of the Work through sale or other transfer of ownership. +"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. +"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. +"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. +"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. +"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. +"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. +2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. + +3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: + +to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; and, +to Distribute and Publicly Perform the Work including as incorporated in Collections. +The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats, but otherwise you have no rights to make Adaptations. Subject to 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(d). + +4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: + +You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. +You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in connection with the exchange of copyrighted works. +If You Distribute, or Publicly Perform the Work or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work. The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Collection, at a minimum such credit will appear, if a credit for all contributing authors of Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. +For the avoidance of doubt: + +Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; +Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and, +Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b). +Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. +5. Representations, Warranties and Disclaimer + +UNLESS OTHERWISE MUTUALLY AGREED BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. + +6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. Termination + +This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. +Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. +8. Miscellaneous + +Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. +If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. +No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. +This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. +The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. diff --git a/TO_MERGE/ace/sys_cargo/box/script_component.hpp b/TO_MERGE/ace/sys_cargo/box/script_component.hpp new file mode 100644 index 0000000000..483522b490 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/box/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT sys_cargo_box +#define MAINCOMPONENT sys_cargo +#define SUBCOMPONENT box +#define ADDONS sys_cargo_box + +#ifdef MAINCOMPONENT + #ifdef SUBCOMPONENT + #define PATHTO_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\MAINCOMPONENT\SUBCOMPONENT\##var3.sqf + #define PATHTOF_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\MAINCOMPONENT\SUBCOMPONENT\##var3 + #define PATHTOF2_SYS(var1,var2,var3) MAINPREFIX\##var1\SUBPREFIX\MAINCOMPONENT\SUBCOMPONENT\##var3 + #endif +#endif +#include "\z\ace\addons\main\script_mod.hpp" +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/TO_MERGE/ace/sys_cargo/config.cpp b/TO_MERGE/ace/sys_cargo/config.cpp new file mode 100644 index 0000000000..8c857cfd93 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/config.cpp @@ -0,0 +1,21 @@ +#include "script_component.hpp" + +#include "\z\ace\addons\main\script_config.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { "ace_common", "ace_c_vehicle", "ace_c_weapon", "ace_sys_interaction" }; + version = VERSION; + author[] = {"Rocko"}; + }; +}; + +PRELOAD_ADDONS; + +#include "CfgVehicles.hpp" +#include "CfgEventHandlers.hpp" +#include "Dialog.hpp" +#include "CfgFunctions.hpp" diff --git a/TO_MERGE/ace/sys_cargo/data/rsc/ace_ui_background_ca.paa b/TO_MERGE/ace/sys_cargo/data/rsc/ace_ui_background_ca.paa new file mode 100644 index 0000000000..a2bf2a383e Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/data/rsc/ace_ui_background_ca.paa differ diff --git a/TO_MERGE/ace/sys_cargo/fnc_canLoadCargo.sqf b/TO_MERGE/ace/sys_cargo/fnc_canLoadCargo.sqf new file mode 100644 index 0000000000..040f2af75d --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_canLoadCargo.sqf @@ -0,0 +1,27 @@ +/* +Function: ACE_fnc_canLoadCargo + +Description: + Checks if vehicle is able to load cargo + +Parameters: + _vehicle - Vehicle to load cargo into. [Object] +Returns: + true if _vehicle is able to load cargo, otherwise false. + +Example: + (begin example) + _result = [myTruck] call ACE_fnc_canLoadCargo; + (end) + +Author: + Xeno +*/ + +#include "script_component.hpp" + +PARAMS_1(_vehicle); + +if (isNil "_vehicle" || {isNull _vehicle}) exitWith {false}; + +(getNumber(configFile >> "CfgVehicles" >> typeOf _vehicle >> "ACE_canBeLoad") == 1) \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/fnc_carry.sqf b/TO_MERGE/ace/sys_cargo/fnc_carry.sqf new file mode 100644 index 0000000000..6aa145d305 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_carry.sqf @@ -0,0 +1,153 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +#include "script_component.hpp" + +#define CARRYOFFSET 0.5 + +private["_unit","_action","_box","_pos2","_dir","_modelPos","_params","_track"]; + +if (dialog) then { closeDialog 0; }; + +if (count _this < 2) then { + _params = ["","","",["start", _this select 0]]; +} else { + _params = _this; +}; + +// TODO: Check other interactions, entering a car while carrying something, ladders, dying + +//["","",_action,["stop",_box]] spawn FUNC(carry) + +_unit = player; +_action = (_params select 3) select 0; +_box = (_params select 3) select 1; // TODO: should be (_this select 0) + +switch _action do { + case "start": { + // Monitor Roadway LOD occlusion + _track = true; + + if (_unit getVariable [QGVAR(carrying),false] || {_unit getVariable [QGVAR(dragging),false]}) exitWith { + [localize "STR_ACE_CARGO_ERR_OCC",[1,0,0,1],true,0] spawn ace_fnc_visual; + }; + if (_box getVariable [QGVAR(busy),false]) exitWith { + [localize "STR_ACE_CARGO_ERR_OCC",[1,0,0,1],true,0] spawn ace_fnc_visual; + }; + if ((_unit distance _box) <= 2.5) then { + [objnull,_box,1,1] call FUNC(cbusy); + detach _box; + _safetyCarryOffset = _box getVariable [QGVAR(carryOffsetInc),0]; + _offset = 0.6 + _safetyCarryOffset; + _box attachTo [_unit,[0,_offset,1]]; // Obs: Boxes that have a roadway lod, cause player flying into air. Need to make sure box clips into player to avoid this OR move box that far away so that roadway lod makes no contact with player (0.4 = clipping, 0.7 = outbound) + _unit setVariable [QGVAR(carrying), true, false]; + _unit setVariable [QGVAR(carried_object),_box]; // TODO: Probably should be extended to all stuff we attachto player, so it becomes tracked + _box setDir (_dir - (getDir _unit)); + _unit selectWeapon (primaryWeapon _unit); + _unit switchMove "amovpercmstpslowwrfldnon"; //"amovpercmstpslowwrfldnon_player_idlesteady03"; + _weight = [_box] call FUNC(weight); + [_unit,_weight] call INC_MASS; // TODO: Get Weight + if (_weight > 13) then { + _unit forceWalk true; + }; + // TODO: Move to config properties to automatically decide what to do with special items + + + //Ruckcratechek + if (_box isKindOf "ACE_Rucksack_crate") then { + _box setVectorDirAndUp [[-0.0204803,-0.585819,0.810183],[0.00794978,-0.810423,-0.585792]]; + _track = false; + }; + //Artyshell + if (_box isKindOf "ACE_Arty_ShellHolder") then { + _box setVariable ["ACE_ARTY_OWNER", _unit, true]; + _unit setVariable ["ACE_ARTY_CARRY_SHELL", _box, false]; + _box attachTo [_unit,[0.2,0.5,1.15]]; + _track = false; + }; + + #define ACE_TEXT_RED(Text) ("" + ##Text + "") + + // TODO: Use displayName of carriedObject if it has one.... + _carry_action = _unit addAction[ACE_TEXT_RED((localize "STR_ACE_CARGO_CARRYRELASE")),QPATHTO_F(fnc_carry),["stop",_box],-100,false,false,"","_target == player"]; + _unit setVariable [QGVAR(carrying_action_index),_carry_action]; + //GVAR(drag_keyDownEHId) = (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call ace_sys_cargo_fnc_dragkeydown"]; // Add "C" key down eventhandler + _fired_i = _unit addEventHandler ["fired", {(_this select 0) setVariable ["ace_sys_cargo_forcedrop",true]}]; + _getin_i = _unit addEventhandler ["getin",{(_this select 0) setVariable ["ace_sys_cargo_forcedrop",true];}]; + _unit setVariable [QGVAR(carryFEH),_fired_i]; + _unit setVariable [QGVAR(carryGIH),_getin_i]; + _unit setVariable [QGVAR(forcedrop),false]; + _box setVariable [QUOTE(GVARMAIN(attachedBy)), QUOTE(COMPONENT), true]; + }; + + // Service Loop + while { _unit getVariable QGVAR(carrying) } do { + _bugflyHeight1 = ((getposasl _box) select 2); //diag_log format ["h1: %1",_bugflyHeight1]; + sleep 0.25; + _bugflyHeight2 = ((getposasl _box) select 2); //diag_log format ["h2: %1",_bugflyHeight2]; + _animdrop = !(weaponLowered player); // ["aidlpercmstpsraswrfldnon_idlesteady04","aidlpercmstpsraswrfldnon_aiming01","aidlpercmstpsraswrfldnon_idlesteady02","aidlpercmstpsraswrfldnon_idlesteady03","aidlpercmstpsraswrfldnon_idlesteady01","aidlpercmstpsraswrfldnon_aiming02"]; + _standing = ((_unit call CBA_fnc_getUnitAnim) select 0) in ["stand"]; + _forcedrop = _unit getVariable [QGVAR(forcedrop),false]; + // DBG + //player sidechat format ["%1 %2 %3",_animdrop,_standing,_forcedrop]; + if (!_standing || {_animdrop} || {_forcedrop}) then { ["","",0,["stop",_box]] spawn FUNC(carry) }; + _bugflyRate = (_bugflyHeight2 - _bugflyHeight1) * 4; + //player globalchat format ["%1",_bugflyRate]; + if (_track && {speed _unit == 0} && {_bugflyRate > 10}) then { + _curBoxOffset = _box getVariable [QGVAR(carryOffsetInc),0]; + _newBoxOffset = _curBoxOffset + 0.2; + _box setVariable [QGVAR(carryOffsetInc),_newBoxOffset,true]; // Set new safety carrying offset to avoid further bugging + player setposATL [(getposATL player select 0), (getposATL player select 1), 0]; + ["","",0,["stop",_box]] spawn FUNC(carry); + }; + sleep 0.25; + }; + }; + case "stop": { + if (local _unit) then { localize "STR_ACE_CARGO_DROPPED" call ace_fnc_visual; }; + _box = (_this select 3) select 1; + + _bldg = [_unit,0.1] call ACE_fnc_inBuilding; + + _unit setVariable [QGVAR(carried_pos_end), getPosATL _unit, false]; + + + _posZ = if (_bldg) then { ((_unit modelToWorld [0,0,0]) select 2) - 0.05 } else { (getPosATL _unit) select 2 }; + _pos_end = _unit getVariable [QGVAR(carried_pos_end),(getPosATL _unit)]; + _pos_end set [0,(_pos_end select 0)+(sin (direction _unit) * 1.4)]; + _pos_end set [1,(_pos_end select 1)+(cos (direction _unit) * 1.4)]; + _pos_end set [2,_posZ]; + + detach _box; + _box setPosATL _pos_end; + + _unit setVariable [QGVAR(carried_pos_end), nil, false]; + _unit removeaction (_unit getVariable QGVAR(carrying_action_index)); + _unit setVariable [QGVAR(carrying), false, false]; + + [objnull,_box,0,0] call FUNC(cbusy); + + // Ruckcratecheck + if (_box isKindOf "ACE_Rucksack_crate") then { + _box setVectorDirAndUp [[-0.0204803,-0.585819,0.810183],[0.00794978,-0.810423,-0.585792]]; + }; + //Artyshell + if (_box isKindOf "ACE_Arty_ShellHolder") then { + _box setVariable ["ACE_ARTY_OWNER", nil, true]; + _unit setVariable ["ACE_ARTY_CARRY_SHELL", nil, false]; + }; + + _unit forceWalk false; + _weight = [_box] call FUNC(weight); + [_unit,0] call INC_MASS; // TODO: Get Weight + // Remove "C" key down eventhandler + //(findDisplay 46) displayRemoveEventHandler ["KeyDown", GVAR(drag_keyDownEHId)]; + _unit removeEventhandler ["fired",(_unit getVariable QGVAR(carryFEH))]; + _unit removeEventhandler ["getin",(_unit getVariable QGVAR(carryGIH))]; + _unit setVariable [QGVAR(carryFEH),-1]; + _unit setVariable [QGVAR(carryGIH),-1]; + _unit setVariable [QGVAR(forcedrop),false]; + _box setVariable [QUOTE(GVARMAIN(attachedBy)), "", true]; + }; +}; + +false diff --git a/TO_MERGE/ace/sys_cargo/fnc_carry2.sqf b/TO_MERGE/ace/sys_cargo/fnc_carry2.sqf new file mode 100644 index 0000000000..9550400c23 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_carry2.sqf @@ -0,0 +1,23 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +private "_var"; + +PARAMS_3(_component,_unit,_type); + +switch (_type) do { + case "CARRIER": { + if (_component getVariable [QGVAR(busy),false]) then { + [localize "STR_ACE_CARGO_ERR_OCC",[1,0,0,1],true,0] spawn ace_fnc_visual; + } else { + [_component,_unit,0,["front", "grab"]] execVM QPATHTO_C(ua_carry2.sqf); + }; + }; + case "HELPER": { + [_component,_unit,0,["back", "grab"]] execVM QPATHTO_C(ua_carry2.sqf); + }; +}; + +false diff --git a/TO_MERGE/ace/sys_cargo/fnc_drag.sqf b/TO_MERGE/ace/sys_cargo/fnc_drag.sqf new file mode 100644 index 0000000000..466df43c21 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_drag.sqf @@ -0,0 +1,106 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +#include "script_component.hpp" + +private["_unit","_action","_box","_pos2","_dir","_modelPos","_drag_action","_params","_modelPosZ"]; + +if (dialog) then { closeDialog 0; }; + +if (count _this < 2) then { + _params = ["","","",["start", _this select 0]]; +} else { + _params = _this; +}; + +_unit = player; +_action = (_params select 3) select 0; +_box = (_params select 3) select 1; // TODO: should be (_this select 0) +switch _action do { + case "start": { + if ({alive _x} count (crew _box) > 0) exitWith {}; + //if (_box call CBA_fnc_locked) exitWith {}; + if ((_unit distance _box) > 2.5) exitWith { [localize "STR_ACE_CARGO_ERR_NOWEP",[1,0,0,1],true,0] spawn ace_fnc_visual; }; + if (_unit getVariable [QGVAR(carrying),false] || {_unit getVariable [QGVAR(dragging),false]}) exitWith { + [localize "STR_ACE_CARGO_ERR_OCC",[1,0,0,1],true,0] spawn ace_fnc_visual; + }; + if (_box getVariable [QGVAR(busy),false]) exitWith { + [localize "STR_ACE_CARGO_ERR_OCC",[1,0,0,1],true,0] spawn ace_fnc_visual; + }; + if ((_unit distance _box) <= 2.5) then { + [objnull,_box,1,1] call FUNC(cbusy); + detach _box; + _unit playActionNow "grabDrag"; + _pos2 = getPosATL _box; + _dir = getDir _box; + _modelPos = _unit worldToModel _pos2; //is ATL format + if (_box isKindOf "StaticWeapon") then { + if (typeOf _box in ["ACE_M252","ACE_M224_1","ACE_2b14_82mm","ACE_120Tampella_Baseplate","ACE_120Tampella_Barrel"]) then { _modelPosZ = 0; } else { _modelPosZ = 0.8; }; + } else { _modelPosZ = 0; }; + + + + //_modelPosZ = if (typeOf _box in ["ACE_M252","ACE_M224_1","ACE_2b14_82mm"]) then { 0 }; // Argh!!1: TODO: Fix ACE mortar axis + _box attachTo [_unit,[_modelPos select 0,_modelPos select 1,_modelPosZ],""]; + _unit setVariable [QGVAR(dragging), true, false]; + _unit setVariable [QGVAR(dragged_object),_box]; // TODO: Probably should be extended to all stuff we attachto player, so it becomes tracked + _box setDir (_dir - (getDir _unit)); + //Ruckcratechek + if (_box isKindOf "ACE_Rucksack_crate") then { + _box setVectorDirAndUp [[-0.0204803,-0.585819,0.810183],[0.00794978,-0.810423,-0.585792]]; + }; + _box lock true; + #define ACE_TEXT_RED(Text) ("" + ##Text + "") + _drag_action = _unit addAction [ACE_TEXT_RED((localize "STR_ACE_CARGO_RELASE")),QPATHTO_F(fnc_drag),["stop",_box],-100,false,false,"","_target == player"]; + GVAR(drag_keyDownEHId) = (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call ace_sys_cargo_fnc_dragkeydown"]; // Add "C" key down eventhandler + }; + + waitUntil { animationState _unit == "ACINPKNLMSTPSRASWRFLDNON" }; + + + _weight = ([_box] call FUNC(weight)) * sin 45; + [_unit,_weight] call INC_MASS; + + while { alive _unit && {_unit getVariable QGVAR(dragging)} } do { + sleep 0.5; + + if !(animationState _unit in ["acinpknlmstpsraswrfldnon","acinpknlmwlksraswrfldb"]) exitWith { + _unit setVariable [QGVAR(dragging), false, false]; + _unit setVariable [QGVAR(dragged_object),objNull]; + _unit switchMove "ACINPKNLMSTPSRASWRFLDNON"; + ["","",_drag_action,["stop",_box]] spawn FUNC(drag); + }; + }; + }; + case "stop": { + // Remove "C" key down eventhandler + (findDisplay 46) displayRemoveEventHandler ["KeyDown", GVAR(drag_keyDownEHId)]; + + // Dragging in building?? + _bldg = [_unit,0.1] call ACE_fnc_inBuilding; + + _box = (_this select 3) select 1; + _unit setVariable [QGVAR(dragged_pos_end), getPosATL _box, false]; + _box lock false; + _unit playAction "released"; + detach _box; + _posZ = if (_bldg) then { ((_unit modelToWorld [0,0,0]) select 2) - 0.05 } else { (getPosATL _unit) select 2 }; + _pos_end = _unit getVariable QGVAR(dragged_pos_end); + _box setPosATL [_pos_end select 0, _pos_end select 1, _posZ]; + _unit setVariable [QGVAR(dragged_pos_end), nil, false]; + _unit removeaction (_this select 2); + _unit setVariable [QGVAR(dragging), false, false]; + [objnull,_box,0,0] call FUNC(cbusy); + + // Ruckcratecheck + if (_box isKindOf "ACE_Rucksack_crate") then { + _box setVectorDirAndUp [[-0.0204803,-0.585819,0.810183],[0.00794978,-0.810423,-0.585792]]; + }; + if (_box isKindOf "StaticWeapon") then { + //_box setVariable ["ace_sys_crewserved_pitch",0,true]; + [_box] call ace_sys_crewserved_fnc_setPitch_stored; // Screwsup + }; + [_unit,0] call INC_MASS; + }; +}; + +false diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgAmmo.h b/TO_MERGE/ace/sys_cargo/fnc_exec.sqf similarity index 100% rename from TO_MERGE/cse/sys_ballistics/basicBallistics/CfgAmmo.h rename to TO_MERGE/ace/sys_cargo/fnc_exec.sqf diff --git a/TO_MERGE/ace/sys_cargo/fnc_init.sqf b/TO_MERGE/ace/sys_cargo/fnc_init.sqf new file mode 100644 index 0000000000..b796199983 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_init.sqf @@ -0,0 +1,22 @@ +/* ace_sys_cargo | (c) 2014 by rocko */ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +if (productVersion select 2 <= 110) exitWith {}; + +PARAMS_1(_vehicle); + +_m = getMass _vehicle; +_com = getCenterOfMass _vehicle; +_currentcontent = _vehicle getVariable [QGVAR(content), []]; +if (count _currentcontent > 0) then { + _vehicle setVariable [QGVAR(content), []]; + _error = format["You cannot bypass the loading function for (%1) - ",_vehicle]; TRACE_1("Content hack detected",""); + WARNING(_error); +}; + +_vehicle setVariable [QGVAR(mass),_m]; +_vehicle setVariable [QGVAR(comass),_com]; + +_vehicle setVariable [QGVAR(ready),true]; + diff --git a/TO_MERGE/ace/sys_cargo/fnc_listCargo.sqf b/TO_MERGE/ace/sys_cargo/fnc_listCargo.sqf new file mode 100644 index 0000000000..044638aa65 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_listCargo.sqf @@ -0,0 +1,27 @@ +/* +Function: ACE_fnc_listCargo + +Description: + Lists cargo of a vehicle. + +Parameters: + _vehicle - Vehicle to load cargo into. (Must exist) [Object] +Returns: + Array + +Example: + (begin example) + ["MyTruck"] call ACE_fnc_listCargo; + (end) + +Author: + rocko +*/ + +#include "script_component.hpp" + +PARAMS_1(_vehicle); + +_currentcargo = _vehicle getVariable [QGVAR(content), []]; +TRACE_1("",_currentcargo); +_currentcargo diff --git a/TO_MERGE/ace/sys_cargo/fnc_load.sqf b/TO_MERGE/ace/sys_cargo/fnc_load.sqf new file mode 100644 index 0000000000..33e7d0c5d2 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_load.sqf @@ -0,0 +1,105 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +private["_unit","_action","_box","_pos2","_dir","_modelPos","_drag_action","_params","_process"]; + +if (dialog) then { closeDialog 0; }; + +PARAMS_2(_cargo,_vehicle); + +private "_dragnet"; +// Fix, when a player is dragging an object dragging doesn't stop, +_dragnet = player getVariable [QGVAR(dragging), false]; +if (_dragnet) exitWith { + (localize "STR_ACE_DRAGQUEENSTOP") spawn ace_fnc_visual; +}; +// Box is in process? +if (_cargo getVariable [QGVAR(busy),false]) exitWith { + [localize "STR_ACE_CARGO_ERR_OCC",[1,0,0,1],true,0] spawn ace_fnc_visual; +}; + +// Mexican hidden in a box? +if ({alive _x} count (crew _cargo) > 0) exitWith { (localize "STR_ACE_CARGO_ERR_MEXICO") spawn ace_fnc_visual; }; + +// Store each cargo element loaded into vehicle +_currentcontent = _vehicle getVariable [QGVAR(content), []]; +TRACE_1("Current content",_currentcontent); + +// Weight managment +// Max capacity and weight limits for the vehicle +_volume_vehicle = [_vehicle] call FUNC(volume); +_size_vehicle = sizeOf (typeOf _vehicle); +_weight_vehicle = floor (_volume_vehicle * _size_vehicle * 4); +_weight_vehicle_maxload = floor (_weight_vehicle / 5); +_weight_vehicle_current = 0; +if (count _currentcontent > 0) then { + { + private ["_w"]; + _w = [_x, 0] call FUNC(weight); + _weight_vehicle_current = _weight_vehicle_current + _w; + } foreach _currentcontent; +}; +TRACE_5("V S W Wmax Wcur",_volume_vehicle, _size_vehicle, _weight_vehicle, _weight_vehicle_maxload, _weight_vehicle_current); + +// Max capacity and weight limits for the cargo +_volume_cargo = [_cargo] call FUNC(volume); +_weight_cargo = [_cargo,0] call FUNC(weight); +TRACE_1("",_weight_cargo); + +_loading_allowed = ((_weight_vehicle_maxload - _weight_vehicle_current) >= _weight_cargo); + +TRACE_1("",_loading_allowed); +if !(_loading_allowed) exitWith { (localize "STR_ACE_CARGO_ERR_HEAVY") spawn ace_fnc_visual; }; + +//set busy state for vehicle +[_vehicle,_cargo,1,1] call FUNC(cbusy); + +if (local player) then { + #ifndef DEBUG_MODE_FULL + #define __DELAY ((50/145) * _weight_cargo) // 50 seconds to load a 145kg heavy object alone + _potHelper = (position player) nearEntities ["CaManBase",5] - [player]; + if (player in _potHelper) then { _potHelper = _potHelper - [player] }; + _time = if (count _potHelper > 0) then { __DELAY / 2 } else { __DELAY }; + + player setVariable ["ACE_PB_Result", 0]; + [_time,[localize "STR_ACE_CARGO_LOADING"],true,true] spawn ace_progressbar; + waitUntil { (player getVariable "ACE_PB_Result" != 0) }; + _process = (player getVariable "ACE_PB_Result" == 1); + player setVariable ["ACE_PB_Result", 0]; + #endif + #ifdef DEBUG_MODE_FULL + _process = true; + #endif +}; +if (!_process) exitWith { + // Reset busy state for vehicle + [_vehicle,_cargo,0,0] call FUNC(cbusy); +}; + +// Load +_newcontent = _currentcontent; +_newcontent set [count _newcontent,_cargo]; +TRACE_1("New content", _newcontent); + +_vehicle setVariable [QGVAR(content), _newcontent, true]; // Add cargo variables + +// Store loading position = unloading cargo will make the cargo appear at the same spot where it was when a player loaded it +// Relative to transporter +_cargo setVariable [QGVAR(Distance), (_cargo distance _vehicle), true]; + +// Hide _cargo +// Avoid cargo setPosing in water and accidentally killing it +_cargo_pos = getPosATL _cargo; +#ifndef DEBUG_MODE_FULL // TEST MODE TO CHECK WETHER LOADED OBJECTS ARE DELETED + detach _cargo; + //_cargo setPos [_cargo_pos select 0, _cargo_pos select 1, (_cargo_pos select 2) - 20]; + // Put stuff to [0,0,0] no matter what + _cargo setPos [0,0,0]; +#endif + +// SetVariable +[_cargo,"set"] call FUNC(determineCargo); // Using "set", so data is only stored over net if object is loaded only + +// Reset busy state for vehicle +[_vehicle,_cargo,0,0] call FUNC(cbusy); diff --git a/TO_MERGE/ace/sys_cargo/fnc_loadCargo.sqf b/TO_MERGE/ace/sys_cargo/fnc_loadCargo.sqf new file mode 100644 index 0000000000..dbc7eedc94 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_loadCargo.sqf @@ -0,0 +1,81 @@ +/* +Function: ACE_fnc_loadCargo + +Description: + Load cargo into vehicles. + +Parameters: + _cargo - Cargo object to load. (Must exist) [Array of one or more objects] + _vehicle - Vehicle to load cargo into. (Must exist) [Object] +Returns: + nothing + +Example: + (begin example) + [[myCrate1, myCrate2], myTruck] call ACE_fnc_loadCargo; + (end) + +Author: + rocko +*/ + +#include "script_component.hpp" + +PARAMS_2(_cargo,_vehicle); + +private "_error"; +{ + _preloading_allowed = true; + if (isNull _x) then { _error = format["Cargo (%1) does not exist",_x]; _preloading_allowed = false; TRACE_1("Cargo isNull",""); }; + if (isNil "_x") then { _error = format["Cargo (%1) does not exist",_x]; _preloading_allowed = false; TRACE_1("Cargo isNil",""); }; + if (isNull _vehicle) then { _error = format["Vehicle (%1) does not exist",_vehicle]; _preloading_allowed = false; TRACE_1("Vehicle isNull",""); }; + if (_x getVariable [QGVAR(busy),false]) then { _error = format["Cargo (%1) is busy",_x]; _preloading_allowed = false; TRACE_1("Cargo is busy",""); }; + if ({alive _x} count (crew _x) > 0) then { _error = format["Cargo (%1) has crew",_x]; _preloading_allowed = false; TRACE_1("Cargo is occupied",""); }; + + TRACE_1("Current cargo processed",_x); + _currentcontent = _vehicle getVariable [QGVAR(content), []]; TRACE_1("Current content",_currentcontent); + _volume_vehicle = [_vehicle] call FUNC(volume); + _size_vehicle = sizeOf (typeOf _vehicle); + _weight_vehicle = floor (_volume_vehicle * _size_vehicle * 4); + _weight_vehicle_maxload = floor (_weight_vehicle / 5); + _weight_vehicle_current = 0; + if (count _currentcontent > 0) then { + { + private ["_w"]; + _w = [_x] call FUNC(weight); + _weight_vehicle_current = _weight_vehicle_current + _w; + } foreach _currentcontent; + }; + TRACE_5("VSWWmaxWcur",_volume_vehicle, _size_vehicle, _weight_vehicle, _weight_vehicle_maxload, _weight_vehicle_current); + + _volume_cargo = [_x] call FUNC(volume); TRACE_1("",_volume_cargo); + _weight_cargo = [_x] call FUNC(weight); TRACE_1("",_weight_cargo); + _loading_allowed = ((_weight_vehicle_maxload - _weight_vehicle_current) >= _weight_cargo); TRACE_1("",_loading_allowed); + if (!_loading_allowed) then { _error = format["Weight/Volume of cargo (%1) exceeds allowed values for %2",_x,(typeOf _vehicle)]; }; + if (_loading_allowed && {_preloading_allowed}) then { + _newcontent = _currentcontent; + _newcontent set [count _newcontent,_x]; TRACE_1("New content", _newcontent); + _vehicle setVariable [QGVAR(content), _newcontent, true]; // Add cargo variables + _cargo_pos = getPosATL _x; + detach _x; + // TODO: Test enableSimulation = false; on loaded object + + //_x setPos [_cargo_pos select 0, _cargo_pos select 1, (_cargo_pos select 2) - 20]; TRACE_1("Setpos cargo item",(getPos _x)); + // Put stuff to [0,0,0] no matter what + _x setPos [0,0,0]; + + //_x spawn { // Check if cargo item is below surface + // private "_cargo_item"; + // _cargo_item = _this; + // sleep 5; + // if ((getPos _cargo_item select 2) > 0) then { + // TRACE_1("Item hiding below surface failed, setting to [0,0,0]",""); + // _cargo_item setPos [0,0,0]; // TODO: allowdamage false while on "hiding pos"?? + // }; + //}; + + [_x,"set"] call FUNC(determineCargo); + } else { + WARNING(_error); + }; +} foreach _cargo; \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/fnc_menuDef.sqf b/TO_MERGE/ace/sys_cargo/fnc_menuDef.sqf new file mode 100644 index 0000000000..be911d19f9 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_menuDef.sqf @@ -0,0 +1,206 @@ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +#include "\a3\editor_f\Data\Scripts\dikCodes.h" + +private ["_menuDef", "_target", "_params", "_menuName", "_menuRsc", "_menus"]; +private ["_vehicle", "_displayNameVehicle","_exit","_nearestVehicle"]; +private ["_canDrag","_canPush"]; +private ["_weight"]; + +PARAMS_2(_target,_params); + +_menuDef = []; + +if (typeOf _target == "Weaponholder") exitWith { closeDialog 0; _menuDef }; +// Needs to be fixed in CBA if possible, objects that inherit from any class used for interaction, but should not be able to interacted with, +// e.g class Weaponholder, which inherits from Reammobox! + +_menuName = ""; +_menuRsc = "popup"; + +if (typeName _params == typeName []) then { + if (count _params < 1) exitWith {diag_log format["Error: Invalid params: %1, %2", _this, __FILE__];}; + _menuName = _params select 0; + _menuRsc = if (count _params > 1) then {_params select 1} else {_menuRsc}; +} else { + _menuName = _params; +}; +//----------------------------------------------------------------------------- + +// TODO: Sort functions and scripts! +// Hacked +if (_target isKindOf "ACE_Arty_AimingStakes") exitWith {_menuDef}; + + +// Only allow loading of ammoboxes atm. Later extend to different vehicles (small) or objects +_loadthing = (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> "ACE_canBeLoad") == 1); +_gearthing = (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> "ACE_canGear") == 1); + +// Get exceptional vehicle that can only store gear parts (used in sys_eject - weaponcheck) +// This is used to allow players access the cargo space of non-sys_cargo vehicles! +if (_gearthing) then { + _loadthing = true; +}; + +_cargothing = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> "ACE_canBeCargo") == 1; +_canBeCarried = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> "ACE_canBeCarried") == 1; +_onSling = _target getVariable ["ace_sys_slingload_isLoaded",false]; +TRACE_5("",_target,_loadthing,_cargothing,_gearthing,_canBeCarried); + +if !(_loadthing || {_cargothing} || {_canBeCarried}) exitWith {_menuDef}; + +#define __TMW getNumber(configFile >> "CfgVehicles" >> typeOf _vehicle >> "transportMaxWeapons") +#define __TMM getNumber(configFile >> "CfgVehicles" >> typeOf _vehicle >> "transportMaxMagazines") + +GVAR(target) = _target; + +_displayNameCargo = getText (configFile >> "CfgVehicles" >> typeOf _target >> "displayNameShort"); +if (_displayNameCargo == "") then {_displayNameCargo = typeOf _target}; + +_nearestVehicle = objNull; +if (isNull _target) then {objNull} else { + _ar = nearestObjects [_target, ["Car", "Ship", "Air","Tank"], 8]; + _filter_ar = [_ar, {_x isKindOf "ACE_JerryCan"}] call BIS_fnc_conditionalSelect; + if (count _filter_ar > 0) then { + _ar = _ar - _filter_ar; + }; + if (count _ar > 0) then { _nearestVehicle = _ar select 0 }; +}; +_nearestVehicleDistance = _target distance _nearestVehicle; // Loading distance. Should normally be relatively small +_vehicle = if (!isNull _nearestVehicle && {_nearestVehicleDistance < (2 + (_nearestVehicle call BIS_fnc_boundingCircle)/2)}) then {_nearestVehicle} else {objNull}; + +GVAR(vehicle) = _vehicle; // Set the cargo vehicle to the target, unless a different vehicle was found near + +TRACE_2("TARGET & VEHICLE",_target,_vehicle); + +_vehicleAvailable = !isNull _vehicle && {alive _vehicle}; +if (_vehicleAvailable) then { + _displayNameVehicle = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); + if (_displayNameVehicle == "") then {_displayNameVehicle = typeOf _vehicle}; + TRACE_2("Found",GVAR(vehicle),_vehicleAvailable); + // Check if found vehicle has cargo capacity + if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "ACE_canBeLoad") != 1 || {(__TMW == 0 && {__TMM == 0})} || {_vehicle getVariable [QGVAR(busy),false]}) exitWith { + _vehicleAvailable = false; + TRACE_1("...Vehicle cannot transport anything",""); + TRACE_1("...Vehicle has no cargo space",""); + }; +}; + +// Check wether player isInFront of vehicle or behind it. + +_inFront = if !(isNull GVAR(vehicle)) then { [GVAR(vehicle),player,0.1] call ACE_fnc_inFront; } else { false }; +_currentCargo = _target getVariable [QGVAR(content),[]]; +_currentCargo_front = _target getVariable [QGVAR(content_front),[]]; +_type = [_target,"check"] call FUNC(determineCargo); + +private ["_canLoadFront","_frontLoadFree"]; +if (!isNull GVAR(vehicle)) then { + _frontLoading = GVAR(vehicle) call FUNC(determineFrontCargo); + _canLoadFront = _frontLoading select 0; + _frontLoadFree = _frontLoading select 1; +} else { + _canLoadFront = false; + _frontLoadFree = false; +}; +_isCarryingFrontLoadItem = false; +if (player getVariable [QGVAR(carrying),false]) then { + _frontCargoItem = player getVariable QGVAR(carried_object); + if (getNumber (configFile >> "CfgVehicles" >> typeOf _frontCargoItem >> "ACE_canLoadFront") == 1) then { + _isCarryingFrontLoadItem = true; + }; +}; + +// Carry in pairs stuff +// ---------------------------------- +_helperNear = false; +_helper = objNull; +if (_type in [4,5]) then { + _potHelper = (position player) nearEntities ["CaManBase",5] - [player]; + if (player in _potHelper) then { + _potHelper = _potHelper - [player]; + }; + if (count _potHelper > 0) then { + _isPlayer = false; + { + if (isplayer _x) exitWith { _helperNear = true; _helper = _x; }; /// ADD "!" to 'isplayer check' if TESTING in SP !!!!! + } foreach _potHelper; + }; +}; +// Check if component has a front carrier, so the HELP XX CARRYING option comes alive +_canBeCarriedInPairs = (isNil {_target getVariable [QGVAR(carrier_front), nil]}); + +// Check if component has a back carrier +_hasCarrierBack = (!isNil {_target getVariable [QGVAR(carrier_back), nil]}); +_hasCarrierFront = (!isNil {_target getVariable [QGVAR(carrier_front), nil]}); +// Check if component is busy, i.e about to become loaded into something +_nameCarrierFront = if (_hasCarrierFront) then { name (_target getVariable QGVAR(carrier_front)) } else { "" }; + +TRACE_4("",_canBeCarriedInPairs,_hasCarrierBack,_hasCarrierFront,_nameCarrierFront); + +GVAR(helper) = _helper; TRACE_1("",_helper); + +_menus = [ + [ + ["main", "", _menuRsc], + [ + [format [localize "STR_ACE_CARGO_CARRY",_displayNameCargo], // Carry alone + { [GVAR(target)] spawn FUNC(carry) }, + "", "", "", -1, + //1, ({alive _x} count (crew _target) == 0) && {alive _target} && {_cargothing} && {_type == 1} && {!(_target getVariable [QGVAR(attached_front),false])} && {!(player getVariable [QGVAR(carrying),false])}], + 1, _canBeCarried && {ACE_SELFINTERACTION_RESTRICTED} || {({alive _x} count (crew _target) == 0) && {alive _target} && {_cargothing} && {_type == 1} && {!(_target getVariable [QGVAR(attached_front),false])} && {!(player getVariable [QGVAR(carrying),false])} && {!_onSling} && {ACE_SELFINTERACTION_RESTRICTED}}], + + [format [localize "STR_ACE_CARGO_CARRY2",_displayNameCargo], // Carry in pairs + { [GVAR(target),player, "CARRIER"] spawn FUNC(carry2) }, + "", "", "", -1, + _helperNear, _canBeCarriedInPairs && {alive _target} && {!_hasCarrierFront} && {_cargothing} && {_type in [2,4,5]} && {!(_target getVariable [QGVAR(attached_front),false])} && {!(player getVariable [QGVAR(carrying),false])} && {!_onSling} && {ACE_SELFINTERACTION_RESTRICTED}], + + [format [localize "STR_ACE_CARGO_CARRY2_HELP",_nameCarrierFront], // Carry in pairs Help + { [GVAR(target),player, "HELPER"] spawn FUNC(carry2) }, + "", "", "", -1, + 1, _hasCarrierFront && {!_hasCarrierBack} && {alive _target} && {_cargothing} && {_type in [4,5]} && {!(_target getVariable [QGVAR(attached_front),false])} && {!(player getVariable [QGVAR(carrying),false])} && {ACE_SELFINTERACTION_RESTRICTED}], + + [localize "STR_ACE_CARGO_DRAG", // Drag + { [GVAR(target)] spawn FUNC(drag) }, + "", "", "", -1, + 1, ({alive _x} count (crew _target) == 0) && {alive _target} && {_cargothing} && {(player == vehicle player)} && {_type in [2,5]} && {!_onSling} && {ACE_SELFINTERACTION_RESTRICTED}], + + [format [localize "STR_ACE_CARGO_PUSH",_displayNameCargo], // Push + { [GVAR(target)] spawn FUNC(push) }, + "", "", "", -1, + 1, alive _target && {_cargothing} && {_type == 3} && {!_onSling} && {ACE_SELFINTERACTION_RESTRICTED}], + + [format[localize "STR_ACE_LOADCARGO", _displayNameVehicle], // Loading cargo is now only at the vehicles trunk! + {[GVAR(target),GVAR(vehicle)] spawn FUNC(load) }, + "", "", "", -1, + GVAR(vehicle) != GVAR(target) && {_type in [1,2,4,5]}, _vehicleAvailable && {_cargothing} && {alive _target} && {!_inFront} && {!(player getVariable [QGVAR(carrying),false])} && {!_onSling} && {ACE_SELFINTERACTION_RESTRICTED}], + + ["Attach in front", //TODO: localize // Attaching stuff on the front of the vehicle (looks kool but maybe useless) + {[(player getVariable QGVAR(carried_object)),GVAR(vehicle)] spawn FUNC(attachToFront) }, + "", "", "", -1, + GVAR(vehicle) != GVAR(target), _loadthing && {alive _target} && {_inFront} && {_canLoadFront} && {_isCarryingFrontLoadItem} && {_frontLoadFree} && {!_onSling} && {ACE_SELFINTERACTION_RESTRICTED}], + + [localize "STR_ACE_SHOWCARGO", // Cargo access is now only at the vehicles trunk! + { closeDialog 0; createDialog "ACE_Cargo_List" }, + "", "", "", -1, + count _currentCargo > 0, alive _target && {_loadthing} && {getPos _target select 2 < 2} && {!_inFront} && {ACE_SELFINTERACTION_RESTRICTED}], + + [localize "STR_ACE_SHOWCARGO", // Cargo access for items attached to vehicle front + { closeDialog 0; createDialog "ACE_CargoFront_List" }, + "", "", "", -1, + count _currentCargo_front > 0, alive _target && {_loadthing} && {getPos _target select 2 < 2} && {_inFront} && {ACE_SELFINTERACTION_RESTRICTED}] + ] + ] +]; + +//----------------------------------------------------------------------------- + +{ + if (_x select 0 select 0 == _menuName) exitWith {_menuDef = _x}; +} forEach _menus; + +if (count _menuDef == 0) then { + hintC format ["Error: Menu not found: %1\n%2\n%3", str _menuName, if (_menuName == "") then {_this} else {""}, __FILE__]; + diag_log format ["Error: Menu not found: %1, %2, %3", str _menuName, _this, __FILE__]; +}; + +_menuDef // return value diff --git a/TO_MERGE/ace/sys_cargo/fnc_onload.sqf b/TO_MERGE/ace/sys_cargo/fnc_onload.sqf new file mode 100644 index 0000000000..fc6179826f --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_onload.sqf @@ -0,0 +1,11 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +PARAMS_1(_location); + +TRACE_1("Dialog open ... list",_location); +[_location] call FUNC(view); + +false \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/fnc_push.sqf b/TO_MERGE/ace/sys_cargo/fnc_push.sqf new file mode 100644 index 0000000000..d4f2817473 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_push.sqf @@ -0,0 +1,35 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +PARAMS_1(_target); +_volume = [_target] call FUNC(volume); +_weight = [_target,_volume] call FUNC(weight); + +_push_direction = getDir player; + +_acceleration = 0.02 * _weight; + +_vel = velocity _target; +_pos = getPos _target; + +TRACE_5("",_volume,_weight,_push_direction,_acceleration,_vel); + +_new_vel = [(_vel select 0)+(sin _push_direction*_acceleration),(_vel select 1)+(cos _push_direction*_acceleration),_vel select 2]; +TRACE_1("",_new_vel); + +if (_target isKindOf "Static") then { + _new_pos = [(_pos select 0)+(sin _push_direction*(_acceleration/2)),(_pos select 1)+(cos _push_direction*(_acceleration/2)),_pos select 2]; + _target setPos _new_pos; + _target setPosATL _new_pos; +} else { + [QGVAR(setvel), [_target,_new_vel]] call ACE_fnc_receiverOnlyEvent; +}; +_target spawn { + _target = _this; + sleep 4; + [QGVAR(setvel), [_target,[0,0,0]]] call ACE_fnc_receiverOnlyEvent; + //_pos = getPos _target; + //_target setPos _pos; +}; diff --git a/TO_MERGE/ace/sys_cargo/fnc_unload.sqf b/TO_MERGE/ace/sys_cargo/fnc_unload.sqf new file mode 100644 index 0000000000..da12b7c5e7 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_unload.sqf @@ -0,0 +1,85 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +PARAMS_2(_vehicle,_location); + +private ["_disp", "_ctrl", "_index", "_currentcontent", "_vehicle", "_cargo", "_newcontent", "_hasPlaceholder", "_placeholder", "_pos","_ui","_dir"]; + +_ui = if (_location == "back") then {"ACE_Cargo_List"} else {"ACE_CargoFront_List"}; +_disp = uiNamespace getVariable _ui; +_ctrl = _disp displayCtrl 99; + +_index = lbCurSel _ctrl; +if (_index < 0) exitWith { if (dialog) then { closeDialog 0; }; }; +if (dialog) then {closeDialog 0}; + +// Remove cargo item +_currentcontent = if (_location == "back") then { _vehicle getVariable [QGVAR(content), []] } else { _vehicle getVariable [QGVAR(content_front), []] }; +if (isNil "_currentcontent") exitWith {}; +_cargo = _currentcontent select _index; TRACE_1("Unloading _cargo",_cargo); +if (_cargo in _currentcontent) then { + _newcontent = _currentcontent - [_cargo]; + if (_location == "back") then { + TRACE_1("Unloading cargo from trunk",""); + _vehicle setVariable [QGVAR(content), _newcontent, true]; // Add cargo variables + } else { + TRACE_1("Unloading cargo from front",""); + _vehicle setVariable [QGVAR(content_front), _newcontent, true]; // Add cargo variables + [_cargo] call FUNC(detachFront); + }; + if (count _newcontent < 1) then { + _hasPlaceholder = _vehicle getVariable [QGVAR(hasPlaceholder), false]; + if (_hasPlaceholder) then { + _vehicle setVariable [QGVAR(hasPlaceholder), false, true]; // Reset placeholder variable + _placeholder = _vehicle getVariable QGVAR(POB); + detach _placeholder; + deleteVehicle _placeholder; + }; + }; + _at_player = _cargo getVariable [QGVAR(atplayer),false]; + _distance = if (_at_player) then { 1.5 } else { _cargo getVariable [QGVAR(Distance),4]; }; + if (_location == "back") then { + _dir = if (_at_player) then { getDir player + 180 } else { getDir _vehicle - 180 + (random 20) - (random 20); }; + } else { + _dir = if (_at_player) then { getDir player + 180 } else { getDir _vehicle + (random 20) - (random 20); }; + }; + _posV = if (_at_player) then { getPosATL player; } else { getPosATL _vehicle; }; + _unloadPos = [(_posV select 0) + ((sin _dir) * _distance), (_posV select 1) + ((cos _dir) * _distance),_posV select 2]; + + // TODO: Move to config properties to automatically decide what to do with special items + // Ruckcrate check + if (_cargo isKindOf "ACE_Rucksack_crate") then { + _cargo setVectorDirAndUp [[-0.0204803,-0.585819,0.810183],[0.00794978,-0.810423,-0.585792]]; + _cargo_owner = _cargo getVariable "ACE_SYS_CARGO_OWNER"; + if (_cargo_owner == name player) then { + _backpack = toArray(typeOf _cargo); + for "_x" from ((count _backpack) - 6) to ((count _backpack) - 1) do { + _backpack set [_x, nil]; + }; + _backpack = toString(_backpack); + [_cargo,player,nil,_backpack] execVM "\z\ace\addons\sys_ruck\act_TakeRuck.sqf"; + }; + }; + + if (_cargo isKindOf "StaticWeapon") then { + _cargo setVariable ["ace_sys_crewserved_pitch",0,true]; + }; + + if ([_cargo,""] call FUNC(determineCargo) == 1) then { + if !(player getVariable [QGVAR(carrying),false]) then { + [_cargo] spawn FUNC(carry); + }; + }; + if (surfaceIsWater _unloadPos) then { + _unloadPos set [2, (getPosASL player select 2)]; + _cargo setposASL _unloadPos; + } else { + _cargo setpos _unloadPos; + }; + + player reveal _cargo; +}; + +[_vehicle,objnull,0,0] call FUNC(cbusy); diff --git a/TO_MERGE/ace/sys_cargo/fnc_unloadCargo.sqf b/TO_MERGE/ace/sys_cargo/fnc_unloadCargo.sqf new file mode 100644 index 0000000000..6924290b42 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_unloadCargo.sqf @@ -0,0 +1,46 @@ +/* +Function: ACE_fnc_unloadCargo + +Description: + Unloads cargo from a vehicle. + +Parameters: + _cargo - Cargo object to load. (Must exist) [Array of one or more objects] + _vehicle - Vehicle to load cargo into. (Must exist) [Object] +Returns: + nothing + +Example: + (begin example) + [[myCrate1, myCrate2], myTruck] call ACE_fnc_unloadCargo; + (end) + +Author: + rocko +*/ + +#include "script_component.hpp" + +PARAMS_2(_cargo,_vehicle); +private ["_index", "_currentcontent", "_vehicle", "_cargo", "_newcontent", "_hasPlaceholder", "_placeholder", "_pos"]; + +_currentcontent = _vehicle getVariable QGVAR(content); +if (isNil "_currentcontent") exitWith {}; +{ + if (_x in _currentcontent) then { + _newcontent = _currentcontent - [_x]; + _vehicle setVariable [QGVAR(content), _newcontent, true]; // Add cargo variables + + _dir = getDir _vehicle - 180 + (random 20) - (random 20); + _posV = getPosATL _vehicle; + _unloadPos = [(_posV select 0) + ((sin _dir) * 4), (_posV select 1) + ((cos _dir) * 4),_posV select 2]; + _x setpos _unloadPos; + if (_x isKindOf "ACE_Rucksack_crate") then { + _x setVectorDirAndUp [[-0.0204803,-0.585819,0.810183],[0.00794978,-0.810423,-0.585792]]; + }; + if (_x isKindOf "StaticWeapon") then { + _x setVariable ["ace_sys_crewserved_pitch",0,true]; + }; + }; +} foreach _cargo; +[_vehicle,objnull,0,0] call FUNC(cbusy); diff --git a/TO_MERGE/ace/sys_cargo/fnc_view.sqf b/TO_MERGE/ace/sys_cargo/fnc_view.sqf new file mode 100644 index 0000000000..b06a52cada --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/fnc_view.sqf @@ -0,0 +1,65 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +private ["_disp", "_ctrl", "_currentcargo", "_item", "_typei", "_name", "_pic", "_dummy", "_weight", "_text", "_index","_ui"]; + +PARAMS_1(_location); + +// Prevent viewing of dialog if vehicle is already accessed by other player // TODO: Better not show in interaction menu +if (GVAR(target) getVariable [QGVAR(busy),false]) exitWith { + [] spawn { + sleep 0.1; + if (dialog) then { closeDialog 0 }; + [localize "STR_ACE_CARGO_ERR_OCC",[1,0,0,1],true,0] spawn ace_fnc_visual; + }; +}; + +_ui = if (_location == "back") then {"ACE_Cargo_List"} else {"ACE_CargoFront_List"}; +_disp = uiNamespace getVariable _ui; +_ctrl = _disp displayCtrl 99; +_tit = _disp displayCtrl 30; + +// Set vehicle busy to prevent multi unloading +[GVAR(target),objnull,1,1] call FUNC(cbusy); + +_currentcargo = if (_location == "back") then { GVAR(target) getVariable [QGVAR(content), []] } else { GVAR(target) getVariable [QGVAR(content_front), []] }; +lbClear _ctrl; + +if (count _currentcargo > 0) then { + _dn = getText(configFile >> "CfgVehicles" >> typeOf GVAR(target) >> "displayName"); + _tit ctrlSetText format[localize "STR_DIAG_ACE_CARGO_TITLE",_dn]; + for "_x" from 0 to (count _currentcargo) - 1 do { + _item = _currentcargo select _x; + _typei = typeOf _item; + _name = _item getVariable "ace_sys_cargo_name"; + if (isNil "_name") then { + _name = getText(configFile >> "CfgVehicles" >> _typei >> "displayName"); + }; + _pic = getText (configFile >> "cfgVehicles" >> _typei >> "icon"); + if (_pic == "" || {_pic == "iconThing"}) then { + _pic = "\ca\data\data\Unknown_object.paa"; + }; + _weight = [_item,1] call FUNC(weight); + // Disable low weight stuff + _text = if (_weight <= 5) then { + _name + } else { + format["%1 %2 kg", _name, round _weight] + }; + _index = _ctrl lbAdd _text; + _ctrl lbSetPicture [_index, _pic]; + }; + _ctrl lbSetCurSel 0; +}; + +if (player in crew GVAR(vehicle) || {count _currentcargo == 0} || {player getVariable [QGVAR(carrying),false]}) then { (_disp displayCtrl 10) ctrlEnable false; _disp displayCtrl 10 ctrlCommit 0; }; // Cannot unload from inside + +[] spawn { + while {dialog} do { + sleep 0.1; + }; + [GVAR(target),objnull,0,0] call FUNC(cbusy); +}; + + diff --git a/TO_MERGE/ace/sys_cargo/license.txt b/TO_MERGE/ace/sys_cargo/license.txt new file mode 100644 index 0000000000..7113bf4340 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/license.txt @@ -0,0 +1,79 @@ +License (short) +=============== + +You are free: +- to Share to copy, distribute and transmit the work + +Under the following conditions: +- Attribution You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). +- Noncommercial You may not use this work for commercial purposes. +- No Derivative Works You may not alter, transform, or build upon this work. + +With the understanding that: + +Waiver Any of the above conditions can be waived if you get permission from the copyright holder. + +Public Domain Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. + +Other Rights In no way are any of the following rights affected by the license: + - Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; + - The author's moral rights; + - Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. + +Notice For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. + + +Full license text +================= + +THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. + +BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. + +1. Definitions + +"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. +"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License. +"Distribute" means to make available to the public the original and copies of the Work through sale or other transfer of ownership. +"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. +"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. +"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. +"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. +"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. +"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. +2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. + +3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: + +to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; and, +to Distribute and Publicly Perform the Work including as incorporated in Collections. +The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats, but otherwise you have no rights to make Adaptations. Subject to 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(d). + +4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: + +You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. +You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in connection with the exchange of copyrighted works. +If You Distribute, or Publicly Perform the Work or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work. The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Collection, at a minimum such credit will appear, if a credit for all contributing authors of Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. +For the avoidance of doubt: + +Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; +Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and, +Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b). +Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. +5. Representations, Warranties and Disclaimer + +UNLESS OTHERWISE MUTUALLY AGREED BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. + +6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. Termination + +This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. +Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. +8. Miscellaneous + +Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. +If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. +No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. +This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. +The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. diff --git a/TO_MERGE/ace/sys_cargo/script_component.hpp b/TO_MERGE/ace/sys_cargo/script_component.hpp new file mode 100644 index 0000000000..8aabd2fc1f --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/script_component.hpp @@ -0,0 +1,29 @@ +#define COMPONENT sys_cargo +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_sys_cargo + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_sys_cargo + #define DEBUG_SETTINGS DEBUG_SETTINGS_sys_cargo +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +// #define JERRYCAN_M ACE_JerryCan_M_15 +#define JERRYCAN_W ACE_JerryCan_Dummy_15 +#define JERRYCAN_V ACE_JerryCan_15 + +#define SPARETYRE_W ACE_Spare_Tyre_Dummy +#define SPARETYRE_V ACE_Spare_Tyre + +#define __MAXCARRYVOLUME 0.7 +#define __MAXCARRYWEIGHT 30 //20 +#define __MAXCARRYWEIGHTBY2 145 //200 +#define __MAXDRAGVOLUME 1.5 +#define __MAXDRAGWEIGHT 80 //100 +#define __MAXPUSHVOLUME 3.2 +#define __MAXPUSHWEIGHT 120 +#define __MAXLOADVOLUME 1.7 //ccm +#define __MAXLOADWEIGHT 200 \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/slingload/$PBOPREFIX$ b/TO_MERGE/ace/sys_cargo/slingload/$PBOPREFIX$ new file mode 100644 index 0000000000..7a4828212a --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\sys_cargo\slingload \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/slingload/CfgEventhandlers.hpp b/TO_MERGE/ace/sys_cargo/slingload/CfgEventhandlers.hpp new file mode 100644 index 0000000000..d21e1e0f0f --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/CfgEventhandlers.hpp @@ -0,0 +1,6 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + clientInit = QUOTE(call COMPILE_FILE(XEH_preClientInit)); + }; +}; diff --git a/TO_MERGE/ace/sys_cargo/slingload/CfgMagazines.hpp b/TO_MERGE/ace/sys_cargo/slingload/CfgMagazines.hpp new file mode 100644 index 0000000000..84bd5f1ae2 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/CfgMagazines.hpp @@ -0,0 +1,27 @@ +#define __MASS 0.94 +class CfgMagazines { + class CA_Magazine; + class ACE_Rope_MRL: CA_Magazine { // Base + scope = 1; + displayName = $STR_DN_ACE_ROPE_MRL; + picture = QPATHTO_T(data\equip\m_rope_ca.paa); + model = QPATHTO_M(m_ace_rope.p3d); + type = "3 * 256"; + ammo = "FakeAmmo"; + count = 1; + initSpeed = 0; + maxLeadSpeed = 0; + nameSound = "mine"; + ACE_Weight = 2; // Diameter: 40 mm , Weight: 94 kg / 100 m + ACE_Size = 400; + ACE_NoPack = 1; // Not packable + ACE_SlingRope = 1; + descriptionShort = ""; + }; + class ACE_Rope_M5: ACE_Rope_MRL { + scope = 2; + displayName = $STR_DN_ACE_ROPE_M5; + ACE_Size = 64; + ACE_Weight = 14.3256; + }; +}; diff --git a/TO_MERGE/ace/sys_cargo/slingload/CfgVehicles.hpp b/TO_MERGE/ace/sys_cargo/slingload/CfgVehicles.hpp new file mode 100644 index 0000000000..9794e96d46 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/CfgVehicles.hpp @@ -0,0 +1,101 @@ +class CfgVehicles { + class Thing; + class ACE_Slingrope_L: Thing { + scope = 1; + animated = 0; + displayName = ""; + model=QPATHTO_M(ace_slingrope_L.p3d); + destructype = "Destructno"; + cost = 0; + armor = 999999; + ace_slingrope=1; + XEH_DISABLED; + }; + + class ACE_Slingrope_M: ACE_Slingrope_L { + model=QPATHTO_M(ace_slingrope_M.p3d); + ace_slingrope=1; + }; + + class ACE_Slingrope_P: ACE_Slingrope_L { + model=QPATHTO_M(ace_slingrope_P.p3d); + ace_slingrope=1; + }; + + class ACE_Slingrope: ACE_Slingrope_L { + model=QPATHTO_M(ace_slingrope.p3d); + ace_slingrope=1; + }; + + // GeoLifter points + // Max Load + // Vehicle Weight + // TODO: Correct values + class Air; + class Helicopter: Air { ACE_canLift = 0; }; + class Plane: Air { ACE_canLift = 0; }; + /*class UH60_Base; + class MH60S: UH60_Base { + ACE_canLift = 1; + ACE_GeoLifterAttachment[] = {{0,1.54,-5.1}}; + ACE_MaxLoad = 5886; + ACE_Weight = 5224; + }; + class UH60M_US_base_EP1; + class UH60M_EP1: UH60M_US_base_EP1 { + ACE_canLift = 1; + ACE_GeoLifterAttachment[] = {{0,1.25,-5.25}}; + ACE_MaxLoad = 5886; + ACE_Weight = 5224; + }; + class UH1_Base: Helicopter { + ACE_canLift = 1; + ACE_GeoLifterAttachment[] = {{0,-4.3,-4.9}}; + ACE_MaxLoad = 3000; + ACE_Weight = 5370; + }; + class UH1H_Base: Helicopter { + ACE_canLift = 1; + ACE_GeoLifterAttachment[] = {{0,1.2,-4.8}}; + ACE_MaxLoad = 3000; + ACE_Weight = 5370; + }; + class MV22: Plane { + ACE_canLift = 1; + ACE_GeoLifterAttachment[] = {{0,0,-5.9}}; + ACE_MaxLoad = 6800; + ACE_Weight = 15000; + }; + class Mi24_Base: Helicopter { + ACE_canLift = 1; + ACE_GeoLifterAttachment[] = {{-0.1,2.5,-5.2}}; + ACE_MaxLoad = 2600; + ACE_Weight = 11000; + }; + class Mi17_base: Helicopter { + ACE_canLift = 1; + ACE_GeoLifterAttachment[] = {{0,1.9,-5.5}}; + ACE_MaxLoad = 5900; + ACE_Weight = 7100; + }; + class CH47_base_EP1: Helicopter { + ACE_canLift = 1; + ACE_GeoLifterAttachment[] = {{0,0,-5.6}}; + ACE_MaxLoad = 10000; + ACE_Weight = 12000; + }; + class AH6_Base_EP1; + class MH6J_EP1: AH6_Base_EP1 { + ACE_canLift = 0; + ACE_GeoLifterAttachment[] = {{0,-0.8,0.5}}; + ACE_MaxLoad = 1000; + ACE_Weight = 3370; + }; + /// BAFF + class BAF_Merlin_HC3_D: Helicopter { + ACE_canLift = 1; + ACE_GeoLifterAttachment[] = {{0.2,2.5,-4.9}}; + ACE_MaxLoad = 6000; + ACE_Weight = 11000; + };*/ +}; diff --git a/TO_MERGE/ace/sys_cargo/slingload/CfgWeapons.hpp b/TO_MERGE/ace/sys_cargo/slingload/CfgWeapons.hpp new file mode 100644 index 0000000000..db6ec69286 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/CfgWeapons.hpp @@ -0,0 +1,11 @@ +class CfgWeapons { + class Default; + class Put: Default { + class ACE_Dummy_Utility; + class ace_sys_ravlifter: ACE_Dummy_Utility { + magazines[] = { + "ACE_Rope_MRL","ACE_Rope_M5" + }; + }; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/slingload/XEH_preClientInit.sqf b/TO_MERGE/ace/sys_cargo/slingload/XEH_preClientInit.sqf new file mode 100644 index 0000000000..6b9c90e91b --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/XEH_preClientInit.sqf @@ -0,0 +1,13 @@ +#include "script_component.hpp" + +ADDON = false; +LOG(MSG_INIT); + +PREP(addAction); + +[QGVAR(wh), {player reveal _this}] call CBA_fnc_addEventHandler; +[QGVAR(action), {_this call FUNC(addaction)}] call CBA_fnc_addEventhandler; + +[["LandVehicle","Air","Boat","Thing","StaticWeapon","Reammobox"], [ace_sys_interaction_key], 6, [QPATHTO_F(fnc_menuDef), "main"]] call CBA_ui_fnc_add; + +ADDON = true; diff --git a/TO_MERGE/ace/sys_cargo/slingload/XEH_preInit.sqf b/TO_MERGE/ace/sys_cargo/slingload/XEH_preInit.sqf new file mode 100644 index 0000000000..7c785f3063 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/XEH_preInit.sqf @@ -0,0 +1,12 @@ +#include "script_component.hpp" + +ADDON = false; +LOG(MSG_INIT); + +PREP(hasropemag); + +PREP(attachSlingRopeToHelicopter); +PREP(attachSlingRopeToCargo); +PREP(detachSlingRopeFromCargo); + +ADDON = true; diff --git a/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope.p3d b/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope.p3d new file mode 100644 index 0000000000..23aa8836d3 Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope.p3d differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope_L.p3d b/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope_L.p3d new file mode 100644 index 0000000000..78d0661760 Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope_L.p3d differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope_M.p3d b/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope_M.p3d new file mode 100644 index 0000000000..4e06c0a803 Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope_M.p3d differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope_P.p3d b/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope_P.p3d new file mode 100644 index 0000000000..02334c7ea8 Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/ace_slingrope_P.p3d differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/config.cpp b/TO_MERGE/ace/sys_cargo/slingload/config.cpp new file mode 100644 index 0000000000..b9ba9dfed7 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/config.cpp @@ -0,0 +1,37 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[]= { + "ACE_Slingrope_L", + "ACE_Slingrope_M", + "ACE_Slingrope_P", + "ACE_Slingrope" + }; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "ace_common","ace_c_weapon", "ace_sys_interaction" + }; + version = VERSION; + author[] = {"Rocko"}; + }; + + // Backwards + class ace_sys_ravlifter { + units[]= {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {QUOTE(MAIN_ADDON)}; + version = VERSION; + }; +}; + +PRELOAD_ADDONS; + +#include "CfgVehicles.hpp" +#include "CfgEventhandlers.hpp" +#include "CfgMagazines.hpp" +#include "CfgWeapons.hpp" + + diff --git a/TO_MERGE/ace/sys_cargo/slingload/data/Anilla.paa b/TO_MERGE/ace/sys_cargo/slingload/data/Anilla.paa new file mode 100644 index 0000000000..530dd1cc34 Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/data/Anilla.paa differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/data/ace_rope_co.paa b/TO_MERGE/ace/sys_cargo/slingload/data/ace_rope_co.paa new file mode 100644 index 0000000000..94f934a57a Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/data/ace_rope_co.paa differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/data/equip/m_rope_ca.paa b/TO_MERGE/ace/sys_cargo/slingload/data/equip/m_rope_ca.paa new file mode 100644 index 0000000000..096a14cdfb Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/data/equip/m_rope_ca.paa differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/data/metal8.paa b/TO_MERGE/ace/sys_cargo/slingload/data/metal8.paa new file mode 100644 index 0000000000..c7987e2e81 Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/data/metal8.paa differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/data/soga.paa b/TO_MERGE/ace/sys_cargo/slingload/data/soga.paa new file mode 100644 index 0000000000..1bbd1d5500 Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/data/soga.paa differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/fnc_addAction.sqf b/TO_MERGE/ace/sys_cargo/slingload/fnc_addAction.sqf new file mode 100644 index 0000000000..0d7b49b926 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/fnc_addAction.sqf @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +#define ACE_TEXT_RED(Text) ("" + ##Text + "") + +private ["_helicopter", "_currentAction"]; + +_helicopter = _this; +_currentAction = _helicopter getVariable [QGVAR(cutAction), -1]; + +// Prevent double action +if (_currentAction != -1) then { _helicopter removeAction _currentAction }; + +_action_cut = _helicopter addaction [ACE_TEXT_RED(localize "STR_UA_ACE_RELEASESLING"), QPATHTO_F(ua_release_cargo),_helicopter,99,true,true,"","(driver _target) in _target"]; // err, driver target should always be in target :P +_helicopter setVariable [QGVAR(cutAction), _action_cut]; diff --git a/TO_MERGE/ace/sys_cargo/slingload/fnc_attachSlingRopeToCargo.sqf b/TO_MERGE/ace/sys_cargo/slingload/fnc_attachSlingRopeToCargo.sqf new file mode 100644 index 0000000000..48d935d55c --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/fnc_attachSlingRopeToCargo.sqf @@ -0,0 +1,23 @@ +#include "script_component.hpp" + +PARAMS_1(_cargo); + +if (GVAR(disabled)) exitWith { + _cargo spawn { + private "_magHolder"; + sleep 2; + _magHolder = "WeaponHolder" createVehicle [0,0,0]; + _magholder addMagazineCargoGlobal ["ACE_Rope_M5", 1]; + [QGVAR(wh), _magHolder] call CBA_fnc_globalEvent; + _magHolder setPos [((position _this) select 0) + 2, ((position _this) select 1) + 2, 0]; + }; +}; + +player playmove "AinvPknlMstpSlayWrflDnon_medic"; +sleep 5; +player removeMagazine "ACE_Rope_M5"; +_cargo setVariable [QGVAR(hasSlingRope), true, true]; + +// TODO: Process + +// TODO: Visual attached sling rope to cargo, to indicate something is prepared. diff --git a/TO_MERGE/ace/sys_cargo/slingload/fnc_attachSlingRopeToHelicopter.sqf b/TO_MERGE/ace/sys_cargo/slingload/fnc_attachSlingRopeToHelicopter.sqf new file mode 100644 index 0000000000..42c77dbe43 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/fnc_attachSlingRopeToHelicopter.sqf @@ -0,0 +1,116 @@ +#include "script_component.hpp" + +PARAMS_2(_cargo,_helicopter); + +//TODO: Check if helicopter is already filled with cargo aka soldiers, if so, make sling rope break if speed > 50 +// Cargo becomes damaged and slingrope unuseable + +// TODO: Cargo limits +// TODO: Move to process.sqf ? +_crew = crew _helicopter; +_passengers = []; +{ + if ((assignedVehicleRole _x) select 0 == "CARGO") then { + _passengers set [count _passengers, _x]; + }; +} foreach _crew; +//_passenger_weight = 80 * count _passengers; + +private["_cable","_pp","_reduction","_rel","_slingrope_type"]; + +_bboxHelicopter = boundingBox _helicopter; +_bh = abs((_bboxHelicopter select 0) select 2) + (abs((_bboxHelicopter select 1) select 2) * 1.2); +_lh = abs((_bboxHelicopter select 0) select 0) + abs((_bboxHelicopter select 1) select 0); +_hh = abs((_bboxHelicopter select 0) select 1) + abs((_bboxHelicopter select 1) select 1); +_volumeH = _lh * _bh * _hh; + +_bboxCargo = boundingBox _cargo; +_bc = abs((_bboxCargo select 0) select 0) + abs((_bboxCargo select 1) select 0); +_lc = abs((_bboxCargo select 0) select 1) + abs((_bboxCargo select 1) select 1); +_hc = abs((_bboxCargo select 0) select 2) + abs((_bboxCargo select 1) select 2); +_volumeC = _lc * _bc * _hc; + +_tope = 16; +_abort = false; + +// Find the correct sling rope model +if (_volumeC > 0.001) then { + _rel = _volumeH / _volumeC; + if (_rel >= _tope) then { + _slingrope_type = switch (true) do { + case(_volumeC < 150): {1}; + case (_volumeC < 200): {2}; + default {2}; + }; + if (_rel < 20) then { + _slingrope_type = 1; + _volumeC = (_lc * 100) / _bc; + if (_volumeC > 100) then {_volumeC = _volumeC - 100}; + if (_volumeC > 20) then {_slingrope_type = 2}; + }; + } else { _slingrope_type = 2; }; +}; + +if (_abort) exitWith { + _msg1 = "An error occured with the slingload feature."; + hint _msg1; + #ifdef DEBUG_MODE_FULL + _msg2 = format ["H: %1 C: %2", typeOf _helicopter, typeOf _cargo]; + LOG(_msg1); LOG(_msg2); + #endif +}; + +// Execute the lift + +_Obx = 0; +_Oby = 0; +_Obz = 0; + +_dist = -(_helicopter distance _cargo); +_cargo attachTo [_helicopter, [0,0, _dist + 0]]; +_dir = direction _cargo - direction _helicopter; + +if ("Air" counttype [_cargo] > 0) then { _dir = 0; }; +if ("Ship" counttype [_cargo] > 0) then { _dir = 0; }; +if ("Landvehicle" counttype [_cargo] > 0) then { _dir = 0;_slingrope_type = 1; }; +if ("Motorcycle" counttype [_cargo] > 0) then { _slingrope_type = 1; }; + +_center = getArray(configFile >> "CfgVehicles" >> typeOf _helicopter >> "ACE_GeoLifterAttachment") select 0; +_cx = _center select 0; +_cy = _center select 1; +_cz = _center select 2; + +switch (_slingrope_type) do { + case 1: { + _cable = "ACE_Slingrope_L" createvehicle [0,0,0]; + _cable attachto [_helicopter, [_cx + 0.02,_cy - 0.1,_cz + 0.4]]; + _helicopter setvariable [QGVAR(slingrope), _cable,true]; + _pp = _cable selectionposition "Anclaje"; + _cargo attachto [_cable, [_pp select 0, _pp select 1, _pp select 2]]; + _cargo attachto [_cable, [_Obx+(_pp select 0), _Oby+(_pp select 1), _Obz+(_pp select 2)]]; + _cargo setdir _dir; _cargo setpos getpos _cargo; + _reduction = 1.0025; + }; + case 2: { + _cable = "ACE_Slingrope_M" createvehicle [0,0,0]; + _cable attachto [_helicopter, [_cx,_cy,_cz]]; + _helicopter setvariable [QGVAR(slingrope),_cable,true]; + _pp = _cable selectionposition "Anclaje"; + _cargo attachto [_cable, [_Obx+(_pp select 0), _Oby+(_pp select 1), _Obz+(_pp select 2) + 0.5]]; + _cargo setdir _dir; _cargo setpos getpos _cargo; + _reduction = 1.0050; + }; +}; + +// Set variables +_helicopter setVariable [QGVAR(isTransporting),true,true]; +_helicopter setVariable [QGVAR(cargoHeight),(_cargo modeltoworld [0,0,0]) select 2,true]; +_helicopter setVariable [QGVAR(cargo),_cargo,true]; + +// Visual for helicopter +localize "STR_UA_ACE_CARGOHELIHOOKED" spawn ace_fnc_visual; + +[_helicopter, _reduction, _cargo] spawn COMPILE_FILE(process); // Main process loop // TODO: Evaluate some more events for this + +// Add CUT action for driver of helicopter +[QGVAR(action), _helicopter] call CBA_fnc_globalEvent; diff --git a/TO_MERGE/ace/sys_cargo/slingload/fnc_detachSlingRopeFromCargo.sqf b/TO_MERGE/ace/sys_cargo/slingload/fnc_detachSlingRopeFromCargo.sqf new file mode 100644 index 0000000000..5605c01d48 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/fnc_detachSlingRopeFromCargo.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" + +PARAMS_1(_cargo); + +player playmove "AinvPknlMstpSlayWrflDnon_medic"; +sleep 5; +player addMagazine "ACE_Rope_M5"; +_cargo setVariable [QGVAR(hasSlingRope), false, true]; diff --git a/TO_MERGE/ace/sys_cargo/slingload/fnc_hasropemag.sqf b/TO_MERGE/ace/sys_cargo/slingload/fnc_hasropemag.sqf new file mode 100644 index 0000000000..98a50e5ff5 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/fnc_hasropemag.sqf @@ -0,0 +1,9 @@ +private ["_r"]; + +#include "script_component.hpp" + +_r = ""; +{ + if (getNumber(configFile >> "CfgMagazines" >> _x >> "ACE_SlingRope") == 1) exitWith {_r = _x}; +} forEach magazines player; +_r \ No newline at end of file diff --git a/TO_MERGE/ace/sys_cargo/slingload/fnc_menuDef.sqf b/TO_MERGE/ace/sys_cargo/slingload/fnc_menuDef.sqf new file mode 100644 index 0000000000..521bfcc194 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/fnc_menuDef.sqf @@ -0,0 +1,117 @@ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +#include "\a3\editor_f\Data\Scripts\dikCodes.h" + +private ["_menuDef", "_target", "_params", "_menuName", "_menuRsc", "_menus"]; + +PARAMS_2(_target,_params); + +if (isNil "_target") exitWith {}; +if (isNull _target) exitWith {}; + +if (typeOf _target == "Weaponholder") exitWith { closeDialog 0 }; +// Needs to be fixed in CBA if possible, objects that inherit from any class used for interaction, but should not be able to interacted with, +// e.g class Weaponholder, which inherits from Reammobox! + +_menuName = ""; +_menuRsc = "popup"; + +if (typeName _params == typeName []) then { + if (count _params < 1) exitWith {diag_log format["Error: Invalid params: %1, %2", _this, __FILE__];}; + _menuName = _params select 0; + _menuRsc = if (count _params > 1) then {_params select 1} else {_menuRsc}; +} else { + _menuName = _params; +}; + +//----------------------------------------------------------------------------- +#define __ADD_SLING (localize "STR_UA_ACE_ATTACHROPECARGO") +#define __REM_SLING (localize "STR_UA_ACE_DETACHROPECARGO") +#define __ADD_SLING_HELI (localize "STR_UA_ACE_ATTACHROPECARGOHELI") + +_displayNameCargo = getText (configFile >> "CfgVehicles" >> typeOf _target >> "displayName"); +if (_displayNameCargo == "") then { _displayNameCargo = typeOf _target; }; + +if (_target isKindOf "StaticShip") then {_target = objNull}; // disable LHD, which is a "building"/"strategic"/"StaticShip" + +if (isNull _target) exitWith {}; + +_cargoHasSlingRope = _target getVariable [QGVAR(hasSlingRope), false]; +_cargoIsLoaded = _target getVariable [QGVAR(isLoaded), false]; +_cargoIsEmpty = ({alive _x} count crew _target == 0); +_cargoIsAttachedToSomethingElse = (_target getVariable ["ace_puller_attached",false]); // || _cargo getVariable ["",false]) // TODO: sys_maintenance_towing // TODO: set a more global var then system specific +_playerHasSlingRope = ("ACE_Rope_M5" in magazines player); + +_playerInCargo = vehicle player != player && {player in (vehicle _target)}; +TRACE_5("",_cargoHasSlingRope,_cargoIsLoaded,_cargoIsEmpty,_playerHasSlingRope,_playerInCargo); + +private["_helicopter"]; +_nearestHelicopter = if (isNull _target) then {objNull} else {nearestObject [_target, "Helicopter"]}; +_nearestHelicopterDist = _target distance _nearestHelicopter; +_helicopter = if (!(isNull _nearestHelicopter) && {isEngineOn _nearestHelicopter} && {_nearestHelicopterDist < 11}) then { _nearestHelicopter; } else { objNull; }; // If helicopter is flying and distance to cargo < minDist +// TODO: Might get fuzzy with the fucking LHD crap carrier + +_helicopterAvailable = (alive _helicopter && {!isNull _helicopter}); +TRACE_1("",_helicopterAvailable); + +_displayNameHelicopter = ""; +_helicopterCanLift = false; +_helicopterIsTransporting = true; // true, Failsafe #1 + +if (_helicopterAvailable) then { + _displayNameHelicopter = getText (configFile >> "CfgVehicles" >> typeOf _helicopter >> "displayName"); + if (_displayNameHelicopter == "") then { _displayNameHelicopter = typeOf _helicopter; }; + + _helicopterIsTransporting = _helicopter getVariable [QGVAR(isTransporting), false]; + _helicopterCanLift = (getNumber(configFile >> "CfgVehicles" >> typeOf _helicopter >> "ACE_canLift") == 1); + + TRACE_1("",_displayNameHelicopter); + TRACE_1("",_helicopterIsTransporting); + TRACE_1("",_helicopterCanLift); +}; + +_disable = _helicopter getVariable [QUOTE(ACE_Slingload_Rule),[]]; +if (typeOf _target in _disable) exitWith { + (localize "STR_DN_ACE_HOOKERBLOCKAGE") spawn ACE_fnc_visual; +}; + +_weight = getNumber(configFile >> "CfgVehicles" >> typeOf _helicopter >> "ACE_MaxLoad") > _target call ace_sys_cargo_fnc_weight; // TODO: Alternative mass and/or ACE_Weight + +GVAR(targets) = [_target,_helicopter]; + +// Attach sling rope to x +_menus = +[ + [ + ["main", _displayNameCargo, _menuRsc], + [ + // Attach sling rope to cargo + [__ADD_SLING, + { [(GVAR(targets) select 0)] spawn FUNC(attachSlingRopeToCargo) }, + "", "", "", DIK_N, 1, alive _target && {!_cargoHasSlingRope} && {_playerHasSlingRope} && {!_playerInCargo} && {ACE_SELFINTERACTION_RESTRICTED}], + // Detach sling rope from cargo + [__REM_SLING, + { [(GVAR(targets) select 0)] spawn FUNC(detachSlingRopeFromCargo) }, + "", "", "", DIK_N, 1, alive _target && {_cargoHasSlingRope} && {!_cargoIsLoaded} && {!_playerInCargo} && {ACE_SELFINTERACTION_RESTRICTED}], + // Attach sling rope to helicopter + [format[(__ADD_SLING_HELI+"%1"), (if (_nearestHelicopterDist < 15) then {format[" %1m", (round ((_target distance _nearestHelicopter)*10))/10]} else {""})], + { GVAR(targets) spawn FUNC(attachSlingRopeToHelicopter) }, + "", "", "", DIK_G, + _cargoIsEmpty && {!_cargoIsAttachedToSomethingElse} && {(_helicopterAvailable || {!isNull _nearestHelicopter})} && {!_helicopterIsTransporting} && {_helicopterCanLift} && {_weight}, + alive _target && {_cargoHasSlingRope} && {!_cargoIsLoaded} && {!_playerInCargo} && {ACE_SELFINTERACTION_RESTRICTED}] + ] + ] +]; + +//----------------------------------------------------------------------------- +_menuDef = []; +{ + if (_x select 0 select 0 == _menuName) exitWith {_menuDef = _x}; +} forEach _menus; + +if (count _menuDef == 0) then { + hintC format ["Error: Menu not found: %1\n%2\n%3", str _menuName, if (_menuName == "") then {_this} else {""}, __FILE__]; + diag_log format ["Error: Menu not found: %1, %2, %3", str _menuName, _params, __FILE__]; +}; + +_menuDef // return value diff --git a/TO_MERGE/ace/sys_cargo/slingload/license.txt b/TO_MERGE/ace/sys_cargo/slingload/license.txt new file mode 100644 index 0000000000..7113bf4340 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/license.txt @@ -0,0 +1,79 @@ +License (short) +=============== + +You are free: +- to Share to copy, distribute and transmit the work + +Under the following conditions: +- Attribution You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). +- Noncommercial You may not use this work for commercial purposes. +- No Derivative Works You may not alter, transform, or build upon this work. + +With the understanding that: + +Waiver Any of the above conditions can be waived if you get permission from the copyright holder. + +Public Domain Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. + +Other Rights In no way are any of the following rights affected by the license: + - Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; + - The author's moral rights; + - Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. + +Notice For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. + + +Full license text +================= + +THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. + +BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. + +1. Definitions + +"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. +"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License. +"Distribute" means to make available to the public the original and copies of the Work through sale or other transfer of ownership. +"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. +"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. +"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. +"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. +"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. +"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. +2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. + +3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: + +to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; and, +to Distribute and Publicly Perform the Work including as incorporated in Collections. +The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats, but otherwise you have no rights to make Adaptations. Subject to 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(d). + +4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: + +You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. +You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in connection with the exchange of copyrighted works. +If You Distribute, or Publicly Perform the Work or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work. The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Collection, at a minimum such credit will appear, if a credit for all contributing authors of Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. +For the avoidance of doubt: + +Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; +Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and, +Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b). +Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. +5. Representations, Warranties and Disclaimer + +UNLESS OTHERWISE MUTUALLY AGREED BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. + +6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. Termination + +This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. +Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. +8. Miscellaneous + +Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. +If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. +No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. +This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. +The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. diff --git a/TO_MERGE/ace/sys_cargo/slingload/m_ace_rope.p3d b/TO_MERGE/ace/sys_cargo/slingload/m_ace_rope.p3d new file mode 100644 index 0000000000..61f471e1c6 Binary files /dev/null and b/TO_MERGE/ace/sys_cargo/slingload/m_ace_rope.p3d differ diff --git a/TO_MERGE/ace/sys_cargo/slingload/process.sqf b/TO_MERGE/ace/sys_cargo/slingload/process.sqf new file mode 100644 index 0000000000..f82027e842 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/process.sqf @@ -0,0 +1,27 @@ +#include "script_component.hpp" + +PARAMS_3(_helicopter,_reduc,_cargo); + +/* Would be nice to have the rope animated in such way, that the slingrope between cargo and helicopter changes in length/look etc. +// Set heliocopter higher to align attached load with ground level +_z_cargo = getPosASL _cargo; +_z_helicopter = getPosASL _helicopter; +_z_diff = (_z_helicopter select 2) - (_z_cargo select 2); +_helicopter setPosASL [(_z_helicopter select 0),(_z_helicopter select 1), (_z_helicopter select 2) + _z_diff]; +*/ + +// TODO: Local ? +if (local driver _helicopter) then { + while {(_helicopter getvariable QGVAR(isTransporting)) && {canmove _helicopter} && {alive _helicopter} && {alive driver _helicopter}} do { + _helicopter setvelocity [ + ((velocity _helicopter) select 0)/_reduc, + ((velocity _helicopter) select 1)/_reduc, + ((velocity _helicopter) select 2) + ]; + // TODO: Track damage of cargo and helicopter = Cargo can be shot from slingload + // TODO: Cargo collision + // TODO: Landing event + + sleep 0.05; + }; +}; diff --git a/TO_MERGE/ace/sys_cargo/slingload/script_component.hpp b/TO_MERGE/ace/sys_cargo/slingload/script_component.hpp new file mode 100644 index 0000000000..047543d5ce --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/script_component.hpp @@ -0,0 +1,15 @@ +#define MAINCOMPONENT sys_cargo +#define SUBCOMPONENT slingload + +#define COMPONENT DOUBLES(MAINCOMPONENT,SUBCOMPONENT) +#define ADDONS COMPONENT + +#ifdef MAINCOMPONENT + #ifdef SUBCOMPONENT + #define PATHTO_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\MAINCOMPONENT\SUBCOMPONENT\##var3.sqf + #define PATHTOF_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\MAINCOMPONENT\SUBCOMPONENT\##var3 + #define PATHTOF2_SYS(var1,var2,var3) MAINPREFIX\##var1\SUBPREFIX\MAINCOMPONENT\SUBCOMPONENT\##var3 + #endif +#endif +#include "\z\ace\addons\main\script_mod.hpp" +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/TO_MERGE/ace/sys_cargo/slingload/ua_release_cargo.sqf b/TO_MERGE/ace/sys_cargo/slingload/ua_release_cargo.sqf new file mode 100644 index 0000000000..6b35dcde97 --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/slingload/ua_release_cargo.sqf @@ -0,0 +1,78 @@ +#include "script_component.hpp" + +_helicopter = _this select 3; + +_cargo = _helicopter getvariable QGVAR(cargo); +_altobj = _helicopter getvariable QGVAR(cargoHeight); + +_helicopter setvariable [QGVAR(isTransporting), false, true]; +_helicopter setvariable [QGVAR(cargoHeight), 0]; +_helicopter setvariable [QGVAR(cargo), objnull]; + +// TODO: playsound >clonk< + +// Sling rope is still attached to the cargo + +detach (_helicopter getVariable QGVAR(slingrope)); +detach _cargo; +deleteVehicle (_helicopter getVariable QGVAR(slingrope)); // Delete physical rope object + +_helicopter setVariable [QGVAR(slingrope), objnull]; + +_helicopter removeAction (_helicopter getvariable QGVAR(cutAction)); +_helicopter setVariable [QGVAR(cutAction), -1]; + +if ((getpos _cargo) select 2 < 2) then { + _altfinal = ((getposASL _cargo) select 2) - ((getpos _cargo) select 2); + _cargo setposASL [getpos _cargo select 0, getpos _cargo select 1, _altfinal]; +} else { + _vel = velocity _helicopter; + _retro = _vel select 2; + _altant = (getpos _cargo) select 2; + _cargo setvelocity [_vel select 0, _vel select 1, -1]; + _helicopter setvelocity [_vel select 0, _vel select 1, _retro]; + + _dam = 0.00; + _delay = 0.01; + + sleep 0.25; + + _static = (_cargo isKindOf "Static"); + if (!_static) then { + if ((getpos _cargo select 2) == _altant) then { + _static = true; + }; + }; + + _pos = getPos _cargo; + + // TODO: Possible cause for statics staying in the air? + while {(position _cargo select 2) > 0} do { + if (_dam < 1) then {_dam = _dam + _delay}; + if (_static) then {_cargo setpos [_pos select 0, _pos select 1, (getpos _cargo select 2) - 0.25]}; + sleep _delay; + }; + if (_static) then {_cargo setpos [_pos select 0, _pos select 1, 0]}; + _cargo setdamage (damage _cargo + _dam); +}; + +_cargo setVariable [QGVAR(isLoaded),false,true]; + +// Create slingrope next to cargo object +_cargo spawn { + private ["_magHolder"]; + sleep 2; + _magHolder = "WeaponHolder" createVehicle [0,0,0]; + _magholder addMagazineCargoGlobal ["ACE_Rope_M5", 1]; + [QGVAR(wh), _magHolder] call CBA_fnc_globalEvent; + _magHolder setPos [((position _this) select 0)+2, ((position _this) select 1)+2,0]; +}; +_cargo setVariable [QGVAR(hasSlingRope), false, true]; + +// Unlock +if (_cargo call CBA_fnc_locked) then { + _lockedBefore = _cargo getVariable [QGVAR(locked), false]; + if !(_lockedBefore) then { + [QGVAR(lock), [_cargo, false]] call CBA_fnc_globalEvent; + }; +}; diff --git a/TO_MERGE/ace/sys_cargo/ua_carry2.sqf b/TO_MERGE/ace/sys_cargo/ua_carry2.sqf new file mode 100644 index 0000000000..66e515dd6d --- /dev/null +++ b/TO_MERGE/ace/sys_cargo/ua_carry2.sqf @@ -0,0 +1,192 @@ +/* ace_sys_cargo | (c) 2010,2011 by rocko */ + +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +#define ACE_TEXT_RED(Text) ("" + ##Text + "") + +PARAMS_4(_component,_unit,_id,_ar); + +_position = _ar select 0; +_action = _ar select 1; +if (_component == _unit) then { + _component = _ar select 2; +}; + +TRACE_3("",_position,_action,_component); + +if (isNil QUOTE(FUNC(sease))) then { + FUNC(ease) = { + private "_unit"; + _unit action ["WeaponOnBack", _unit]; + }; +}; + +if (isNil QUOTE(FUNC(sdrop))) then { + FUNC(sdrop) = { + PARAMS_1(_component); + private ["_carrier_front","_carrier_back"]; + _carrier_front = _component getVariable QGVAR(carrier_front); + _carrier_front removeAction GVAR(drop_action); + _carrier_back = _component getVariable QGVAR(carrier_back); + detach _carrier_back; + detach _component; + _component setPosATL [getPos _component select 0, getPos _component select 1, 0]; + _carrier_front setVariable [QGVAR(monitoring),false,true]; + + _component setVariable [QGVAR(carrier_front), nil, true]; + _component setVariable [QGVAR(carrier_back), nil, true]; + TRACE_1("Dropping component",""); + _component setVelocity [0,0,0]; + + { + //_x setVariable ["ace_sys_stamina_mass",0,true]; // The function is bullshit - but why? + [_x,0] call INC_MASS; + _x removeEventhandler ["fired",(_x getVariable QGVAR(carryFEH))]; + _x removeEventhandler ["getin",(_x getVariable QGVAR(carryGIH))]; + _x setVariable [QGVAR(carryFEH),-1]; + _x setVariable [QGVAR(carryGIH),-1]; + _x setVariable [QGVAR(forcedrop),false]; + _x forceWalk false; + _x forceWalk false; + } foreach [_carrier_front,_carrier_back]; + [objnull,_component,0,0] call FUNC(cbusy); + }; +}; + +switch (toLower _action) do { + case "grab": { // GRAB ACTION + switch (toLower _position) do { + case "front": { + _unit setDir direction _component; // Front position is "driver" + _attachPos = if (count getArray(configFile >> "CfgVehicles" >> typeOf _component >> "attachPosFront") > 0) then { + getArray(configFile >> "CfgVehicles" >> typeOf _component >> "attachPosFront") + } else { [0,-0.5,0.5] }; + _component attachTo [_unit, _attachPos, ""]; // Attach component to front carrier + _component setVariable [QGVAR(carrier_front), _unit, true]; // SetVariable front carrier onto component + [objnull,_component,1,1] call FUNC(cbusy); + + // Add "drop" action, GLOBAL, since we handle player only + GVAR(drop_action) = _unit addAction [ + ACE_TEXT_RED((localize "STR_ACE_CARGO_CARRYRELASE")), + "\z\ace\addons\sys_cargo\ua_carry2.sqf", + ["", "drop",_component], + -1,false,true,"","" + ]; // 0 - target, 1 - caller, 2 - id , 3 - ar=[0 - "", 1 - action] + + if (local _unit) then { + _unit setVariable [QGVAR(monitoring), true]; + }; + //_unit call FUNC(ease); // Put weapon on back while carrying in pairs + + // Stamina Boost on taking knee + pushing loaded stretcher up + _weight = ([_component] call FUNC(weight))/2; + [_unit,_weight] call INC_MASS; + //_unit setVariable ["ace_sys_stamina_mass",_weight,false]; // TODO: Fix weight + _fired_i = _unit addEventHandler ["fired", {(_this select 0) setVariable ["ace_sys_cargo_forcedrop",true]}]; + _getin_i = _unit addEventhandler ["getin",{(_this select 0) setVariable ["ace_sys_cargo_forcedrop",true];}]; + _unit setVariable [QGVAR(carryFEH),_fired_i]; + _unit setVariable [QGVAR(carryGIH),_getin_i]; + _unit setVariable [QGVAR(forcedrop),false]; + }; + case "back": { // Back position is following + _attachPos = if (count getArray(configFile >> "CfgVehicles" >> typeOf _component >> "attachPosRear") > 0) then { + getArray(configFile >> "CfgVehicles" >> typeOf _component >> "attachPosRear") + } else { [0,-0.5,0.5] }; + _unit attachTo [(_component getVariable QGVAR(carrier_front)),_attachPos,""]; // Attach helper to the front carrier + _component setVariable [QGVAR(carrier_back), _unit, true]; // SetVariable back carrier to component + + // Stamina Boost on taking knee + pushing loaded stretcher up + _weight = ([_component] call FUNC(weight))/2; + [_unit,_weight] call INC_MASS; + //_unit setVariable ["ace_sys_stamina_mass",_weight,false]; + _fired_i = _unit addEventHandler ["fired", {(_this select 0) setVariable ["ace_sys_cargo_forcedrop",true]}]; + _getin_i = _unit addEventhandler ["getin",{(_this select 0) setVariable ["ace_sys_cargo_forcedrop",true];}]; + _unit setVariable [QGVAR(carryFEH),_fired_i]; + _unit setVariable [QGVAR(carryGIH),_getin_i]; + _unit setVariable [QGVAR(forcedrop),false]; + }; + }; + }; + case "drop": { // Drop action + _component call FUNC(sdrop); + }; +}; + +TRACE_1("",(_unit getVariable QGVAR(monitoring))); + +// Monitoring script for the front carrier +if (_position == "front") then { + _count = 0; + while { _unit getVariable QGVAR(monitoring) } do { // CALLED WHEN USING GRAB ONLY ! + + TRACE_1("While running",""); + + _carrier_front = _component getVariable QGVAR(carrier_front); + _carrier_back = _component getVariable QGVAR(carrier_back); + + // Check for front carrier, when there is no back carrier within 10 seconds, front carrier drops stretcher again + if (_count > 8 && {isNil "_carrier_back"}) then { + _component call FUNC(sdrop); + //_carrier_front removeAction GVAR(drop_action); + if (local _carrier_front) then { localize "STR_ACE_CARGO_DROPPED" call ace_fnc_visual; }; + TRACE_1("Dropping: No helper",""); + }; + + // Check if the front carrier entered a vehicle! TODO + + // While none of the carriers is dead or unconscious nothing happens + if !(alive _carrier_front) then { + _component call FUNC(sdrop); + TRACE_1("Frontcarrier dead",""); + }; + if !(alive _carrier_back) then { + _component call FUNC(sdrop); + TRACE_1("Backcarrier dead",""); + }; + + // Too fast + if ((velocity _carrier_front call ACE_fnc_magnitude) > 5.51) then { + _component call FUNC(sdrop); + if (local _carrier_front) then { localize "STR_ACE_CARGO_DROPPED" call ace_fnc_visual; }; + TRACE_1("Too fast",""); + }; + + // TODO: Carrier front and back are unconsciousnes (i.e back carriers is unconscious and would be dragged in stretcher) + // TODO: Wrong animation: Taking out Binocular, Raising weapon (combat ready), taking a knee, going prone + // Allow tacticool movement for carrying CSWs + _dropConditionAnim = if (_component isKindOf "StaticWeapon") then { ["stand","kneel"] } else { ["stand"] }; + if !(((_carrier_front call CBA_fnc_getUnitAnim) select 0) in _dropConditionAnim) then { + _component call FUNC(sdrop); + if (local _carrier_front) then { localize "STR_ACE_CARGO_DROPPED" call ace_fnc_visual; }; + TRACE_1("Wrong animation",""); + }; + if !(((_carrier_back call CBA_fnc_getUnitAnim) select 0) in _dropConditionAnim) then { + _component call FUNC(sdrop); + if (local _carrier_back) then { localize "STR_ACE_CARGO_DROPPED" call ace_fnc_visual; }; + TRACE_1("Wrong animation Backcarrier",""); + }; + + // TODO: Anything else not allowed, firing, entering vehicles, climbing up ladders + // Ladders + if ((animationState _carrier_front) in ["ladderrifleon","laddercivilon"]) then { + _component call FUNC(sdrop); + if (local _carrier_front) then { localize "STR_ACE_CARGO_DROPPED" call ace_fnc_visual; }; + TRACE_1("Wrong animation: LADDER",""); + }; + //_dropConditionAnim2 = (animationState _unit) in ["aidlpercmstpsraswrfldnon_idlesteady04","aidlpercmstpsraswrfldnon_aiming01","aidlpercmstpsraswrfldnon_idlesteady02","aidlpercmstpsraswrfldnon_idlesteady03","aidlpercmstpsraswrfldnon_idlesteady01","aidlpercmstpsraswrfldnon_aiming02"]; + //if ((animationState _carrier_front) in _dropConditionAnim2) then { + // _component call FUNC(sdrop); + // if (local _carrier_front) then { localize "STR_ACE_CARGO_DROPPED" call ace_fnc_visual; }; + //}; + //if ((animationState _carrier_back) in _dropConditionAnim2) then { + // _component call FUNC(sdrop); + // if (local _carrier_back) then { localize "STR_ACE_CARGO_DROPPED" call ace_fnc_visual; }; + //}; + + sleep 1; + INC(_count); + }; + _unit setVariable [QGVAR(monitoring),false]; + TRACE_1("Carrying aborted",""); +}; diff --git a/TO_MERGE/agm/Captives/agm_cabletie.p3d b/TO_MERGE/agm/Captives/agm_cabletie.p3d deleted file mode 100644 index e0804b8c5f..0000000000 Binary files a/TO_MERGE/agm/Captives/agm_cabletie.p3d and /dev/null differ diff --git a/TO_MERGE/agm/Captives/clientInit.sqf b/TO_MERGE/agm/Captives/clientInit.sqf deleted file mode 100644 index bb7c5ebbb0..0000000000 --- a/TO_MERGE/agm/Captives/clientInit.sqf +++ /dev/null @@ -1,3 +0,0 @@ -// by commy2 - -[missionNamespace, "playerChanged", {_this call AGM_Captives_fnc_handlePlayerChanged}] call AGM_Core_fnc_addCustomEventhandler; diff --git a/TO_MERGE/agm/Captives/config.cpp b/TO_MERGE/agm/Captives/config.cpp deleted file mode 100644 index 56b3f8bc32..0000000000 --- a/TO_MERGE/agm/Captives/config.cpp +++ /dev/null @@ -1,363 +0,0 @@ -class CfgPatches { - class AGM_Captives { - units[] = {}; - weapons[] = {"AGM_CableTie"}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core, AGM_Interaction}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"commy2", "KoffeinFlummi"}; - authorUrl = "https://github.com/commy2/"; - }; -}; - -class CfgFunctions { - class AGM_Captives { - class AGM_Captives { - file = "\AGM_Captives\functions"; - class canFriskPerson; - class canLoadCaptive; - class canUnloadCaptive; - class escortCaptive; - class handleGetOut; - class handleKnockedOut; - class handlePlayerChanged; - class handleWokeUp; - class initPost; - class initUnit; - class loadCaptive; - class openFriskMenu; - class setCaptive; - class surrender; - class unloadCaptive; - }; - }; -}; - -//release escorted captive when entering a vehicle -class Extended_GetIn_EventHandlers { - class All { - class AGM_Captives_AutoDetachCaptive { - getIn = "if (local (_this select 2) && {(_this select 2) getVariable ['AGM_isEscorting', false]}) then {(_this select 2) setVariable ['AGM_isEscorting', false, true]}"; - }; - }; -}; - -//reset captive animation after leaving vehicle -class Extended_GetOut_EventHandlers { - class All { - class AGM_Captives_LeaveVehicle { - getOut = "if (local (_this select 2) && {(_this select 2) getVariable ['AGM_isCaptive', false]}) then {_this call AGM_Captives_fnc_handleGetOut}"; - }; - }; -}; - -//reset captivity and escorting status when getting killed -class Extended_Killed_EventHandlers { - class CAManBase { - class AGM_Captives_AutoDetachCaptive { - killed = "if ((_this select 0) getVariable ['AGM_isCaptive', false]) then {(_this select 0) setVariable ['AGM_isCaptive', false, true]}; if ((_this select 0) getVariable ['AGM_isEscorting', false]) then {(_this select 0) setVariable ['AGM_isEscorting', false, true]};"; - }; - }; -}; - -//handle captive and unconsciousness state -class Extended_Init_EventHandlers { - class CAManBase { - class AGM_Captives_AutoDetachCaptive { - init = "_this call AGM_Captives_fnc_initUnit"; - }; - }; -}; - -//mission start -class Extended_InitPost_EventHandlers { - class CAManBase { - class AGM_Captives_InitPost { - init = "if (local (_this select 0)) then {_this call AGM_Captives_fnc_initPost};"; - }; - }; -}; - -class Extended_PostInit_EventHandlers { - class AGM_Captives { - clientInit = "call compile preprocessFileLineNumbers '\AGM_Captives\clientInit.sqf'"; - }; -}; - -class AGM_Core_canInteractConditions { - class AGM_Interaction_isNotEscorting { - condition = "!(_player getVariable ['AGM_isEscorting', false])"; - }; - class AGM_Interaction_isNotCaptive { - condition = "!(_player getVariable ['AGM_isCaptive', false])"; - }; - class AGM_Interaction_isNotSurrendering { - condition = "!(_player getVariable ['AGM_isSurrender', false])"; - }; -}; - -class CfgVehicles { - class Man; - class CAManBase: Man { - class AGM_Actions { - class AGM_SetCaptive { - displayName = "$STR_AGM_Captives_SetCaptive"; - distance = 4; - condition = "'AGM_CableTie' in items _player && {alive _target} && {!(_target getVariable ['AGM_isCaptive', false])}"; - statement = "player removeItem 'AGM_CableTie'; [_target, true] call AGM_Captives_fnc_setCaptive"; - showDisabled = 0; - priority = 2.4; - icon = "\AGM_Captives\UI\handcuff_ca.paa"; - hotkey = "C"; - }; - class AGM_ReleaseCaptive { - displayName = "$STR_AGM_Captives_ReleaseCaptive"; - distance = 4; - condition = "_target getVariable ['AGM_isCaptive', false] && {isNull (attachedTo _target)}"; - statement = "[_target, false] call AGM_Captives_fnc_setCaptive"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.4; - icon = "\AGM_Captives\UI\handcuff_ca.paa"; - hotkey = "R"; - }; - class AGM_EscortCaptive { - displayName = "$STR_AGM_Captives_EscortCaptive"; - distance = 4; - condition = "_target getVariable ['AGM_isCaptive', false] && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['AGM_isUnconscious', false])}"; - statement = "[_target, true] call AGM_Captives_fnc_escortCaptive"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = "\AGM_Captives\UI\captive_ca.paa"; - priority = 2.3; - hotkey = "E"; - }; - class AGM_StopEscorting { - displayName = "$STR_AGM_Captives_StopEscorting"; - distance = 4; - condition = "_target getVariable ['AGM_isCaptive', false] && {_target in attachedObjects _player}"; - statement = "[_target, false] call AGM_Captives_fnc_escortCaptive"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = "\AGM_Captives\UI\captive_ca.paa"; - priority = 2.3; - hotkey = "E"; - }; - class AGM_LoadCaptive { - displayName = "$STR_AGM_Captives_LoadCaptive"; - distance = 4; - condition = "[_player, _target, objNull] call AGM_Captives_fnc_canLoadCaptive"; - statement = "[_player, _target, objNull] call AGM_Captives_fnc_loadCaptive"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = "\AGM_Captives\UI\captive_ca.paa"; - priority = 2.2; - hotkey = "L"; - }; - class AGM_FriskPerson { - displayName = "$STR_AGM_Captives_FriskPerson"; - distance = 2; - condition = "[_player, _target] call AGM_Captives_fnc_canFriskPerson"; - statement = "[_player, _target] call AGM_Captives_fnc_openFriskMenu"; - showDisabled = 0; - //icon = ""; //@todo - priority = 3; - hotkey = "F"; - }; - }; - - class AGM_SelfActions { - class AGM_StopEscortingSelf { - displayName = "$STR_AGM_Captives_StopEscorting"; - condition = "(_player getVariable ['AGM_escortedUnit', objNull]) getVariable ['AGM_isCaptive', false] && {(_player getVariable ['AGM_escortedUnit', objNull]) in attachedObjects _player}"; - statement = "[_player getVariable ['AGM_escortedUnit', objNull], false] call AGM_Captives_fnc_escortCaptive;"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.3; - hotkey = "C"; - }; - /*class AGM_LoadCaptiveSelf { - displayName = "$STR_AGM_Captives_LoadCaptive"; - condition = "[_player, objNull, objNull] call AGM_Captives_fnc_canLoadCaptiveIntoVehicle"; - statement = "[_player, objNull, objNull] call AGM_Captives_fnc_loadCaptiveIntoVehicle"; - exceptions[] = {"AGM_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.2; - hotkey = "K"; - };*/ - }; - }; - - #define MACRO_LOADUNLOADCAPTIVE \ - class AGM_Actions { \ - class AGM_LoadCaptive { \ - displayName = "$STR_AGM_Captives_LoadCaptive"; \ - distance = 4; \ - condition = "[_player, objNull, _target] call AGM_Captives_fnc_canLoadCaptive"; \ - statement = "[_player, objNull, _target] call AGM_Captives_fnc_loadCaptive"; \ - exceptions[] = {"AGM_Interaction_isNotEscorting"}; \ - showDisabled = 0; \ - priority = 1.2; \ - hotkey = "L"; \ - }; \ - class AGM_UnloadCaptive { \ - displayName = "$STR_AGM_Captives_UnloadCaptive"; \ - distance = 4; \ - condition = "[_player, _target] call AGM_Captives_fnc_canUnloadCaptive"; \ - statement = "[_player, _target] call AGM_Captives_fnc_unloadCaptive"; \ - showDisabled = 0; \ - priority = 1.2; \ - hotkey = "C"; \ - }; \ - }; - - class LandVehicle; - class Car: LandVehicle { - MACRO_LOADUNLOADCAPTIVE - }; - class Tank: LandVehicle { - MACRO_LOADUNLOADCAPTIVE - }; - - class Air; - class Helicopter: Air { - MACRO_LOADUNLOADCAPTIVE - }; - class Plane: Air { - MACRO_LOADUNLOADCAPTIVE - }; - - class Ship; - class Ship_F: Ship { - MACRO_LOADUNLOADCAPTIVE - }; - - class StaticWeapon: LandVehicle { - MACRO_LOADUNLOADCAPTIVE - }; - - class StaticMortar; - class Mortar_01_base_F: StaticMortar { - MACRO_LOADUNLOADCAPTIVE - }; - - #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; - - class Box_NATO_Support_F; - class AGM_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(AGM_CableTie,12) - }; - }; -}; - -class CfgWeapons { - class AGM_ItemCore; - class InventoryItem_Base_F; - - class AGM_CableTie: AGM_ItemCore { - displayName = "$STR_AGM_Captives_CableTie"; - descriptionShort = "$STR_AGM_Captives_CableTieDescription"; - model = "\AGM_Captives\agm_cabletie.p3d"; - picture = "\AGM_Captives\UI\agm_cabletie_x_ca.paa"; - scope = 2; - class ItemInfo: InventoryItem_Base_F { - mass = 1; - }; - }; -}; - -/*class CfgMovesBasic; -class CfgMovesMaleSdr: CfgMovesBasic { - class States { - class CutSceneAnimationBase; - class AmovPercMstpSnonWnonDnon_EaseIn: CutSceneAnimationBase { - head = "headDefault"; - static = 1; - disableWeapons = 0; - forceAim = 0; - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1}; - }; - class AmovPercMstpSnonWnonDnon_Ease: AmovPercMstpSnonWnonDnon_EaseIn { - looped = 1; - InterpolateTo[] = {"Unconscious",0.1}; - }; - class AmovPercMstpSnonWnonDnon_EaseOut: AmovPercMstpSnonWnonDnon_EaseIn { - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1}; - }; - - class AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - }; - - class AmovPercMstpSsurWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - looped = 1; - InterpolateTo[] = {"Unconscious",0.01}; - }; - - class AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; - }; - }; -};*/ - -class CfgMovesBasic { - class Actions { - class CivilStandActions; - class AGM_CivilStandCaptiveActions: CivilStandActions { - turnL = ""; - turnR = ""; - stop = "AGM_AmovPercMstpScapWnonDnon"; - StopRelaxed = "AGM_AmovPercMstpScapWnonDnon"; - default = "AGM_AmovPercMstpScapWnonDnon"; - getOver = ""; - throwPrepare = ""; - throwGrenade[] = {"","Gesture"}; - }; - }; -}; - -class CfgMovesMaleSdr: CfgMovesBasic { - class StandBase; - class States { - class AmovPercMstpSnonWnonDnon: StandBase { - ConnectTo[] += {"AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; - }; - - class CutSceneAnimationBase; - class AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { - actions = "AGM_CivilStandCaptiveActions"; - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; - speed = 1; - looped = 0; - interpolationRestart = 2; - ConnectTo[] = {"AGM_AmovPercMstpScapWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01,"AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - }; - - class AGM_AmovPercMstpScapWnonDnon: AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; - speed = 0; - ConnectTo[] = {"AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01}; - looped = 1; - }; - - class AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { - actions = "CivilStandActions"; - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; - ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01,"AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; - }; - }; -}; - -/* -player playMove "AGM_AmovPercMstpScapWnonDnon"; -player switchMove "AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon"; -*/ diff --git a/TO_MERGE/agm/Captives/functions/fn_canFriskPerson.sqf b/TO_MERGE/agm/Captives/functions/fn_canFriskPerson.sqf deleted file mode 100644 index 77ad6f6446..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_canFriskPerson.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/* - * By: bux578 - * - * Checks the conditions for being able to frisk a unit - * - * Arguments: - * 0: caller (player) (Object) - * 1: target (Object) - * - * Return Value: - * Boolean - */ - -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; - - _target getVariable ["AGM_isCaptive", false] -|| {_target getVariable ["AGM_isSearchable", false]} -|| {_target getVariable ["AGM_isUnconscious", false]} diff --git a/TO_MERGE/agm/Captives/functions/fn_canLoadCaptive.sqf b/TO_MERGE/agm/Captives/functions/fn_canLoadCaptive.sqf deleted file mode 100644 index 637a4889af..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_canLoadCaptive.sqf +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: commy2 - * - * Check if the unit can load the target object into a vehicle. - * - * Argument: - * 0: Unit that wants to load a captive (Object) - * 1: A captive. ObjNull for the first escorted captive (Object) - * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (Object) - * - * Return value: - * Boolean (Bool) - */ - -private ["_unit", "_target", "_vehicle", "_objects"]; - -_unit = _this select 0; -_target = _this select 1; -_vehicle = _this select 2; - -if (isNull _target) then { - _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; - _target = _objects select 0; -}; - -if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10]; - _vehicle = _objects select 0; -}; - -_unit getVariable ["AGM_isEscorting", false] -&& {!isNil "_target"} -&& {!isNil "_vehicle"} -&& {_vehicle emptyPositions "cargo" > 0} diff --git a/TO_MERGE/agm/Captives/functions/fn_canUnloadCaptive.sqf b/TO_MERGE/agm/Captives/functions/fn_canUnloadCaptive.sqf deleted file mode 100644 index 8c52bac0b0..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_canUnloadCaptive.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: commy2 - * - * Check if the unit can unload a captive from the vehicle. - * - * Argument: - * 0: Unit that wants to unload a captive (Object) - * 1: Vehicle to unload a captive from. (Object) - * - * Return value: - * Boolean (Bool) - */ - -private ["_unit", "_vehicle", "_cargo"]; - -_unit = _this select 0; -_vehicle = _this select 1; - -_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. - -_cargo = [_cargo, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; - -count _cargo > 0 diff --git a/TO_MERGE/agm/Captives/functions/fn_escortCaptive.sqf b/TO_MERGE/agm/Captives/functions/fn_escortCaptive.sqf deleted file mode 100644 index 55244cf2f8..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_escortCaptive.sqf +++ /dev/null @@ -1,43 +0,0 @@ -//author : Nic547 -//Attaches a Captive to the player - -private ["_unit", "_state"]; - -_unit = _this select 0; -_state = _this select 1; - -if !("AGM_Handcuffed" in ([_unit] call AGM_Core_fnc_getCaptivityStatus)) exitWith { - [localize "STR_AGM_Captives_NoCaptive"] call AGM_Core_fnc_displayTextStructured; -}; - -if (_state) then { - if (player getVariable ["AGM_isEscorting", false]) exitWith {}; - - [player, _unit] call AGM_Core_fnc_claim; - player setVariable ["AGM_isEscorting", true, true]; - - _unit attachTo [player, [0, 1, 0]]; - - player setVariable ["AGM_escortedUnit", _unit, true]; - _actionID = player addAction [format ["%1", localize "STR_AGM_Captives_StopEscorting"], "[player getVariable ['AGM_escortedUnit', objNull], false] call AGM_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (player getVariable ['AGM_escortedUnit', objNull])"]; - - [_unit, _actionID] spawn { - _unit = _this select 0; - _actionID = _this select 1; - - while {player getVariable ["AGM_isEscorting", false]} do { - sleep 0.2; - - if (!alive _unit || {!alive player} || {!canStand _unit} || {!canStand player} || {_unit getVariable ["AGM_isUnconscious", false]} || {player getVariable ["AGM_isUnconscious", false]} || {!isNull (attachedTo player)}) then { - player setVariable ["AGM_isEscorting", false, true]; - }; - }; - [objNull, _unit] call AGM_Core_fnc_claim; - - detach _unit; - player removeAction _actionID; - }; -} else { - player setVariable ["AGM_isEscorting", false, true]; - player setVariable ["AGM_escortedUnit", objNull, true]; -}; diff --git a/TO_MERGE/agm/Captives/functions/fn_handleGetOut.sqf b/TO_MERGE/agm/Captives/functions/fn_handleGetOut.sqf deleted file mode 100644 index 0cb88b0a8e..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_handleGetOut.sqf +++ /dev/null @@ -1,14 +0,0 @@ -// by commy2 - -private ["_vehicle", "_unit", "_cargoIndex"]; - -_vehicle = _this select 0; -_unit = _this select 2; - -_cargoIndex = _unit getVariable ["AGM_Captives_CargoIndex", -1]; - -if (_cargoIndex != -1) exitWith { - _unit moveInCargo [_vehicle, _cargoIndex]; -}; - -[_unit, 'AGM_AmovPercMstpScapWnonDnon', 2] call AGM_Core_fnc_doAnimation; diff --git a/TO_MERGE/agm/Captives/functions/fn_handlePlayerChanged.sqf b/TO_MERGE/agm/Captives/functions/fn_handlePlayerChanged.sqf deleted file mode 100644 index 5bece824f9..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_handlePlayerChanged.sqf +++ /dev/null @@ -1,12 +0,0 @@ -// by commy2 - -private ["_unit", "_oldUnit"]; - -_unit = _this select 0; -_oldUnit = _this select 1; - -if (_unit getVariable ["AGM_isCaptive", false]) then { - showHUD false; -} else { - showHUD true; -}; diff --git a/TO_MERGE/agm/Captives/functions/fn_handleWokeUp.sqf b/TO_MERGE/agm/Captives/functions/fn_handleWokeUp.sqf deleted file mode 100644 index facbf9b31f..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_handleWokeUp.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// by commy2 - -private "_unit"; - -_unit = _this select 0; - -if (_unit getVariable ["AGM_isCaptive", false] && {vehicle _unit == _unit}) then { - [_unit] call AGM_Core_fnc_fixLoweredRifleAnimation; - [_unit, "AGM_AmovPercMstpScapWnonDnon", 0] call AGM_Core_fnc_doAnimation; -}; diff --git a/TO_MERGE/agm/Captives/functions/fn_initPost.sqf b/TO_MERGE/agm/Captives/functions/fn_initPost.sqf deleted file mode 100644 index 73c9674f7a..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_initPost.sqf +++ /dev/null @@ -1,11 +0,0 @@ -// by commy2 - -private "_unit"; - -_unit = _this select 0; - -// reset status on mission start -if (_unit getVariable ["AGM_isCaptive", false]) then { - _unit setVariable ["AGM_isCaptive", false]; - [_unit, true] call AGM_Captives_fnc_setCaptive; -}; diff --git a/TO_MERGE/agm/Captives/functions/fn_initUnit.sqf b/TO_MERGE/agm/Captives/functions/fn_initUnit.sqf deleted file mode 100644 index 76d4671b7f..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_initUnit.sqf +++ /dev/null @@ -1,12 +0,0 @@ -// by commy2 - -[_this select 0, "knockedOut", { - if (local (_this select 0)) then {_this call AGM_Captives_fnc_handleKnockedOut}; -}] call AGM_Core_fnc_addCustomEventhandler; - -[_this select 0, "wokeUp", { - if (local (_this select 0)) then {_this call AGM_Captives_fnc_handleWokeUp}; -}] call AGM_Core_fnc_addCustomEventhandler; - -// prevent players from throwing grenades -[_this select 0, "Throw", {(_this select 1) getVariable ["AGM_isCaptive", false]}, {}] call AGM_Core_fnc_addActionEventhandler; diff --git a/TO_MERGE/agm/Captives/functions/fn_loadCaptive.sqf b/TO_MERGE/agm/Captives/functions/fn_loadCaptive.sqf deleted file mode 100644 index 12bcb35f9b..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_loadCaptive.sqf +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: commy2 - * - * Unit loads the target object into a vehicle. - * - * Argument: - * 0: Unit that wants to load a captive (Object) - * 1: A captive. ObjNull for the first escorted captive (Object) - * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (Object) - * - * Return value: - * Nothing - */ - -private ["_unit", "_target", "_vehicle", "_objects"]; - -_unit = _this select 0; -_target = _this select 1; -_vehicle = _this select 2; - -if (isNull _target) then { - _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; - _target = _objects select 0; -}; - -if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; - _vehicle = _objects select 0; -}; - -if (!isNil "_target" && {!isNil "_vehicle"}) then { - _unit setVariable ["AGM_isEscorting", false]; - [[_target, _vehicle], "{(_this select 0) moveInCargo (_this select 1); (_this select 0) assignAsCargo (_this select 1); (_this select 0) setVariable ['AGM_Captives_CargoIndex', (_this select 1) getCargoIndex (_this select 0), true];}", _target] call AGM_Core_fnc_execRemoteFnc; -}; diff --git a/TO_MERGE/agm/Captives/functions/fn_openFriskMenu.sqf b/TO_MERGE/agm/Captives/functions/fn_openFriskMenu.sqf deleted file mode 100644 index c7f60ba2e6..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_openFriskMenu.sqf +++ /dev/null @@ -1,70 +0,0 @@ -/* - Name: AGM_Captives_fnc_openFriskMenu - - Author: bux578 - - Description: - Open the select menu with the "personal" items of a frisked unit - It only shows "handgunWeapon", "uniformItems", "vestItems", "backpackItems" and "assignedItems" because every other item is visible on the character - - Parameters: - 0: Object - player unit - 1: Object - unit - - Returns: - Nothing -*/ - -private ["_player", "_unit", "_weapon", "_listedItemClasses", "_actions", "_allGear"]; - -_player = _this select 0; -_unit = _this select 1; - -_weapon = currentWeapon _player; -if (_weapon == primaryWeapon _player && {_weapon != ""}) then { - [_player, "AmovPercMstpSlowWrflDnon", 0] call AGM_Core_fnc_doAnimation; -}; - -_listedItemClasses = []; - -_actions = [localize "STR_AGM_Captives_FriskMenuHeader", localize "STR_AGM_Captives_CancelSelection"] call AGM_Interaction_fnc_prepareSelectMenu; - -_allGear = []; - -if ((handgunWeapon _unit) != "") then { - _allGear pushBack (handgunWeapon _unit); -}; -if (count (uniformItems _unit) > 0) then { - _allGear = _allGear + (uniformItems _unit); -}; -if (count (vestItems _unit) > 0) then { - _allGear = _allGear + (vestItems _unit); -}; -if (count (backpackItems _unit) > 0) then { - _allGear = _allGear + (backpackItems _unit); -}; -if (count (assignedItems _unit) > 0) then { - _allGear = _allGear + (assignedItems _unit); -}; - -// Handgun -// Uniform Items -// Vest Items -// Backpack Items -// Assigned Items -{ - if (!(_x in _listedItemClasses)) then { - private "_item"; - _item = configFile >> "CfgMagazines" >> _x; - if (isNil "_item" || str _item == "") then { //str _item ? - _item = configFile >> "CfgWeapons" >> _x; - }; - _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call AGM_Interaction_fnc_addSelectableItem; - _listedItemClasses pushBack _x; - }; -} forEach (_allGear); - -[_actions, {call AGM_Interaction_fnc_hideMenu;}, {call AGM_Interaction_fnc_hideMenu;}] call AGM_Interaction_fnc_openSelectMenu; - -// don't need an "Ok" Button -ctrlShow [8860, false]; diff --git a/TO_MERGE/agm/Captives/functions/fn_setCaptive.sqf b/TO_MERGE/agm/Captives/functions/fn_setCaptive.sqf deleted file mode 100644 index a2e4ed7e3e..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_setCaptive.sqf +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: Nic547, commy2 - * - * Makes a civilian unable to move. - * - * Argument: - * 0: Unit (Object) - * 1: True to take captive, false to release captive (Object) - * - * Return value: - * Nothing - */ - -private ["_unit", "_state"]; - -_unit = _this select 0; -_state = _this select 1; - -if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call AGM_Core_fnc_execRemoteFnc}; - -if (_state) then { - if (_unit getVariable ["AGM_isCaptive", false]) exitWith {}; - - _unit setVariable ["AGM_isCaptive", true, true]; - - // fix anim on mission start (should work on dedicated servers) - _unit spawn { - [_this, "AGM_Handcuffed", true] call AGM_Core_fnc_setCaptivityStatus; - - if (_this getVariable ["AGM_isCaptive", false] && {vehicle _this == _this}) then { - [_this] call AGM_Core_fnc_fixLoweredRifleAnimation; - [_this, "AGM_AmovPercMstpScapWnonDnon", 0] spawn AGM_Core_fnc_doAnimation; - }; - }; - - _unit setVariable ["AGM_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; - - if (_unit == AGM_player) then { - showHUD false; - }; -} else { - if !(_unit getVariable ["AGM_isCaptive", false]) exitWith {}; - - _unit setVariable ["AGM_isCaptive", false, true]; - [_unit, "AGM_Handcuffed", false] call AGM_Core_fnc_setCaptivityStatus; - if (vehicle _unit == _unit) then { - [_unit, "AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call AGM_Core_fnc_doAnimation; - }; - - if (_unit getVariable ["AGM_Captives_CargoIndex", -1] != -1) then { - _unit setVariable ["AGM_Captives_CargoIndex", -1, true]; - }; - - if (_unit == AGM_player) then { - showHUD true; - }; -}; diff --git a/TO_MERGE/agm/Captives/functions/fn_surrender.sqf b/TO_MERGE/agm/Captives/functions/fn_surrender.sqf deleted file mode 100644 index 9ba1dbcfc2..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_surrender.sqf +++ /dev/null @@ -1,50 +0,0 @@ -// by commy2 - -private ["_unit", "_state"]; - -_unit = _this select 0; -_state = _this select 1; - -if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call AGM_Core_fnc_execRemoteFnc}; - -if (_state) then { - if (_unit getVariable ["AGM_isSurrender", false]) exitWith {}; - - _unit setVariable ["AGM_isSurrender", true, true]; - [_unit, "AGM_Surrendered", true] call AGM_Core_fnc_setCaptivityStatus; - - _unit spawn { - // fix for lowered rifle animation glitch - if (currentWeapon _this != "" && {currentWeapon _this == primaryWeapon _this} && {weaponLowered _this} && {stance _this == "STAND"}) then { - _this playMove "amovpercmstpsraswrfldnon"; - }; - - while {_this getVariable ["AGM_isSurrender", false]} do { - sleep 0.001; //sleep in UI - - if (isPlayer _this) then {showHUD false}; - - if (!alive _this || {_this getVariable ["AGM_isUnconscious", false]}) then { - _this setVariable ["AGM_isSurrender", false, true]; - } else { - _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; - }; - }; - if !(_this getVariable ["AGM_isUnconscious", false]) then { - _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; - } else { - _this playMoveNow "unconscious"; - }; - - [_this, "AGM_Surrendered", false] call AGM_Core_fnc_setCaptivityStatus; - - if (isPlayer _this) then {showHUD true}; - }; -} else { - _unit setVariable ["AGM_isSurrender", false, true]; -}; - -/* -player playMove "AmovPercMstpSsurWnonDnon" -player switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon" -*/ diff --git a/TO_MERGE/agm/Captives/functions/fn_unloadCaptive.sqf b/TO_MERGE/agm/Captives/functions/fn_unloadCaptive.sqf deleted file mode 100644 index e7849f1c0e..0000000000 --- a/TO_MERGE/agm/Captives/functions/fn_unloadCaptive.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: commy2 - * - * Unit unloads a captive from a vehicle. - * - * Argument: - * 0: Unit that wants to unload a captive (Object) - * 1: Vehicle to unload a captive from. (Object) - * - * Return value: - * Nothing - */ - -private ["_unit", "_vehicle", "_cargo", "_target"]; - -_unit = _this select 0; -_vehicle = _this select 1; - -_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. - -_cargo = [_cargo, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; - -if (count _cargo > 0) then { - _target = _cargo select 0; - - _target setVariable ["AGM_Captives_CargoIndex", -1, true]; - - moveOut _target; - [_target, "AGM_AmovPercMstpScapWnonDnon", 2] call AGM_Core_fnc_doAnimation; - [_target, "{unassignVehicle _this}", _target] call AGM_Core_fnc_execRemoteFnc; -}; diff --git a/TO_MERGE/agm/Parachute/clientInit.sqf b/TO_MERGE/agm/Parachute/clientInit.sqf deleted file mode 100644 index 5cd18c3ea8..0000000000 --- a/TO_MERGE/agm/Parachute/clientInit.sqf +++ /dev/null @@ -1,33 +0,0 @@ -/* - Name: AGM_Parachute_fnc_init - - Author: Garth de Wet (LH) - - Description: - Auto called by Arma. - Initialises the parachute system. - - Parameters: - - Returns: - Nothing - - Example: - call AGM_Parachute_fnc_init; -*/ -[] spawn { - AGM_Parachuting_PFH = false; - while {true} do { - sleep 1; - // I believe this doesn't work for Zeus. - // vehicle _player - if (!AGM_Parachuting_PFH && {(vehicle AGM_player) isKindOf "ParachuteBase"}) then { - AGM_Parachuting_PFH = true; - ["AGM_ParachuteFix", "OnEachFrame", {call AGM_Parachute_fnc_onEachFrame;}] call BIS_fnc_addStackedEventHandler; - }; - }; -}; - -// don't show speed and height when in expert mode -["Parachute", {if (!cadetMode) then {_dlg = _this select 0; {(_dlg displayCtrl _x) ctrlShow false} forEach [121, 122, 1004, 1005, 1006, 1014];};}] call AGM_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Parachute" -["Soldier", {if (!cadetMode) then {_dlg = _this select 0; {_ctrl = (_dlg displayCtrl _x); _ctrl ctrlSetPosition [0,0,0,0]; _ctrl ctrlCommit 0;} forEach [380, 382]};}] call AGM_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier" diff --git a/TO_MERGE/agm/Parachute/config.cpp b/TO_MERGE/agm/Parachute/config.cpp deleted file mode 100644 index 78a3f42f75..0000000000 --- a/TO_MERGE/agm/Parachute/config.cpp +++ /dev/null @@ -1,90 +0,0 @@ -class CfgPatches { - class AGM_Parachute { - units[] = {"AGM_NonSteerableParachute"}; - weapons[] = {"AGM_Altimeter"}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"Garth 'LH' de Wet"}; - }; -}; - -class CfgFunctions { - class AGM_Parachute { - class AGM_Parachute { - file = "\AGM_Parachute\functions"; - class onEachFrame; - class doLanding; - class hideAltimeter; - class showAltimeter; - }; - }; -}; - -class Extended_PostInit_EventHandlers { - class AGM_Parachute { - clientInit = "call compile preprocessFileLineNumbers '\AGM_Parachute\clientInit.sqf';"; - }; -}; - -class AGM_Core_Default_Keys { - class showAltimeterNew { - displayName = "$STR_AGM_Parachute_showAltimeter"; - condition = "'AGM_Altimeter' in assignedItems _player"; - statement = "if (isNull (missionNamespace getVariable ['AGM_Parachute_AltimeterFnc', scriptNull])) then {[_player] call AGM_Parachute_fnc_showAltimeter} else {call AGM_Parachute_fnc_hideAltimeter}"; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Medical_canTreat", "AGM_Interaction_isNotEscorting"}; - key = 24; - shift = 0; - control = 0; - alt = 0; - }; -}; - -#include "RscTitles.hpp" - -class CfgWeapons { - class ItemWatch; - class AGM_Altimeter:ItemWatch { - author = "$STR_AGM_Core_AGMTeam"; - descriptionShort = "$STR_AGM_Parachute_AltimeterDescription"; - displayName = "$STR_AGM_Parachute_AltimeterDisplayName"; - picture = "\AGM_Parachute\UI\watch_altimeter.paa"; - }; -}; - -class CfgVehicles { - class Box_NATO_Support_F; - class AGM_Box_Misc: Box_NATO_Support_F { - class TransportItems { - class _xx_AGM_Altimeter { - name = "AGM_Altimeter"; - count = 6; - }; - }; - class TransportBackpacks { - class _xx_AGM_NonSteerableParachute { - backpack = "AGM_NonSteerableParachute"; - count = 4; - }; - }; - }; - - class B_Parachute; - class AGM_NonSteerableParachute: B_Parachute { - author = "$STR_AGM_Core_AGMTeam"; - scope = 2; - displayName = "$STR_AGM_Parachute_NonSteerableParachute"; - //picture = "\A3\Characters_F\data\ui\icon_b_parachute_ca.paa"; // @todo - //model = "\A3\Weapons_F\Ammoboxes\Bags\Backpack_Parachute"; // @todo - backpackSimulation = "ParachuteNonSteerable"; //ParachuteSteerable - ParachuteClass = "NonSteerable_Parachute_F"; - maximumLoad = 0; - mass = 100; - }; - - class B_Soldier_05_f; class B_Pilot_F: B_Soldier_05_f {backpack = "AGM_NonSteerableParachute";}; - class I_Soldier_04_F; class I_pilot_F: I_Soldier_04_F {backpack = "AGM_NonSteerableParachute";}; - class O_helipilot_F; class O_Pilot_F: O_helipilot_F {backpack = "AGM_NonSteerableParachute";}; -}; diff --git a/TO_MERGE/agm/Parachute/functions/fn_doLanding.sqf b/TO_MERGE/agm/Parachute/functions/fn_doLanding.sqf deleted file mode 100644 index a4d4cf9f81..0000000000 --- a/TO_MERGE/agm/Parachute/functions/fn_doLanding.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/* - Name: AGM_Parachute_fnc_doLanding - - Author: Garth de Wet (LH) - - Description: - Performs the landing animation fix - - Parameters: - 0: OBJECT - unit - - Returns: - Nothing - - Example: - [player] call AGM_Parachute_fnc_doLanding; -*/ -_unit = _this select 0; -["AGM_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler; -AGM_Parachuting_PFH = false; -[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call AGM_Core_fnc_doAnimation; -[_unit] spawn { - sleep 1; - (_this select 0) playActionNow "Crouch"; -}; \ No newline at end of file diff --git a/TO_MERGE/agm/Parachute/functions/fn_hideAltimeter.sqf b/TO_MERGE/agm/Parachute/functions/fn_hideAltimeter.sqf deleted file mode 100644 index 4144789613..0000000000 --- a/TO_MERGE/agm/Parachute/functions/fn_hideAltimeter.sqf +++ /dev/null @@ -1,18 +0,0 @@ -/* - Name: AGM_Parachute_fnc_hideAltimeter - - Author: Garth de Wet (LH) - - Description: - Removes the altimeter from the screen. - - Parameters: - - Returns: - Nothing - - Example: - call AGM_Parachute_fnc_hideAltimeter -*/ -terminate AGM_Parachute_AltimeterFnc; -(["AGM_Altimeter"] call BIS_fnc_rscLayer) cutText ["","PLAIN",0,true]; diff --git a/TO_MERGE/agm/Parachute/functions/fn_onEachFrame.sqf b/TO_MERGE/agm/Parachute/functions/fn_onEachFrame.sqf deleted file mode 100644 index 367396d8ac..0000000000 --- a/TO_MERGE/agm/Parachute/functions/fn_onEachFrame.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/* - Name: AGM_Parachute_fnc_onEachFrame - - Author: Garth de Wet (LH) - - Description: - Checks if a unit can defuse an explosive - - Parameters: - 0: OBJECT - unit - - Returns: - Nothing - - Example: - call AGM_Parachute_fnc_onEachFrame; -*/ -private "_player"; -_player = AGM_player; -if (isNull _player) exitWith {["AGM_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler;AGM_Parachuting_PFH = false;}; -if !((vehicle _player) isKindOf "ParachuteBase") exitWith {}; -if (isTouchingGround _player) exitWith {}; - -private ["_pos", "_intersects"]; -_pos = getPosASL (Vehicle _player); - -if ((lineIntersects [_pos, _pos vectorAdd [0,0,-0.5], vehicle _player, _player]) || {((ASLtoATL _pos) select 2) < 0.75}) then { -// I believe this will not work for Zeus units. - deleteVehicle (vehicle _player); - [_player] call AGM_Parachute_fnc_doLanding; -}; diff --git a/TO_MERGE/agm/Parachute/functions/fn_showAltimeter.sqf b/TO_MERGE/agm/Parachute/functions/fn_showAltimeter.sqf deleted file mode 100644 index c7547335c0..0000000000 --- a/TO_MERGE/agm/Parachute/functions/fn_showAltimeter.sqf +++ /dev/null @@ -1,52 +0,0 @@ -/* - Name: AGM_Parachute_fnc_showAltimeter - - Author: Garth de Wet (LH) - - Description: - Displays the altimeter on screen. - - Parameters: - 0: OBJECT - unit to track for the altimeter - - Returns: - Nothing - - Example: - [player] call AGM_Parachute_fnc_showAltimeter -*/ -private ["_unit"]; -_unit = _this select 0; -(["AGM_Altimeter"] call BIS_fnc_rscLayer) cutRsc ["AGM_Altimeter", "PLAIN",0,true]; -if (isNull (uiNamespace getVariable ["AGM_Altimeter", displayNull])) exitWith {}; - -AGM_Parachute_AltimeterFnc = [uiNamespace getVariable ["AGM_Altimeter", displayNull], _unit] spawn { - private ["_height", "_hour", "_minute", "_descentRate"]; - _unit = _this select 1; - _height = floor ((getPosASL _unit) select 2); - _oldHeight = _height; - _descentRate = 0; - _hour = floor daytime; - _minute = floor ((daytime - _hour) * 60); - disableSerialization; - private ["_HeightText", "_DecendRate", "_TimeText", "_prevTime", "_curTime"]; - _HeightText = (_this select 0) displayCtrl 1100; - _DecendRate = (_this select 0) displayCtrl 1000; - _TimeText = (_this select 0) displayCtrl 1001; - _curTime = time; - _prevTime = _curTime; - while {true} do { - _TimeText ctrlSetText (format ["%1:%2",[_hour, 2] call AGM_Core_fnc_numberToDigitsString,[_minute, 2] call AGM_Core_fnc_numberToDigitsString]); - _HeightText ctrlSetText (format ["%1", floor(_height)]); - _DecendRate ctrlSetText (format ["%1", _descentRate max 0]); - sleep 0.2; - _height = (getPosASL _unit) select 2; - _curTime = time; - _descentRate = floor ((_oldHeight - _height) / (_curTime - _prevTime)); - _oldHeight = _height; - _prevTime = _curTime; - - // close altimeter, @todo _unit can change due to team switch, zeus! - if !("AGM_Altimeter" in assignedItems _unit) exitWith {call AGM_Parachute_fnc_hideAltimeter}; - }; -}; diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgFunctions.h b/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgFunctions.h deleted file mode 100644 index 463b661da6..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgFunctions.h +++ /dev/null @@ -1,11 +0,0 @@ -class CfgFunctions { - class CSE { - class WindDeflection { - file = "cse\cse_sys_ballistics\basicBallistics\functions"; - class handleFired_DEFLECT { recompile = 1; }; - class onWeatherMeterOpened_DEFLECT { recompile = 1; }; - class weatherMeterOpenWindView_DEFLECT { recompile = 1; }; - class weatherMeterOpenWeatherView_DEFLECT { recompile = 1; }; - }; - }; -}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgMagazines.h b/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgMagazines.h deleted file mode 100644 index fbfb6f9372..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgMagazines.h +++ /dev/null @@ -1,15 +0,0 @@ -class CfgMagazines { - class Default; - class CA_magazine: Default{}; - class cse_weather_meter: CA_magazine { - scope = 2; - value = 1; - count = 1; - type = 16; - displayName = "Weather Meter (GREEN)"; - picture = "\cse\cse_sys_ballistics\basicBallistics\data\pocket_weather_meter_day_green.paa"; - descriptionShort = "Provides information about weather and wind"; - descriptionUse = "Provides information about humidity, wind speed, direction and strenght."; - mass = 5; - }; -}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgVehicles.h b/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgVehicles.h deleted file mode 100644 index 568af426ef..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgVehicles.h +++ /dev/null @@ -1,31 +0,0 @@ -class CfgVehicles { - class Logic; - class Module_F: Logic { - class ArgumentsBaseUnits { - }; - }; - class cse_sys_winddeflection: Module_F { - scope = 2; - displayName = "Basic Ballistics [CSE]"; - icon = "\cse\cse_main\data\cse_rifle_module.paa"; - category = "cseModules"; - function = "cse_fnc_initalizeModule_F"; - functionPriority = 1; - isGlobal = 1; - isTriggerActivated = 0; - class Arguments { - class forAI { - displayName = "Enable for AI"; - description = "Should the module be enabled for AI"; - typeName = "BOOL"; - defaultValue = 0; - }; - class allowNonLocal { - displayName = "Non Local"; - description = "Should the module be enabled for non local units"; - typeName = "BOOL"; - defaultValue = 0; - }; - }; - }; -}; diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgWeapons.h b/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgWeapons.h deleted file mode 100644 index 7950800aba..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/CfgWeapons.h +++ /dev/null @@ -1,18 +0,0 @@ -class CfgWeapons { - class Default; - class cse_weather_meter: Default { - author = "Combat Space Enhancement"; - scope = 2; - displayName = "Weather Meter"; - picture = "\cse\cse_sys_ballistics\basicBallistics\data\weatherMeter.paa"; - descriptionShort = "Provides information about weather and wind"; - descriptionUse = "Provides information about humidity, wind speed, direction and strenght."; - model = "\A3\weapons_F\ammo\mag_univ.p3d"; - simulation = "Weapon"; - class ItemInfo - { - mass = 10; - }; - }; - -}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/Combat_Space_Enhancement.h b/TO_MERGE/cse/sys_ballistics/basicBallistics/Combat_Space_Enhancement.h deleted file mode 100644 index 05dbf8b31d..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/Combat_Space_Enhancement.h +++ /dev/null @@ -1,34 +0,0 @@ -#define MENU_KEYBINDING 1 -#define ACTION_KEYBINDING 2 -#define CLIENT_SETTING 3 - -class Combat_Space_Enhancement { - class cfgModules { - class cse_sys_winddeflection { - init = "call compile preprocessFile 'cse\cse_sys_ballistics\basicBallistics\init_sys_winddeflection.sqf';"; - name = "Wind Deflection"; - class EventHandlers { - class CAManBase { - fired = "_this call cse_fnc_handleFired_DEFLECT; false"; - }; - }; - class Configurations { - class check_wind_direction { - type = ACTION_KEYBINDING; - title = "Check Wind Direction"; - description = "Displays a hint with the current wind direction and speed."; - value[] = {0,0,0,0}; - onPressed = "[] call cse_fnc_checkWindDir_WIND;"; - }; - class open_weather_meter { - type = ACTION_KEYBINDING; - title = "Open the Weather Meter"; - description = "When you have the weather meter in your inventory, pressing this key will open the menu, showing you the current weather information."; - value[] = {0,0,0,0}; - onPressed = "if (([player,'cse_weather_meter'] call cse_fnc_hasMagazine)) then { createDialog 'cse_weather_meter'; }; "; - idd = 65423; - }; - }; - }; - }; -}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/GUI.h b/TO_MERGE/cse/sys_ballistics/basicBallistics/GUI.h deleted file mode 100644 index e27240144e..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/GUI.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "gui\define.hpp" -#include "gui\weather_meter.hpp" \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/config.cpp b/TO_MERGE/cse/sys_ballistics/basicBallistics/config.cpp deleted file mode 100644 index 583105bed7..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/config.cpp +++ /dev/null @@ -1,26 +0,0 @@ -class CfgPatches { - class cse_sys_winddeflection { - units[] = {}; - weapons[] = {}; - requiredVersion = 1.0; - requiredAddons[] = {"cse_f_eh","cse_main"}; - versionDesc = "CSE Wind Deflection"; - version = "0.10.0_rc"; - author[] = {"Combat Space Enhancement"}; - authorUrl = "http://csemod.com"; - }; -}; - -class cse_sys_winddeflection { - class PreloadAddons { - class cse_sys_winddeflection { - list[] = {"cse_sys_winddeflection"}; - }; - }; -}; -#include "CfgAmmo.h" -#include "CfgVehicles.h" -#include "CfgMagazines.h" -#include "CfgFunctions.h" -#include "Combat_Space_Enhancement.h" -#include "GUI.h" \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/data/icon_weather_meter.paa b/TO_MERGE/cse/sys_ballistics/basicBallistics/data/icon_weather_meter.paa deleted file mode 100644 index bc2395644d..0000000000 Binary files a/TO_MERGE/cse/sys_ballistics/basicBallistics/data/icon_weather_meter.paa and /dev/null differ diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/data/pocket_weather_meter_day_green.paa b/TO_MERGE/cse/sys_ballistics/basicBallistics/data/pocket_weather_meter_day_green.paa deleted file mode 100644 index ed990f53cb..0000000000 Binary files a/TO_MERGE/cse/sys_ballistics/basicBallistics/data/pocket_weather_meter_day_green.paa and /dev/null differ diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/data/pocket_weather_meter_night_green.paa b/TO_MERGE/cse/sys_ballistics/basicBallistics/data/pocket_weather_meter_night_green.paa deleted file mode 100644 index c13719e9bb..0000000000 Binary files a/TO_MERGE/cse/sys_ballistics/basicBallistics/data/pocket_weather_meter_night_green.paa and /dev/null differ diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/data/weatherMeter.paa b/TO_MERGE/cse/sys_ballistics/basicBallistics/data/weatherMeter.paa deleted file mode 100644 index 51d2b9491d..0000000000 Binary files a/TO_MERGE/cse/sys_ballistics/basicBallistics/data/weatherMeter.paa and /dev/null differ diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_handleFired_DEFLECT.sqf b/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_handleFired_DEFLECT.sqf deleted file mode 100644 index fb7ec63952..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_handleFired_DEFLECT.sqf +++ /dev/null @@ -1,102 +0,0 @@ -/** - * CSE fnc HandleFired DEFLECT. - * Handles wind deflection for projectiles. - * Is expected to be triggered by the fired eventhandler from BI. - * - * Params: - * 1. unit: Object - Object the event handler is assigned to - * 2. weapon: String - Fired weapon - * 3. muzzle: String - Muzzle that was used - * 4. mode: String - Current mode of the fired weapon - * 5. ammo: String - Ammo used - * 6. magazine: String - magazine name which was used - * 7. projectile: Object - Object of the projectile that was shot (Arma 2: OA and onwards) - * - * Author: Glowbal, Ruthberg - * - */ - -if (isNil "CSE_DISABLE_HANDLE_DEFLECTION") then { CSE_DISABLE_HANDLE_DEFLECTION = false; }; -if (CSE_DISABLE_HANDLE_DEFLECTION) exitWith { true }; - -private ["_unit", "_weapon", "_ammo", "_bullet", "_airFriction", "_index"]; -_unit = _this select 0; - -if (!CSE_WIND_DEFLECTION_EFFECT_AI_BB && !(isPlayer _unit)) exitWith {}; -if (cse_AB_WindEnabled && (gunner _unit) getVariable ["cse_enabled_AdvancedBallistics", false]) exitWith {}; - -_bullet = _this select 5; -if (!isClass (configFile >> 'CfgPatches' >> 'CBA_main')) then { - _bullet = _this select 6; // with CBA magazine and projectile are reverted -}; - -if ((CSE_WIND_DEFLECTION_ALLOW_NON_LOCAL_BB || local _unit) && (_bullet isKindOf "BulletBase")) then { - _weapon = _this select 1; - _ammo = _this select 4; - - _airFriction = getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction"); - - _index = count cse_basicBallistics_bulletDatabase; - if (count cse_basicBallistics_bulletDatabaseFreeIndices > 0) then { - _index = cse_basicBallistics_bulletDatabaseFreeIndices select 0; - cse_basicBallistics_bulletDatabaseFreeIndices = cse_basicBallistics_bulletDatabaseFreeIndices - [_index]; - }; - - cse_basicBallistics_bulletDatabase set[_index, [_bullet, _airFriction, _index]]; - cse_basicBallistics_bulletDatabaseLastFrame set[_index, time]; - - cse_basicBallistics_bulletDatabaseOccupiedIndices pushBack _index; - - if (count cse_basicBallistics_bulletDatabaseOccupiedIndices == 1) then { - ["basicBallistics", "onEachFrame", { - private ["_bullet", "_airFriction", "_index", "_deltaT", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueVelocity", "_dragRef", "_drag", "_accelRef", "_accel"]; - - { - _bullet = (cse_basicBallistics_bulletDatabase select _x) select 0; - _index = (cse_basicBallistics_bulletDatabase select _x) select 2; - if (!alive _bullet) then { - cse_basicBallistics_bulletDatabaseOccupiedIndices = cse_basicBallistics_bulletDatabaseOccupiedIndices - [_index]; - cse_basicBallistics_bulletDatabaseFreeIndices pushBack _index; - }; - } forEach cse_basicBallistics_bulletDatabaseOccupiedIndices; - - if (count cse_basicBallistics_bulletDatabaseOccupiedIndices == 0) exitWith { - /// Resetting all the variables. - cse_basicBallistics_bulletDatabase = []; - cse_basicBallistics_bulletDatabaseLastFrame = []; - cse_basicBallistics_bulletDatabaseOccupiedIndices = []; - cse_basicBallistics_bulletDatabaseFreeIndices = []; - ["basicBallistics", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; - }; - - { - _bullet = (cse_basicBallistics_bulletDatabase select _x) select 0; - _airFriction = (cse_basicBallistics_bulletDatabase select _x) select 1; - _index = (cse_basicBallistics_bulletDatabase select _x) select 2; - - _deltaT = time - (cse_basicBallistics_bulletDatabaseLastFrame select _index); - cse_basicBallistics_bulletDatabaseLastFrame set[_index, time]; - - _bulletVelocity = velocity _bullet; - _bulletSpeed = vectorMagnitude _bulletVelocity; - - if (vectorMagnitude wind > 0) then { - _trueVelocity = _bulletVelocity vectorDiff wind; - _trueSpeed = vectorMagnitude _trueVelocity; - - _dragRef = _deltaT * _airFriction * _bulletSpeed * _bulletSpeed; - _accelRef = (vectorNormalized _bulletVelocity) vectorMultiply (_dragRef); - _bulletVelocity = _bulletVelocity vectorDiff _accelRef; - - _drag = _deltaT * _airFriction * _trueSpeed * _trueSpeed; - _accel = (vectorNormalized _trueVelocity) vectorMultiply (_drag); - _bulletVelocity = _bulletVelocity vectorAdd _accel; - }; - - _bullet setVelocity _bulletVelocity; - } forEach cse_basicBallistics_bulletDatabaseOccupiedIndices; - - }] call BIS_fnc_addStackedEventHandler; - }; -}; -true; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_onWeatherMeterOpened_DEFLECT.sqf b/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_onWeatherMeterOpened_DEFLECT.sqf deleted file mode 100644 index d27fa411e7..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_onWeatherMeterOpened_DEFLECT.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/** - * fn_onWeatherMeterOpened_DEFLECT.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -if (isnil "CSE_WEATHER_METER_CURRENT_SCREEN_DEFLECT") then { - CSE_WEATHER_METER_CURRENT_SCREEN_DEFLECT = "WIND_VIEW"; -}; -if (isnil "CSE_WEATHER_METER_IS_OPEN_DEFLECT") then { - CSE_WEATHER_METER_IS_OPEN_DEFLECT = false; -}; - -while { CSE_WEATHER_METER_IS_OPEN_DEFLECT } do { - switch (CSE_WEATHER_METER_CURRENT_SCREEN_DEFLECT) do { - case "WEATHER_VIEW": {[] call cse_fnc_weatherMeterOpenWeatherView_DEFLECT;}; - case "WIND_VIEW": { [] call cse_fnc_weatherMeterOpenWindView_DEFLECT;}; - default {}; - }; - uisleep 1; - -}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_weatherMeterOpenWeatherView_DEFLECT.sqf b/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_weatherMeterOpenWeatherView_DEFLECT.sqf deleted file mode 100644 index a8e25227bd..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_weatherMeterOpenWeatherView_DEFLECT.sqf +++ /dev/null @@ -1,28 +0,0 @@ -/** - * fn_weatherMeterOpenWeatherView_DEFLECT.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -private ["_display","_backgroundCtrl","_categoryCtrl","_lineOneCtrl", "_lineTwoCtrl","_LineThreeCtrl", "_textLineOne","_textLineTwo"]; - -disableSerialization; -_display = uiNamespace getvariable "cse_weather_meter"; - -_backgroundCtrl = _display displayCtrl 1; -_categoryCtrl = _display displayCtrl 10; -_lineOneCtrl = _display displayCtrl 11; -_lineTwoCtrl = _display displayCtrl 12; -_LineThreeCtrl = _display displayCtrl 13; - -_categoryCtrl ctrlSetText (localize "STR_CSE_WEATHER_METER_WEATHER_CATEGORY"); - -_textLineOne = format [ localize "STR_CSE_WEATHER_METER_WEATHER_HUMIDITY", floor (humidity * 100)]; - -_lineOneCtrl ctrlSetText _textLineOne; -_lineTwoCtrl ctrlSetText ""; -_LineThreeCtrl ctrlSetText ""; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_weatherMeterOpenWindView_DEFLECT.sqf b/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_weatherMeterOpenWindView_DEFLECT.sqf deleted file mode 100644 index 82c8e96a65..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/functions/fn_weatherMeterOpenWindView_DEFLECT.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/** - * fn_weatherMeterOpenWindView_DEFLECT.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -private ["_display","_backgroundCtrl","_categoryCtrl","_lineOneCtrl", "_lineTwoCtrl","_LineThreeCtrl", "_textLineOne","_textLineTwo"]; - -disableSerialization; -_display = uiNamespace getvariable "cse_weather_meter"; - -_backgroundCtrl = _display displayCtrl 1; -_categoryCtrl = _display displayCtrl 10; -_lineOneCtrl = _display displayCtrl 11; -_lineTwoCtrl = _display displayCtrl 12; -_LineThreeCtrl = _display displayCtrl 13; - -_categoryCtrl ctrlSetText (localize "STR_CSE_WEATHER_METER_WIND_CATEGORY"); - -_textLineOne = format [ localize "STR_CSE_WEATHER_METER_WIND_SPEED", (wind distance [0,0,0])]; -_textLineTwo = format [ localize "STR_CSE_WEATHER_METER_WIND_DIRECTION", windDir]; - -_lineOneCtrl ctrlSetText _textLineOne; -_lineTwoCtrl ctrlSetText _textLineTwo; -_LineThreeCtrl ctrlSetText ""; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/gui/define.hpp b/TO_MERGE/cse/sys_ballistics/basicBallistics/gui/define.hpp deleted file mode 100644 index c521de470f..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/gui/define.hpp +++ /dev/null @@ -1,797 +0,0 @@ - -#ifndef CSE_DEFINE_H -#define CSE_DEFINE_H -// define.hpp - -#define true 1 -#define false 0 - -#define CT_STATIC 0 -#define CT_BUTTON 1 -#define CT_EDIT 2 -#define CT_SLIDER 3 -#define CT_COMBO 4 -#define CT_LISTBOX 5 -#define CT_TOOLBOX 6 -#define CT_CHECKBOXES 7 -#define CT_PROGRESS 8 -#define CT_HTML 9 -#define CT_STATIC_SKEW 10 -#define CT_ACTIVETEXT 11 -#define CT_TREE 12 -#define CT_STRUCTURED_TEXT 13 -#define CT_CONTEXT_MENU 14 -#define CT_CONTROLS_GROUP 15 -#define CT_SHORTCUTBUTTON 16 -#define CT_XKEYDESC 40 -#define CT_XBUTTON 41 -#define CT_XLISTBOX 42 -#define CT_XSLIDER 43 -#define CT_XCOMBO 44 -#define CT_ANIMATED_TEXTURE 45 -#define CT_OBJECT 80 -#define CT_OBJECT_ZOOM 81 -#define CT_OBJECT_CONTAINER 82 -#define CT_OBJECT_CONT_ANIM 83 -#define CT_LINEBREAK 98 -#define CT_ANIMATED_USER 99 -#define CT_MAP 100 -#define CT_MAP_MAIN 101 -#define CT_LISTNBOX 102 - -// Static styles -#define ST_POS 0x0F -#define ST_HPOS 0x03 -#define ST_VPOS 0x0C -#define ST_LEFT 0x00 -#define ST_RIGHT 0x01 -#define ST_CENTER 0x02 -#define ST_DOWN 0x04 -#define ST_UP 0x08 -#define ST_VCENTER 0x0c - -#define ST_TYPE 0xF0 -#define ST_SINGLE 0 -#define ST_MULTI 16 -#define ST_TITLE_BAR 32 -#define ST_PICTURE 48 -#define ST_FRAME 64 -#define ST_BACKGROUND 80 -#define ST_GROUP_BOX 96 -#define ST_GROUP_BOX2 112 -#define ST_HUD_BACKGROUND 128 -#define ST_TILE_PICTURE 144 -#define ST_WITH_RECT 160 -#define ST_LINE 176 - -#define ST_SHADOW 0x100 -#define ST_NO_RECT 0x200 // this style works for CT_STATIC in conjunction with ST_MULTI -#define ST_KEEP_ASPECT_RATIO 0x800 - -#define ST_TITLE ST_TITLE_BAR + ST_CENTER - -// Slider styles -#define SL_DIR 0x400 -#define SL_VERT 0 -#define SL_HORZ 0x400 - -#define SL_TEXTURES 0x10 - -// Listbox styles -#define LB_TEXTURES 0x10 -#define LB_MULTI 0x20 -#define FontCSE "PuristaMedium" - -class cse_gui_backgroundBase { - type = CT_STATIC; - idc = -1; - style = ST_PICTURE; - colorBackground[] = {0,0,0,0}; - colorText[] = {1, 1, 1, 1}; - font = FontCSE; - text = ""; - sizeEx = 0.032; -}; -class cse_gui_editBase -{ - access = 0; - type = 2; - x = 0; - y = 0; - h = 0.04; - w = 0.2; - colorBackground[] = - { - 0, - 0, - 0, - 1 - }; - colorText[] = - { - 0.95, - 0.95, - 0.95, - 1 - }; - colorSelection[] = - { - "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", - "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", - "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", - 1 - }; - autocomplete = ""; - text = ""; - size = 0.2; - style = "0x00 + 0x40"; - font = "PuristaMedium"; - shadow = 2; - sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - colorDisabled[] = - { - 1, - 1, - 1, - 0.25 - }; -}; - - - -class cse_gui_buttonBase { - idc = -1; - type = 16; - style = ST_LEFT; - text = ""; - action = ""; - x = 0.0; - y = 0.0; - w = 0.25; - h = 0.04; - size = 0.03921; - sizeEx = 0.03921; - color[] = {1.0, 1.0, 1.0, 1}; - color2[] = {1.0, 1.0, 1.0, 1}; - /*colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.5])"}; - colorbackground2[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", 0.4}; - colorDisabled[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", 0.25}; - colorFocused[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])", 0.8}; - colorBackgroundFocused[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", 0.8}; - */ - - colorBackground[] = {1,1,1,0.95}; - colorbackground2[] = {1,1,1,0.95}; - colorDisabled[] = {1,1,1,0.6}; - colorFocused[] = {1,1,1,1}; - colorBackgroundFocused[] = {1,1,1,1}; - periodFocus = 1.2; - periodOver = 0.8; - default = false; - class HitZone { - left = 0.00; - top = 0.00; - right = 0.00; - bottom = 0.00; - }; - - class ShortcutPos { - left = 0.00; - top = 0.00; - w = 0.00; - h = 0.00; - }; - - class TextPos { - left = 0.002; - top = 0.0004; - right = 0.0; - bottom = 0.00; - }; - textureNoShortcut = ""; - animTextureNormal = "cse\cse_gui\data\buttonNormal_gradient_top.paa"; - animTextureDisabled = "cse\cse_gui\data\buttonDisabled_gradient.paa"; - animTextureOver = "cse\cse_gui\data\buttonNormal_gradient_top.paa"; - animTextureFocused = "cse\cse_gui\data\buttonNormal_gradient_top.paa"; - animTexturePressed = "cse\cse_gui\data\buttonNormal_gradient_top.paa"; - animTextureDefault = "cse\cse_gui\data\buttonNormal_gradient_top.paa"; - period = 0.5; - font = FontCSE; - soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1}; - soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.0,0}; - soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.07,1}; - soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1}; - class Attributes { - font = FontCSE; - color = "#E5E5E5"; - align = "center"; - shadow = "true"; - }; - class AttributesImage { - font = FontCSE; - color = "#E5E5E5"; - align = "left"; - shadow = "true"; - }; -}; - -class cse_gui_RscProgress { - type = 8; - style = 0; - colorFrame[] = {1,1,1,0.7}; - colorBar[] = {1,1,1,0.7}; - texture = "#(argb,8,8,3)color(1,1,1,0.7)"; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; -}; - - -class cse_gui_staticBase { - idc = -1; - type = CT_STATIC; - x = 0.0; - y = 0.0; - w = 0.183825; - h = 0.104575; - style = ST_LEFT; - font = FontCSE; - sizeEx = 0.03921; - colorText[] = {0.95, 0.95, 0.95, 1.0}; - colorBackground[] = {0, 0, 0, 0}; - text = ""; -}; - -class RscListBox; -class cse_gui_listBoxBase : RscListBox{ - type = CT_LISTBOX; - style = ST_MULTI; - font = FontCSE; - sizeEx = 0.03921; - color[] = {1, 1, 1, 1}; - colorText[] = {0.543, 0.5742, 0.4102, 1.0}; - colorScrollbar[] = {0.95, 0.95, 0.95, 1}; - colorSelect[] = {0.95, 0.95, 0.95, 1}; - colorSelect2[] = {0.95, 0.95, 0.95, 1}; - colorSelectBackground[] = {0, 0, 0, 1}; - colorSelectBackground2[] = {0.543, 0.5742, 0.4102, 1.0}; - colorDisabled[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", 0.25}; - period = 1.2; - rowHeight = 0.03; - colorBackground[] = {0, 0, 0, 1}; - maxHistoryDelay = 1.0; - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - soundSelect[] = {"",0.1,1}; - soundExpand[] = {"",0.1,1}; - soundCollapse[] = {"",0.1,1}; - class ListScrollBar { - arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; - arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; - autoScrollDelay = 5; - autoScrollEnabled = 0; - autoScrollRewind = 0; - autoScrollSpeed = -1; - border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; - color[] = {1,1,1,0.6}; - colorActive[] = {1,1,1,1}; - colorDisabled[] = {1,1,1,0.3}; - height = 0; - scrollSpeed = 0.06; - shadow = 0; - thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; - width = 0; - }; - class ScrollBar { - color[] = {1, 1, 1, 0.6}; - colorActive[] = {1, 1, 1, 1}; - colorDisabled[] = {1, 1, 1, 0.3}; - thumb = ""; - arrowFull = ""; - arrowEmpty = ""; - border = ""; - }; -}; - - -class cse_gui_listNBox { - access = 0; - type = CT_LISTNBOX;// 102; - style =ST_MULTI; - w = 0.4; - h = 0.4; - font = FontCSE; - sizeEx = 0.031; - - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; - arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; - columns[] = {0.0}; - color[] = {1, 1, 1, 1}; - - rowHeight = 0.03; - colorBackground[] = {0, 0, 0, 0.2}; - colorText[] = {1,1, 1, 1.0}; - colorScrollbar[] = {0.95, 0.95, 0.95, 1}; - colorSelect[] = {0.95, 0.95, 0.95, 1}; - colorSelect2[] = {0.95, 0.95, 0.95, 1}; - colorSelectBackground[] = {0, 0, 0, 0.0}; - colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.5}; - colorActive[] = {0,0,0,1}; - colorDisabled[] = {0,0,0,0.3}; - rows = 1; - - drawSideArrows = 0; - idcLeft = -1; - idcRight = -1; - maxHistoryDelay = 1; - soundSelect[] = {"", 0.1, 1}; - period = 1; - shadow = 2; - class ScrollBar { - arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; - arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; - border = "#(argb,8,8,3)color(1,1,1,1)"; - color[] = {1,1,1,0.6}; - colorActive[] = {1,1,1,1}; - colorDisabled[] = {1,1,1,0.3}; - thumb = "#(argb,8,8,3)color(1,1,1,1)"; - }; - class ListScrollBar { - arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; - arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; - autoScrollDelay = 5; - autoScrollEnabled = 0; - autoScrollRewind = 0; - autoScrollSpeed = -1; - border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; - color[] = {1,1,1,0.6}; - colorActive[] = {1,1,1,1}; - colorDisabled[] = {1,1,1,0.3}; - height = 0; - scrollSpeed = 0.06; - shadow = 0; - thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; - width = 0; - }; -}; - - -class RscCombo; -class cse_gui_comboBoxBase: RscCombo { - idc = -1; - type = 4; - style = "0x10 + 0x200"; - x = 0; - y = 0; - w = 0.3; - h = 0.035; - color[] = {0,0,0,0.6}; - colorActive[] = {1,0,0,1}; - colorBackground[] = {0,0,0,1}; - colorDisabled[] = {1,1,1,0.25}; - colorScrollbar[] = {1,0,0,1}; - colorSelect[] = {0,0,0,1}; - colorSelectBackground[] = {1,1,1,0.7}; - colorText[] = {1,1,1,1}; - - arrowEmpty = ""; - arrowFull = ""; - wholeHeight = 0.45; - font = FontCSE; - sizeEx = 0.031; - soundSelect[] = {"\A3\ui_f\data\sound\RscCombo\soundSelect",0.1,1}; - soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand",0.1,1}; - soundCollapse[] = {"\A3\ui_f\data\sound\RscCombo\soundCollapse",0.1,1}; - maxHistoryDelay = 1.0; - class ScrollBar - { - color[] = {0.3,0.3,0.3,0.6}; - colorActive[] = {0.3,0.3,0.3,1}; - colorDisabled[] = {0.3,0.3,0.3,0.3}; - thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; - arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; - arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; - border = ""; - }; - class ComboScrollBar { - arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; - arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; - autoScrollDelay = 5; - autoScrollEnabled = 0; - autoScrollRewind = 0; - autoScrollSpeed = -1; - border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; - color[] = {0.3,0.3,0.3,0.6}; - colorActive[] = {0.3,0.3,0.3,1}; - colorDisabled[] = {0.3,0.3,0.3,0.3}; - height = 0; - scrollSpeed = 0.06; - shadow = 0; - thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; - width = 0; - }; -}; - - - -class cse_gui_mapBase { - moveOnEdges = 1; - x = "SafeZoneXAbs"; - y = "SafeZoneY + 1.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "SafeZoneWAbs"; - h = "SafeZoneH - 1.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - type = 100; // Use 100 to hide markers - style = 48; - shadow = 0; - - ptsPerSquareSea = 5; - ptsPerSquareTxt = 3; - ptsPerSquareCLn = 10; - ptsPerSquareExp = 10; - ptsPerSquareCost = 10; - ptsPerSquareFor = 9; - ptsPerSquareForEdge = 9; - ptsPerSquareRoad = 6; - ptsPerSquareObj = 9; - showCountourInterval = 0; - scaleMin = 0.001; - scaleMax = 1.0; - scaleDefault = 0.16; - maxSatelliteAlpha = 0.85; - alphaFadeStartScale = 0.35; - alphaFadeEndScale = 0.4; - colorBackground[] = {0.969,0.957,0.949,1.0}; - colorSea[] = {0.467,0.631,0.851,0.5}; - colorForest[] = {0.624,0.78,0.388,0.5}; - colorForestBorder[] = {0.0,0.0,0.0,0.0}; - colorRocks[] = {0.0,0.0,0.0,0.3}; - colorRocksBorder[] = {0.0,0.0,0.0,0.0}; - colorLevels[] = {0.286,0.177,0.094,0.5}; - colorMainCountlines[] = {0.572,0.354,0.188,0.5}; - colorCountlines[] = {0.572,0.354,0.188,0.25}; - colorMainCountlinesWater[] = {0.491,0.577,0.702,0.6}; - colorCountlinesWater[] = {0.491,0.577,0.702,0.3}; - colorPowerLines[] = {0.1,0.1,0.1,1.0}; - colorRailWay[] = {0.8,0.2,0.0,1.0}; - colorNames[] = {0.1,0.1,0.1,0.9}; - colorInactive[] = {1.0,1.0,1.0,0.5}; - colorOutside[] = {0.0,0.0,0.0,1.0}; - colorTracks[] = {0.84,0.76,0.65,0.15}; - colorTracksFill[] = {0.84,0.76,0.65,1.0}; - colorRoads[] = {0.7,0.7,0.7,1.0}; - colorRoadsFill[] = {1.0,1.0,1.0,1.0}; - colorMainRoads[] = {0.9,0.5,0.3,1.0}; - colorMainRoadsFill[] = {1.0,0.6,0.4,1.0}; - colorGrid[] = {0.1,0.1,0.1,0.6}; - colorGridMap[] = {0.1,0.1,0.1,0.6}; - colorText[] = {1, 1, 1, 0.85}; -font = "PuristaMedium"; -sizeEx = 0.0270000; -stickX[] = {0.20, {"Gamma", 1.00, 1.50} }; -stickY[] = {0.20, {"Gamma", 1.00, 1.50} }; -onMouseButtonClick = ""; -onMouseButtonDblClick = ""; - - fontLabel = "PuristaMedium"; - sizeExLabel = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; - fontGrid = "TahomaB"; - sizeExGrid = 0.02; - fontUnits = "TahomaB"; - sizeExUnits = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; - fontNames = "PuristaMedium"; - sizeExNames = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8) * 2"; - fontInfo = "PuristaMedium"; - sizeExInfo = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; - fontLevel = "TahomaB"; - sizeExLevel = 0.02; - text = "#(argb,8,8,3)color(1,1,1,1)"; - class ActiveMarker { - color[] = {0.30, 0.10, 0.90, 1.00}; - size = 50; - }; - class Legend - { - x = "SafeZoneX + ( ((safezoneW / safezoneH) min 1.2) / 40)"; - y = "SafeZoneY + safezoneH - 4.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - h = "3.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - font = "PuristaMedium"; - sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; - colorBackground[] = {1,1,1,0.5}; - color[] = {0,0,0,1}; - }; - class Task - { - icon = "\A3\ui_f\data\map\mapcontrol\taskIcon_CA.paa"; - iconCreated = "\A3\ui_f\data\map\mapcontrol\taskIconCreated_CA.paa"; - iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa"; - iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa"; - iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa"; - color[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"}; - colorCreated[] = {1,1,1,1}; - colorCanceled[] = {0.7,0.7,0.7,1}; - colorDone[] = {0.7,1,0.3,1}; - colorFailed[] = {1,0.3,0.2,1}; - size = 27; - importance = 1; - coefMin = 1; - coefMax = 1; - }; - class Waypoint - { - icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa"; - color[] = {0,0,0,1}; - size = 20; - importance = "1.2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - class WaypointCompleted - { - icon = "\A3\ui_f\data\map\mapcontrol\waypointCompleted_ca.paa"; - color[] = {0,0,0,1}; - size = 20; - importance = "1.2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - class CustomMark - { - icon = "\A3\ui_f\data\map\mapcontrol\custommark_ca.paa"; - size = 24; - importance = 1; - coefMin = 1; - coefMax = 1; - color[] = {0,0,0,1}; - }; - class Command - { - icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa"; - size = 18; - importance = 1; - coefMin = 1; - coefMax = 1; - color[] = {1,1,1,1}; - }; - class Bush - { - icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; - color[] = {0.45,0.64,0.33,0.4}; - size = "14/2"; - importance = "0.2 * 14 * 0.05 * 0.05"; - coefMin = 0.25; - coefMax = 4; - }; - class Rock - { - icon = "\A3\ui_f\data\map\mapcontrol\rock_ca.paa"; - color[] = {0.1,0.1,0.1,0.8}; - size = 12; - importance = "0.5 * 12 * 0.05"; - coefMin = 0.25; - coefMax = 4; - }; - class SmallTree - { - icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; - color[] = {0.45,0.64,0.33,0.4}; - size = 12; - importance = "0.6 * 12 * 0.05"; - coefMin = 0.25; - coefMax = 4; - }; - class Tree - { - icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; - color[] = {0.45,0.64,0.33,0.4}; - size = 12; - importance = "0.9 * 16 * 0.05"; - coefMin = 0.25; - coefMax = 4; - }; - class busstop - { - icon = "\A3\ui_f\data\map\mapcontrol\busstop_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class fuelstation - { - icon = "\A3\ui_f\data\map\mapcontrol\fuelstation_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class hospital - { - icon = "\A3\ui_f\data\map\mapcontrol\hospital_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class church - { - icon = "\A3\ui_f\data\map\mapcontrol\church_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class lighthouse - { - icon = "\A3\ui_f\data\map\mapcontrol\lighthouse_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class power - { - icon = "\A3\ui_f\data\map\mapcontrol\power_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class powersolar - { - icon = "\A3\ui_f\data\map\mapcontrol\powersolar_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class powerwave - { - icon = "\A3\ui_f\data\map\mapcontrol\powerwave_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class powerwind - { - icon = "\A3\ui_f\data\map\mapcontrol\powerwind_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class quay - { - icon = "\A3\ui_f\data\map\mapcontrol\quay_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class shipwreck - { - icon = "\A3\ui_f\data\map\mapcontrol\shipwreck_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class transmitter - { - icon = "\A3\ui_f\data\map\mapcontrol\transmitter_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class watertower - { - icon = "\A3\ui_f\data\map\mapcontrol\watertower_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class Cross - { - icon = "\A3\ui_f\data\map\mapcontrol\Cross_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {0,0,0,1}; - }; - class Chapel - { - icon = "\A3\ui_f\data\map\mapcontrol\Chapel_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {0,0,0,1}; - }; - class Bunker - { - icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa"; - size = 14; - importance = "1.5 * 14 * 0.05"; - coefMin = 0.25; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Fortress - { - icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa"; - size = 16; - importance = "2 * 16 * 0.05"; - coefMin = 0.25; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Fountain - { - icon = "\A3\ui_f\data\map\mapcontrol\fountain_ca.paa"; - size = 11; - importance = "1 * 12 * 0.05"; - coefMin = 0.25; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Ruin - { - icon = "\A3\ui_f\data\map\mapcontrol\ruin_ca.paa"; - size = 16; - importance = "1.2 * 16 * 0.05"; - coefMin = 1; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Stack - { - icon = "\A3\ui_f\data\map\mapcontrol\stack_ca.paa"; - size = 20; - importance = "2 * 16 * 0.05"; - coefMin = 0.9; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Tourism - { - icon = "\A3\ui_f\data\map\mapcontrol\tourism_ca.paa"; - size = 16; - importance = "1 * 16 * 0.05"; - coefMin = 0.7; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class ViewTower - { - icon = "\A3\ui_f\data\map\mapcontrol\viewtower_ca.paa"; - size = 16; - importance = "2.5 * 16 * 0.05"; - coefMin = 0.5; - coefMax = 4; - color[] = {0,0,0,1}; - }; -}; - -#endif \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/gui/weather_meter.hpp b/TO_MERGE/cse/sys_ballistics/basicBallistics/gui/weather_meter.hpp deleted file mode 100644 index fd9e979bcd..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/gui/weather_meter.hpp +++ /dev/null @@ -1,101 +0,0 @@ -class cse_weather_meter { - idd = 65423; - movingEnable = 1; - onLoad = "uiNamespace setVariable ['cse_weather_meter', _this select 0];CSE_WEATHER_METER_IS_OPEN_DEFLECT = true; NUL = [] spawn cse_fnc_onWeatherMeterOpened_DEFLECT;"; - onUnload = "CSE_WEATHER_METER_IS_OPEN_DEFLECT = false; "; - - class controlsBackground { - class backgroundImg: cse_gui_backgroundBase{ - idc = 1; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - x = "0 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "15 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "30 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - text = "cse\cse_sys_ballistics\basicBallistics\data\pocket_weather_meter_day_green.paa"; - moving = 1; - }; - }; - - class controls { - class labelTextMenu : cse_gui_staticBase { - idc = 10; - x = "4.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "19 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "6.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; - text = "CATEGORY NAME"; - colorBackground[] = {0,0,0,0.0}; - colorText[] = {0.0, 0.0, 0.0, 1.0}; - style = ST_CENTER; - }; - class labelTextLineOne : labelTextMenu { - idc = 11; - x = "4.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "20 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "6.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "0.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.6)"; - text = ""; - style = ST_LEFT; - }; - class labelTextLineTwo : labelTextLineOne { - idc = 12; - y = "20.7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - text = ""; - }; - class labelTextLineThree : labelTextLineOne { - idc = 13; - y = "21.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - text = ""; - }; - - - - class actionClose : cse_gui_buttonBase { - idc = 30; - text = ""; - x = "4.25 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "28.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "0.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureOver = "#(argb,8,8,3)color(1,1,1,0)"; - animTextureFocused = "#(argb,8,8,3)color(1,1,1,0)"; - animTexturePressed = "#(argb,8,8,3)color(1,1,1,0)"; - animTextureDefault = "#(argb,8,8,3)color(1,1,1,0)"; - color[] = {1, 1, 1, 1}; - color2[] = {0,0,0, 1}; - colorBackgroundFocused[] = {1,1,1,1}; - colorBackground[] = {1,1,1,1}; - colorbackground2[] = {1,1,1,1}; - colorDisabled[] = {0.5,0.5,0.5,0.8}; - colorFocused[] = {0,0,0,1}; - periodFocus = 1; - periodOver = 1; - action = "closedialog 0;"; - }; - - class actionButtonLeft : actionClose { - idc = 31; - text = ""; - x = "4.25 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "23 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "1.75 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - action = "[] call cse_fnc_weatherMeterOpenWindView_DEFLECT; CSE_WEATHER_METER_CURRENT_SCREEN_DEFLECT = 'WIND_VIEW';"; - }; - class actionButtonRight : actionButtonLeft { - idc = 32; - text = ""; - x = "9.25 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "23 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "1.75 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - action = "[] call cse_fnc_weatherMeterOpenWeatherView_DEFLECT; CSE_WEATHER_METER_CURRENT_SCREEN_DEFLECT = 'WEATHER_VIEW';"; - }; - - }; -}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/init_sys_winddeflection.sqf b/TO_MERGE/cse/sys_ballistics/basicBallistics/init_sys_winddeflection.sqf deleted file mode 100644 index 33db0953d7..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/init_sys_winddeflection.sqf +++ /dev/null @@ -1,53 +0,0 @@ -CSE_WIND_DEFLECTION_EFFECT_AI_BB = false; -CSE_WIND_DEFLECTION_ALLOW_NON_LOCAL_BB = false; - -private ["_args"]; -_args = _this; - -{ - if (_x select 0 == "forAI") then { - CSE_WIND_DEFLECTION_EFFECT_AI_BB = _x select 1; - }; - if (_x select 0 == "allowNonLocal") then { - CSE_WIND_DEFLECTION_ALLOW_NON_LOCAL_BB = _x select 1; - }; - -}foreach _args; - -cse_basicBallistics_bulletDatabase = []; -cse_basicBallistics_bulletDatabaseLastFrame = []; -cse_basicBallistics_bulletDatabaseOccupiedIndices = []; -cse_basicBallistics_bulletDatabaseFreeIndices = []; - -if (hasInterface) then { - - cse_fnc_checkWindDir_WIND = { - private ["_windDir","_windSpeed"]; - - if (vehicle player == player && [player] call cse_fnc_canInteract) then { - if(windDir >= 340 && windDir <= 360 || windDir >= 0 && windDir <= 20) then {_windDir = "North";}; - if(windDir >= 20 && windDir <= 60) then {_windDir = "North East";}; - if(windDir >= 60 && windDir <= 110) then {_windDir = "East";}; - if(windDir >= 110 && windDir <= 160) then {_windDir = "South East";}; - if(windDir >= 160 && windDir <= 200) then {_windDir = "South";}; - if(windDir >= 200 && windDir <= 250) then {_windDir = "South West";}; - if(windDir >= 250 && windDir <= 290) then {_windDir = "West";}; - if(windDir >= 290 && windDir <= 340) then {_windDir = "North West";}; - hintSilent ("Wind Direction: "+ _windDir + "\nWind Strength: " + str floor(wind distance [0,0,0]) + "m/s"); - sleep 4; - hintSilent ""; - }; - }; - - //["check_wind_direction", (["check_wind_direction","action",[0,0,0,0]] call cse_fnc_getKeyBindingFromProfile_F), cse_fnc_checkWindDir_WIND] call cse_fnc_addKeyBindingForAction_F; - //["check_wind_direction","action","Check Wind Direction","Displays a hint with the current wind direction and speed."] call cse_fnc_settingsDefineDetails_F; - - //["open_weather_meter", (["open_weather_meter","menu",[0,0,0,0]] call cse_fnc_getKeyBindingFromProfile_F), {if (([player,'cse_weather_meter'] call cse_fnc_hasMagazine)) then { createDialog "cse_weather_meter"; }; }, 65423] call cse_fnc_addKeyBindingForMenu_F; - //["open_weather_meter","menu","Open the Weather Meter","When you have the weather meter in your inventory, pressing this key will open the menu, showing you the current weather information. "] call cse_fnc_settingsDefineDetails_F; - - waituntil{!isnil "cse_gui"}; - _entries = [ - ["Weather Meter", {([player,'cse_weather_meter'] call cse_fnc_hasMagazine)}, "cse\cse_sys_ballistics\basicBallistics\data\icon_weather_meter.paa", { closeDialog 0; createDialog "cse_weather_meter"; }, "Use Weather Meter"] - ]; - ["ActionMenu","equipment", _entries ] call cse_fnc_addMultipleEntriesToRadialCategory_F; -}; diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/readme.txt b/TO_MERGE/cse/sys_ballistics/basicBallistics/readme.txt deleted file mode 100644 index 6c46f48def..0000000000 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/readme.txt +++ /dev/null @@ -1,10 +0,0 @@ -Legacy Module for cse_sys_windDeflection. -by Glowbal. Modifications by Ruthberg. - -This module has been integrated into cse_sys_ballistics as part of the CSE project restructure. -The module will stay available to allow for backwards compatibilty. All functionality will remain the same as in previous CSE versions. - ------------- -Adjustments made: -- Improved ballistics calculation based upon Ruthberg's advancedBallistics code. -- Adjusted paths to direct to cse\cse_sys_ballistics\basicBallistics instead of cse\cse_sys_windDeflection. diff --git a/TO_MERGE/cse/sys_misc/functions/fn_moduleAmbianceSoundLoop.sqf b/TO_MERGE/cse/sys_misc/functions/fn_moduleAmbianceSoundLoop.sqf deleted file mode 100644 index 4b4d93d453..0000000000 --- a/TO_MERGE/cse/sys_misc/functions/fn_moduleAmbianceSoundLoop.sqf +++ /dev/null @@ -1,98 +0,0 @@ -/** - * fn_moduleAmbianceSoundLoop.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -private ["_logic", "_units", "_activated","_ambianceSounds", "_soundFiles", "_minimalDistance","_maximalDistance", "_minimalDistance", "_maxDelayBetweenSounds", "_allUnits", "_newPos", "_targetUnit", "_soundToPlay", "_soundPath", "_unparsedSounds", "_list", "_splittedList", "_nilCheckPassedList"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; -_units = [_this,1,[],[[]]] call BIS_fnc_param; -_activated = [_this,2,true,[true]] call BIS_fnc_param; - -if (_activated && isServer) then { - _ambianceSounds = []; - _unparsedSounds = _logic getvariable ["soundFiles", ""]; - _minimalDistance = (_logic getvariable ["minimalDistance", 400]) max 1; - _maximalDistance = (_logic getvariable ["maximalDistance", 10]) max _minimalDistance; - _minDelayBetweensounds = (_logic getvariable ["minimalDelay", 10]) max 1; - _maxDelayBetweenSounds = (_logic getvariable ["maximalDelay", 170]) max _minDelayBetweensounds; - _volume = (_logic getvariable ["soundVolume", 30]) max 1; - _followPlayers = _logic getvariable ["followPlayers", false]; - - _splittedList = [_unparsedSounds, ","] call BIS_fnc_splitString; - - _nilCheckPassedList = ""; - { - _x = [_x] call cse_fnc_string_removeWhiteSpace; - _splittedList set [_foreachIndex, _x]; - }foreach _splittedList; - - _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; - { - if (isclass (missionConfigFile >> "CfgSounds" >> _x)) then { - _ambianceSounds pushback (_soundPath + (getArray(missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0)); - } else { - if (isclass (configFile >> "CfgSounds" >> _x)) then { - _ambianceSounds pushback ((getArray(configFile >> "CfgSounds" >> _x >> "sound") select 0)); - }; - }; - }foreach _splittedList; - - if (count _ambianceSounds == 0) exitwith { - [format["No Ambiance sounds available"]] call cse_fnc_debug; - }; - { - if !([".", _x, true] call BIS_fnc_inString) then { - [format["Ambiance soundfile does not contain a file extension %1", _x]] call cse_fnc_debug; - _ambianceSounds set [_foreachIndex, _x + ".wss"]; - }; - }foreach _ambianceSounds; - [format["Ambiance sounds %1", _ambianceSounds]] call cse_fnc_debug; - - while {alive _logic} do { - _allUnits = switch (true) do { - case isMultiplayer: {playableUnits}; - case isDedicated: {[_logic]}; - default {[player]}; - }; - - if (count _allUnits > 0) then { - _targetUnit = _allUnits select (round(random((count _allUnits)-1))); - - _newPos = (getPos _targetUnit); - if (!_followPlayers) then { - _newPos = getPos _logic; - }; - - if (random(1) >= 0.5) then { - if (random(1) >= 0.5) then { - _newPos set [0, (_newPos select 0) + (_minimalDistance + random(_maximalDistance))]; - } else { - _newPos set [0, (_newPos select 0) - (_minimalDistance + random(_maximalDistance))]; - }; - } else { - if (random(1) >= 0.5) then { - _newPos set [1, (_newPos select 1) + (_minimalDistance + random(_maximalDistance))]; - } else { - _newPos set [1, (_newPos select 1) - (_minimalDistance + random(_maximalDistance))]; - }; - }; - - if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then { - - _soundToPlay = _ambianceSounds select (round(random((count _ambianceSounds)-1))); - playSound3D [_soundToPlay, _targetUnit, false, _newPos, _volume, 1, 1000]; - - [format["Played a sound %1", _soundToPlay]] call cse_fnc_debug; - - sleep (_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds; - }; - }; - }; -}; - -true; \ No newline at end of file diff --git a/addons/ai/CfgWeapons.hpp b/addons/ai/CfgWeapons.hpp index 55b2ac55ea..22e8f703fc 100644 --- a/addons/ai/CfgWeapons.hpp +++ b/addons/ai/CfgWeapons.hpp @@ -28,7 +28,7 @@ class CfgWeapons { class arifle_MX_Base_F: Rifle_Base_F { aiDispersionCoefY = 18.0; aiDispersionCoefX = 12.0; - modes[] += {"AGM_Burst_far"}; + modes[] += {"ACE_Burst_far"}; class Single: Mode_SemiAuto { minRange = 120; // 2; @@ -43,7 +43,7 @@ class CfgWeapons { burst = "3 + round random 5"; //3; }; - class AGM_Burst_far: fullauto_medium { + class ACE_Burst_far: fullauto_medium { aiRateOfFire = 2.0; aiRateOfFireDistance = 500; minRange = 400; @@ -86,7 +86,7 @@ class CfgWeapons { burst = "3 + round random 5"; //3; }; - class AGM_Burst_far: fullauto_medium { + class ACE_Burst_far: fullauto_medium { aiRateOfFire = 2.0; aiRateOfFireDistance = 400; minRange = 300; @@ -146,8 +146,8 @@ class CfgWeapons { aiDispersionCoefY = 24.0; aiDispersionCoefX = 21.0; // Shit is still broken - //modes[] += {"AGM_Burst_far"}; - modes[] = {"Single","manual","close","short","medium","far_optic1","far_optic2","AGM_Burst_far"}; + //modes[] += {"ACE_Burst_far"}; + modes[] = {"Single","manual","close","short","medium","far_optic1","far_optic2","ACE_Burst_far"}; class Single: Mode_SemiAuto { minRange = 120; // 2; @@ -155,7 +155,7 @@ class CfgWeapons { class close; class medium; - class AGM_Burst_far: medium { + class ACE_Burst_far: medium { aiRateOfFire = 6.0; aiRateOfFireDistance = 900; minRange = 500; @@ -182,7 +182,7 @@ class CfgWeapons { class arifle_Katiba_Base_F: Rifle_Base_F { aiDispersionCoefY = 18.0; aiDispersionCoefX = 12.0; - modes[] += {"AGM_Burst_far"}; + modes[] += {"ACE_Burst_far"}; class Single: Mode_SemiAuto { minRange = 120; // 2; @@ -197,7 +197,7 @@ class CfgWeapons { burst = "3 + round random 5"; //3; }; - class AGM_Burst_far: fullauto_medium { + class ACE_Burst_far: fullauto_medium { aiRateOfFire = 2.0; aiRateOfFireDistance = 500; minRange = 400; @@ -242,7 +242,7 @@ class CfgWeapons { burst = "3 + round random 5"; //3; }; - class AGM_Burst_far: fullauto_medium { + class ACE_Burst_far: fullauto_medium { aiRateOfFire = 2.0; aiRateOfFireDistance = 400; minRange = 300; @@ -270,7 +270,7 @@ class CfgWeapons { class mk20_base_F: Rifle_Base_F { aiDispersionCoefY = 18.0; aiDispersionCoefX = 12.0; - modes[] += {"AGM_Burst_far"}; + modes[] += {"ACE_Burst_far"}; class Single: Mode_SemiAuto { minRange = 120; // 2; @@ -289,7 +289,7 @@ class CfgWeapons { burst = "3 + round random 5"; // 3; }; - class AGM_Burst_far: fullauto_medium { + class ACE_Burst_far: fullauto_medium { aiRateOfFire = 2.0; aiRateOfFireDistance = 500; minRange = 400; @@ -343,7 +343,7 @@ class CfgWeapons { burst = "3 + round random 5"; //3; }; - class AGM_Burst_far: fullauto_medium { + class ACE_Burst_far: fullauto_medium { aiRateOfFire = 2.0; aiRateOfFireDistance = 400; minRange = 300; @@ -360,7 +360,7 @@ class CfgWeapons { class Tavor_base_F: Rifle_Base_F { aiDispersionCoefY = 18.0; aiDispersionCoefX = 12.0; - modes[] += {"AGM_Burst_far"}; + modes[] += {"ACE_Burst_far"}; class Single: Mode_SemiAuto { minRange = 120; //2; @@ -380,7 +380,7 @@ class CfgWeapons { burst = "3 + round random 5"; // 3; }; - class AGM_Burst_far: fullauto_medium { + class ACE_Burst_far: fullauto_medium { aiRateOfFire = 2.0; aiRateOfFireDistance = 400; minRange = 300; @@ -428,7 +428,7 @@ class CfgWeapons { burst = "3 + round random 5"; // 3; }; - class AGM_Burst_far: fullauto_medium { + class ACE_Burst_far: fullauto_medium { aiRateOfFire = 2.0; aiRateOfFireDistance = 400; minRange = 300; @@ -517,10 +517,10 @@ class CfgWeapons { class LMG_Mk200_F: Rifle_Long_Base_F { aiDispersionCoefY = 24.0; aiDispersionCoefX = 21.0; - modes[] += {"AGM_Burst_far"}; + modes[] += {"ACE_Burst_far"}; class medium; - class AGM_Burst_far: medium { + class ACE_Burst_far: medium { aiRateOfFire = 6.0; aiRateOfFireDistance = 900; minRange = 500; @@ -546,7 +546,7 @@ class CfgWeapons { class LMG_Zafir_F: Rifle_Long_Base_F { aiDispersionCoefY = 23.0; aiDispersionCoefX = 19.0; - modes[] += {"AGM_Burst_far"}; + modes[] += {"ACE_Burst_far"}; class Single: Mode_SemiAuto { minRange = 120; // 2; @@ -554,7 +554,7 @@ class CfgWeapons { class close; class medium; - class AGM_Burst_far: medium { + class ACE_Burst_far: medium { aiRateOfFire = 6.0; aiRateOfFireDistance = 900; minRange = 500; diff --git a/addons/aircraft/CfgAmmo.hpp b/addons/aircraft/CfgAmmo.hpp index 2c9d6a91e6..177753223f 100644 --- a/addons/aircraft/CfgAmmo.hpp +++ b/addons/aircraft/CfgAmmo.hpp @@ -1,302 +1,43 @@ class CfgAmmo { - class BulletBase; - class B_20mm: BulletBase { - deflecting = 3; - hit = 100; - indirectHit = 10; - indirectHitRange = 2; - model = "\A3\Weapons_f\Data\bullettracer\tracer_red"; - }; - + // adjust minigun caliber and deflection to other ammo class SubmunitionBullet; class B_65x39_Minigun_Caseless: SubmunitionBullet { - hit = 10; - indirectHit = 0; - indirectHitRange = 0; caliber = 1; - deflecting = 5; - typicalSpeed = 850; + deflecting = 15; }; class B_762x51_Minigun_Tracer_Red: SubmunitionBullet { - hit = 12; - indirectHit = 0; - indirectHitRange = 0; - model = "\A3\Weapons_f\Data\bullettracer\tracer_red"; caliber = 1.6; - deflecting = 5; - typicalSpeed = 850; - }; - - class M_Titan_AA; - class M_Zephyr: M_Titan_AA { - proxyShape = "\A3\Weapons_F\Ammo\Missile_AA_02_F.p3d"; - model = "\A3\Weapons_F\Ammo\Missile_AA_02_fly_F.p3d"; - airFriction = 0.078; - sideAirFriction = 0.18; - maneuvrability = 24; - class CamShakeFire {}; - class CamShakePlayerFire {}; - }; - - class M_Zephyr_Mi06: M_Zephyr { - maverickWeaponIndexOffset = 6; - }; - - class MissileBase; - class M_Air_AA: MissileBase { - model = "\A3\Weapons_F\Ammo\Missile_AT_02_fly_F"; - proxyShape = "\A3\Weapons_F\Ammo\Missile_AT_02_F"; - hit = 280; - indirectHit = 85; - indirectHitRange = 10; - maneuvrability = 27; - simulationStep = 0.002; - airLock = 1; - irLock = 1; - cost = 1500; - //maxSpeed = 2400; - timeToLive = 40; - airFriction = 0.05; - sideAirFriction = 0.1; - trackOversteer = 1; - trackLead = 1; - initTime = 0; - thrustTime = 12; - thrust = 340; - fuseDistance = 500; - weaponLockSystem = "2 + 16"; - maxControlRange = 8000; - class CamShakeExplode {}; - class CamShakeHit {}; - class CamShakeFire {}; - class CamShakePlayerFire {}; - }; - - class Missile_AA_04_F: MissileBase { - hit = 800; - indirectHit = 60; - indirectHitRange = 12; - airLock = 2; - irLock = 1; - laserLock = 0; - nvLock = 0; - weaponLockSystem = "2 + 16"; - cmimmunity = 0.8; - initTime = 0; - thrust = 380; - thrustTime = 9.5; - airFriction = 0.04; - sideAirFriction = 0.08; - //maxSpeed = 2600; - maneuvrability = 14; - simulationStep = 0.002; - fuseDistance = 500; - timeToLive = 19; - trackLead = 1; - trackOversteer = 1; + deflecting = 15; }; + // also adjust tracer, "muh lightshow"; also adjust splash damage radius + class BulletBase; class Gatling_30mm_HE_Plane_CAS_01_F: BulletBase { - model = "\A3\Weapons_f\Data\bullettracer\tracer_red.p3d"; - cost = 20; hit = 80; indirectHit = 12; - indirectHitRange = 3; + indirectHitRange = 3; //2; caliber = 1.4; - explosive = 0.6; - airlock = 1; deflecting = 3; - airFriction = -0.00042; - typicalSpeed = 960; - visibleFire = 32; - audibleFire = 32; - visibleFireTime = 3; fuseDistance = 3; - tracerScale = 2.5; tracerStartTime = 0.02; - tracerEndTime = 4.7; - multiSoundHit[] = {"soundHit1",0.2,"soundHit2",0.2,"soundHit3",0.2,"soundHit4",0.1,"soundHit5",0.15,"soundHit6",0.15}; - soundFly[] = {"A3\Sounds_F\weapons\Explosion\cannon_fly",1,1,50}; - explosionSoundEffect = "DefaultExplosion"; - explosionEffects = "ExploAmmoExplosion"; - craterEffects = "ExploAmmoCrater"; - soundHit1[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_1",3.16228,1,1600}; - soundHit2[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_2",3.16228,1,1600}; - soundHit3[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_3",3.16228,1,1600}; - soundHit4[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_4",3.16228,1,1600}; - soundHit5[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_5",3.16228,1,1600}; - soundHit6[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_6",3.16228,1,1600}; - class CamShakeExplode {}; - class CamShakeHit {}; - class CamShakeFire {}; - class CamShakePlayerFire {}; }; + + // helper projectiles to simulate a rof > fps class ACE_Gatling_30mm_HE_Plane_CAS_01_Deploy: Gatling_30mm_HE_Plane_CAS_01_F { simulation = "shotSubmunitions"; triggerTime = 0; submunitionAmmo = "ACE_Gatling_30mm_HE_Plane_CAS_01_Sub"; submunitionConeType[] = {"custom", {{0,0}, {0,0}, {0,0}} }; }; - class ACE_Gatling_30mm_HE_Plane_CAS_01_Sub: Gatling_30mm_HE_Plane_CAS_01_F { - }; + class ACE_Gatling_30mm_HE_Plane_CAS_01_Sub: Gatling_30mm_HE_Plane_CAS_01_F {}; + + // adjust damage and splash damage, closer to bluefor gatling with same caliber class Cannon_30mm_HE_Plane_CAS_02_F: Gatling_30mm_HE_Plane_CAS_01_F { - model = "\A3\Weapons_f\Data\bullettracer\tracer_green.p3d"; - hit = 70; - indirectHit = 11; + hit = 70; //40; + indirectHit = 11; //14; indirectHitRange = 3; - caliber = 2; - explosive = 0.6; }; - - class Missile_AGM_02_F: MissileBase { - model = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_02_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_02_F.p3d"; - maverickWeaponIndexOffset = 2; - cost = 1500; - hit = 2100; - indirectHit = 85; - indirectHitRange = 8; - manualControl = 0; - maxControlRange = 8000; - airLock = 0; - irLock = 1; - laserLock = 0; - nvLock = 0; - weaponLockSystem = "2 + 16"; - cmimmunity = 0.8; - initTime = 0; - thrust = 240; - thrustTime = 5; - airFriction = 0.05; - sideAirFriction = 0.1; - maxSpeed = 828; - maneuvrability = 27; - simulationStep = 0.002; - fuseDistance = 500; - timeToLive = 40; - trackLead = 1; - trackOversteer = 1; - craterEffects = "AAMissileCrater"; - effectsMissile = "missile3"; - explosionEffects = "AAMissileExplosion"; - muzzleEffect = "BIS_fnc_effectFiredHeliRocket"; - whistleDist = 20; - class CamShakeExplode {}; - class CamShakeHit {}; - class CamShakeFire {}; - class CamShakePlayerFire {}; - }; - - class LaserBombCore; - class Bomb_04_F: LaserBombCore { - model = "\A3\Weapons_F_EPC\Ammo\Bomb_04_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Bomb_04_F.p3d"; - maverickWeaponIndexOffset = 8; - hit = 6000; - indirectHit = 1400; - indirectHitRange = 15; - nvLock = 1; - weaponLockSystem = "2 + 16 + 4"; - maneuvrability = 20; - fuseDistance = 35; - trackLead = 0.95; - trackOversteer = 1; - craterEffects = "BombCrater"; - explosionEffects = "BombExplosion"; - explosionSoundEffect = "DefaultExplosion"; - explosionTime = 2; - multiSoundHit[] = {"soundHit1",0.2,"soundHit2",0.2,"soundHit3",0.2,"soundHit4",0.2,"soundHit5",0.2}; - soundHit1[] = {"\A3\Sounds_F\weapons\Explosion\expl_big_1",2.51189,1,2400}; - soundHit2[] = {"\A3\Sounds_F\weapons\Explosion\expl_big_2",2.51189,1,2400}; - soundHit3[] = {"\A3\Sounds_F\weapons\Explosion\expl_big_3",2.51189,1,2400}; - soundHit4[] = {"\A3\Sounds_F\weapons\Explosion\expl_shell_1",2.51189,1,2400}; - soundHit5[] = {"\A3\Sounds_F\weapons\Explosion\expl_shell_2",2.51189,1,2400}; - whistleDist = 24; - }; - - class Rocket_04_HE_F: MissileBase { - model = "\A3\Weapons_F_EPC\Ammo\Rocket_04_HE_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Rocket_04_HE_F.p3d"; - maverickWeaponIndexOffset = 12; - cost = 500; - hit = 210; - indirectHit = 55; - indirectHitRange = 15; - manualControl = 0; - maxControlRange = 8000; - airLock = 0; - irLock = 1; - laserLock = 0; - nvLock = 0; - weaponLockSystem = 0; - cmimmunity = 1; - initTime = 0.002; - thrust = 1600; - thrustTime = 0.7; - airFriction = 0.0046; - sideAirFriction = 0.005; - maxSpeed = 610; - maneuvrability = 0; - fuseDistance = 50; - timeToLive = 60; - effectsMissileInit = "MissileDAR1"; - whistleDist = 30; - class CamShakeExplode {}; - class CamShakeHit {}; - class CamShakeFire {}; - class CamShakePlayerFire {}; - }; - - class Rocket_04_AP_F: Rocket_04_HE_F { - model = "\A3\Weapons_F_EPC\Ammo\Rocket_04_AP_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Rocket_04_AP_F.p3d"; - maverickWeaponIndexOffset = 19; - hit = 400; - indirectHit = 20; - indirectHitRange = 10; - }; - - class Missile_AA_03_F: Missile_AA_04_F { - model = "\A3\Weapons_F_EPC\Ammo\Missile_AA_03_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Missile_AA_03_F.p3d"; - maverickWeaponIndexOffset = 0; - hit = 900; - indirectHit = 50; - indirectHitRange = 15; - }; - - class Missile_AGM_01_F: Missile_AGM_02_F { - model = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_01_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_01_F.p3d"; - maverickWeaponIndexOffset = 2; - hit = 2200; - indirectHit = 90; - indirectHitRange = 10; - }; - - class Bomb_03_F: Bomb_04_F { - model = "\A3\Weapons_F_EPC\Ammo\Bomb_03_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Bomb_03_F.p3d"; - maverickWeaponIndexOffset = 6; - hit = 6400; - indirectHit = 1400; - indirectHitRange = 16; - }; - - class Rocket_03_HE_F: Rocket_04_HE_F { - model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; - maverickWeaponIndexOffset = 8; - }; - - class Rocket_03_AP_F: Rocket_04_AP_F { - model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_AP_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Rocket_03_AP_F.p3d"; - maverickWeaponIndexOffset = 28; - }; - - class RocketBase; }; diff --git a/addons/aircraft/CfgMagazines.hpp b/addons/aircraft/CfgMagazines.hpp index 7328eda091..0c306f8f04 100644 --- a/addons/aircraft/CfgMagazines.hpp +++ b/addons/aircraft/CfgMagazines.hpp @@ -1,202 +1,15 @@ class CfgMagazines { + // shoot helper object to tripple rof class VehicleMagazine; - class 24Rnd_PG_missiles; - - class 12Rnd_PG_missiles: 24Rnd_PG_missiles { - count = 12; - displayName = "$STR_A3_CfgMagazines_12Rnd_PG_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_12Rnd_PG_missiles_dns"; - descriptionShort = "$STR_A3_CfgMagazines_12Rnd_PG_missiles1"; - }; - class 12Rnd_missiles: VehicleMagazine { - scope = 2; - count = 12; - ammo = "M_AT"; - displayName = "$STR_A3_CfgMagazines_24Rnd_PuG_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_24Rnd_PuG_missiles_dns"; - descriptionShort = "$STR_A3_CfgMagazines_24Rnd_PuG_missiles0"; - initSpeed = 44; - maxLeadSpeed = 800; - nameSound = "rockets"; - sound[] = {"A3\sounds_f\weapons\rockets\explosion_missile_01",1,1,1200}; - reloadSound[] = {"",0.000316228,1}; - }; - - //minigun magazines, muzzle velocities and tracercounts - class 200Rnd_65x39_Belt: VehicleMagazine {}; - class 2000Rnd_65x39_Belt: 200Rnd_65x39_Belt {}; - class 2000Rnd_65x39_Belt_Tracer_Red: 2000Rnd_65x39_Belt { - }; - class 2000Rnd_65x39_Belt_Green: 2000Rnd_65x39_Belt {}; - class 2000Rnd_65x39_Belt_Tracer_Green: 2000Rnd_65x39_Belt_Green { - tracersEvery = 1; - }; - class 2000Rnd_65x39_Belt_Yellow: 2000Rnd_65x39_Belt { - tracersEvery = 1; - }; - class 2000Rnd_65x39_Belt_Tracer_Yellow: 2000Rnd_65x39_Belt_Yellow { - tracersEvery = 1; - }; - - class 5000Rnd_762x51_Belt: 2000Rnd_65x39_Belt { - tracersEvery = 1; - count = 5000; - }; - class 5000Rnd_762x51_Yellow_Belt: 5000Rnd_762x51_Belt {}; - class 4000Rnd_762x51_M134 : 5000Rnd_762x51_Belt { - count = 4000; - tracersEvery = 1; - }; - class 2000Rnd_762x51_M134 : 4000Rnd_762x51_M134 { - count = 2000; - tracersEvery = 1; - }; - - class 2Rnd_AAA_missiles: VehicleMagazine { - scope = 2; - displayName = "$STR_A3_CfgMagazines_2Rnd_AAA_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_2Rnd_AAA_missiles_dns"; - ammo = "M_Air_AA"; - count = 2; - maxLeadSpeed = 950; - nameSound = "missiles"; - }; - class 2Rnd_AAA_missiles_MI02: 2Rnd_AAA_missiles { - ammo = "M_Air_AA_MI02"; - }; - class 4Rnd_AAA_missiles: 2Rnd_AAA_missiles { - displayName = "$STR_A3_CfgMagazines_4Rnd_AAA_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_4Rnd_AAA_missiles_dns"; - count = 4; - }; - class 4Rnd_AAA_missiles_MI02: 4Rnd_AAA_missiles { - ammo = "M_Air_AA_MI02"; - }; - - class 4Rnd_GAA_missiles: VehicleMagazine { - scope = 2; - displayName = "$STR_A3_CfgMagazines_4Rnd_GAA_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_4Rnd_GAA_missiles_dns"; - count = 4; - ammo = "M_Zephyr"; - maxLeadSpeed = 950; - nameSound = "missiles"; - }; - - class 300Rnd_20mm_shells: VehicleMagazine { - scope = 2; - displayName = "$STR_A3_CfgMagazines_300Rnd_20mm_shells0"; - displayNameShort = "$STR_A3_CfgMagazines_300Rnd_20mm_shells_dns"; - ammo = "B_20mm"; - count = 300; - deflecting = 3; - maxLeadSpeed = 300; - tracersEvery = 5; - nameSound = "cannon"; - }; - class 1000Rnd_Gatling_30mm_Plane_CAS_01_F: VehicleMagazine { - scope = 2; - displayNameShort = ""; ammo = "ACE_Gatling_30mm_HE_Plane_CAS_01_Deploy"; count = 1170; - //count = 390; - //initSpeed = 3852; - maxLeadSpeed = 300; - nameSound = "cannon"; - tracersEvery = 1; - }; - - class 2Rnd_Missile_AA_04_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_4RND_AAA_MISSILES_DNS"; - ammo = "Missile_AA_04_F"; - count = 2; - maxLeadSpeed = 220; - nameSound = "missiles"; - }; - class 6Rnd_Missile_AGM_02_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_38RND_80MM_ROCKETS_DNS"; - ammo = "Missile_AGM_02_F"; - count = 6; - maxLeadSpeed = 450; - nameSound = "missiles"; - }; - class 2Rnd_Missile_AGM_02_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_38RND_80MM_ROCKETS_DNS"; - ammo = "Missile_AGM_02_F"; - count = 2; - maxLeadSpeed = 450; - nameSound = "missiles"; - }; - - class 7Rnd_Rocket_04_HE_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_40RND_20MM_G_BELT_DNS"; - ammo = "Rocket_04_HE_F"; - count = 7; - maxLeadSpeed = 200; - nameSound = "rockets"; - }; - class 7Rnd_Rocket_04_AP_F: 7Rnd_Rocket_04_HE_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_TITAN_AP_DNS"; - ammo = "Rocket_04_AP_F"; - }; - - class 4Rnd_Bomb_04_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGVEHICLES_BOMB0"; - ammo = "Bomb_04_F"; - count = 4; - maxLeadSpeed = 1000; - nameSound = "cannon"; - }; - - class 500Rnd_Cannon_30mm_Plane_CAS_02_F: 1000Rnd_Gatling_30mm_Plane_CAS_01_F { - displayNameShort = ""; - ammo = "Cannon_30mm_HE_Plane_CAS_02_F"; - count = 500; - }; - - class 2Rnd_Missile_AA_03_F: 2Rnd_Missile_AA_04_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_4RND_AAA_MISSILES_DNS"; - ammo = "Missile_AA_03_F"; - count = 2; - }; - class 4Rnd_Missile_AGM_01_F: 6Rnd_Missile_AGM_02_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_38RND_80MM_ROCKETS_DNS"; - ammo = "Missile_AGM_01_F"; - count = 4; - }; - - class 20Rnd_Rocket_03_HE_F: 7Rnd_Rocket_04_HE_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_40RND_20MM_G_BELT_DNS"; - ammo = "Rocket_03_HE_F"; - count = 20; - }; - class 20Rnd_Rocket_03_AP_F: 7Rnd_Rocket_04_AP_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_TITAN_AP_DNS"; - ammo = "Rocket_03_AP_F"; - count = 20; - }; - - class 2Rnd_Bomb_03_F: 4Rnd_Bomb_04_F { - displayNameShort = "$STR_A3_CFGVEHICLES_BOMB0"; - ammo = "Bomb_03_F"; - count = 2; }; + // an extended magazine for the comanche + class 300Rnd_20mm_shells; class ACE_500Rnd_20mm_shells_Comanche: 300Rnd_20mm_shells { - displayName = "20mm"; - displayNameShort = "20mm"; - ammo = "B_20mm"; count = 500; - deflecting = 3; - initSpeed = 1030; - maxLeadSpeed = 300; - tracersEvery = 5; }; }; diff --git a/addons/aircraft/CfgVehicles.hpp b/addons/aircraft/CfgVehicles.hpp index 18be36b9e8..5f419506c0 100644 --- a/addons/aircraft/CfgVehicles.hpp +++ b/addons/aircraft/CfgVehicles.hpp @@ -8,12 +8,9 @@ class CfgVehicles { class NewTurret { class Turrets; }; - class CargoTurret; }; - class Air: AllVehicles { - class AnimationSources; - }; + class Air: AllVehicles {}; class Helicopter: Air { class Turrets { @@ -33,6 +30,7 @@ class CfgVehicles { class Turrets: Turrets { class CopilotTurret; }; + class AnimationSources; }; class Helicopter_Base_H: Helicopter_Base_F { @@ -46,7 +44,7 @@ class CfgVehicles { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -55,14 +53,11 @@ class CfgVehicles { }; }; - class B_Heli_Light_01_F: Heli_Light_01_base_F { + class Heli_Light_01_unarmed_base_F: Heli_Light_01_base_F {}; + + class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F { /*class Turrets: Turrets { class CopilotTurret: CopilotTurret {}; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; - class CargoTurret_03: CargoTurret_02 {}; - class CargoTurret_04: CargoTurret_01 {}; };*/ }; @@ -70,7 +65,7 @@ class CfgVehicles { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -84,7 +79,8 @@ class CfgVehicles { driverCanEject = 1; lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; - magazines[] = {"2000Rnd_762x51_Belt_T_Green", "12Rnd_PG_missiles", "168Rnd_CMFlare_Chaff_Magazine"}; + magazines[] = {"2000Rnd_762x51_Belt_T_Green","12Rnd_PG_missiles","168Rnd_CMFlare_Chaff_Magazine"}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -103,36 +99,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; - class AnimationSources: AnimationSources { - class HitGlass1 { - source = "Hit"; - hitpoint = "HitGlass1"; - raw = 1; - }; - class HitGlass2: HitGlass1 { - hitpoint = "HitGlass2"; - }; - class HitGlass3: HitGlass1 { - hitpoint = "HitGlass3"; - }; - class HitGlass4: HitGlass1 { - hitpoint = "HitGlass4"; - }; - class Gatling { - source = "revolving"; - weapon = "ACE_gatling_20mm_Comanche"; - }; - class Hide { - source = "user"; - animPeriod = 0; - initPhase = 0; - }; - class Muzzle_flash { - source = "ammorandom"; - weapon = "ACE_gatling_20mm_Comanche"; - }; - }; + class Turrets: Turrets { class MainTurret: MainTurret { canEject = 1; @@ -141,6 +108,15 @@ class CfgVehicles { magazines[] = {"ACE_500Rnd_20mm_shells_Comanche","4Rnd_AAA_missiles","24Rnd_PG_missiles"}; }; }; + + class AnimationSources: AnimationSources { + class Gatling { + weapon = "ACE_gatling_20mm_Comanche"; + }; + class Muzzle_flash { + weapon = "ACE_gatling_20mm_Comanche"; + }; + }; }; class B_Heli_Attack_01_F: Heli_Attack_01_base_F {}; @@ -149,6 +125,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class MainTurret: MainTurret { canEject = 1; @@ -160,6 +137,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -174,6 +152,7 @@ class CfgVehicles { canEject = 1; }; }; + /*class UserActions { class DoorL1_Open { available = 1; @@ -195,16 +174,14 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; showHMD = 1; }; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; + /*class UserActions: UserActions { class DoorL1_Open { available = 1; @@ -246,9 +223,9 @@ class CfgVehicles { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; weapons[] = {"M134_minigun","missiles_DAR","CMFlareLauncher"}; magazines[] = {"5000Rnd_762x51_Yellow_Belt","24Rnd_missiles","168Rnd_CMFlare_Chaff_Magazine"}; + class Turrets: Turrets { class MainTurret: MainTurret { canEject = 1; @@ -268,36 +245,37 @@ class CfgVehicles { class I_Heli_light_03_F: I_Heli_light_03_base_F { class Turrets: Turrets { class MainTurret: MainTurret {}; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; }; - class I_Heli_light_03_unarmed_base_F: I_Heli_light_03_base_F { - //class MFD {}; - }; + class I_Heli_light_03_unarmed_base_F: I_Heli_light_03_base_F {}; + class I_Heli_light_03_unarmed_F: I_Heli_light_03_unarmed_base_F {}; class Plane_CAS_01_base_F: Plane_Base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; - //class MFD {}; + class Turrets; + #include }; class Plane_CAS_02_base_F: Plane_Base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; + class Turrets; + #include }; class Plane_Fighter_03_base_F: Plane_Base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; + class Turrets; + #include }; @@ -308,34 +286,34 @@ class CfgVehicles { }; class UAV_02_base_F: UAV { + weapons[] = {}; + magazines[] = {}; + class Turrets { class MainTurret; }; - weapons[] = {}; - magazines[] = {}; }; class UAV_02_CAS_base_F: UAV_02_base_F { + weapons[] = {}; + magazines[] = {}; + /*class Turrets: Turrets { class MainTurret: MainTurret {}; };*/ - weapons[] = {}; - magazines[] = {}; }; class B_Heli_Transport_03_base_F: Helicopter_Base_H { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; }; //class MainTurret: MainTurret {}; class RightDoorGun: MainTurret {}; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; }; @@ -346,9 +324,6 @@ class CfgVehicles { }; //class MainTurret: MainTurret {}; //class RightDoorGun: MainTurret {}; - - //class CargoTurret_01: CargoTurret {}; - //class CargoTurret_02: CargoTurret_01 {}; }; }; @@ -356,6 +331,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -374,15 +350,6 @@ class CfgVehicles { class LoadmasterTurret: LoadmasterTurret { canEject = 1; }; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; - class CargoTurret_03: CargoTurret_01 {}; - class CargoTurret_04: CargoTurret_01 {}; - class CargoTurret_05: CargoTurret_01 {}; - class CargoTurret_06: CargoTurret_05 {}; - class CargoTurret_07: CargoTurret_05 {}; - class CargoTurret_08: CargoTurret_05 {}; }; }; @@ -394,9 +361,6 @@ class CfgVehicles { class LoadmasterTurret: LoadmasterTurret { canEject = 1; }; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; }; }; diff --git a/addons/aircraft/CfgWeapons.hpp b/addons/aircraft/CfgWeapons.hpp index 321df4a3af..c5f22fc3a2 100644 --- a/addons/aircraft/CfgWeapons.hpp +++ b/addons/aircraft/CfgWeapons.hpp @@ -4,15 +4,10 @@ class Mode_Burst; class Mode_FullAuto; class CfgWeapons { - class MGunCore; - class MGun: MGunCore {}; - - class LMG_RCWS: MGun {}; - // Manual Switching Of Flare Mode class SmokeLauncher; class CMFlareLauncher: SmokeLauncher { - modes[] = {"Single", "Burst", "AIBurst"}; + modes[] = {"Single","Burst","AIBurst"}; class Single: Mode_SemiAuto { reloadTime = 0.1; }; @@ -21,13 +16,15 @@ class CfgWeapons { }; }; + // bigger mag for comanche class CannonCore; class gatling_20mm: CannonCore { - magazines[] = {"2000Rnd_20mm_shells","1000Rnd_20mm_shells","300Rnd_20mm_shells","ACE_500Rnd_20mm_shells_Comanche"}; + magazines[] += {"ACE_500Rnd_20mm_shells_Comanche"}; + // buff gatling rof class manual: CannonCore { - reloadTime = 0.023; - dispersion = 0.006; + reloadTime = 0.023; //0.04; + dispersion = 0.006; //0.0022; }; class close: manual {}; class short: close {}; @@ -36,21 +33,14 @@ class CfgWeapons { }; class ACE_gatling_20mm_Comanche: gatling_20mm { - displayName = "XM301"; - class close: close { - reloadTime = 0.04; - dispersion = 0.0022; - }; - class far: far { - reloadTime = 0.04; - dispersion = 0.0022; - }; + displayName = "$STR_ACE_Aircraft_gatling_20mm_Name"; + class manual: manual { reloadTime = 0.04; dispersion = 0.0022; - displayName = "XM301"; + displayName = "$STR_ACE_Aircraft_gatling_20mm_Name"; }; - class medium: medium { + class close: close { reloadTime = 0.04; dispersion = 0.0022; }; @@ -58,38 +48,53 @@ class CfgWeapons { reloadTime = 0.04; dispersion = 0.0022; }; + class medium: medium { + reloadTime = 0.04; + dispersion = 0.0022; + }; + class far: far { + reloadTime = 0.04; + dispersion = 0.0022; + }; }; + // buff gatling rof + class MGunCore; + class MGun: MGunCore {}; + + class LMG_RCWS: MGun {}; + class LMG_Minigun: LMG_RCWS { - magazines[] = {"1000Rnd_65x39_Belt","1000Rnd_65x39_Belt_Green","1000Rnd_65x39_Belt_Tracer_Green","1000Rnd_65x39_Belt_Tracer_Red","1000Rnd_65x39_Belt_Tracer_Yellow","1000Rnd_65x39_Belt_Yellow","2000Rnd_65x39_Belt","2000Rnd_65x39_Belt_Green","2000Rnd_65x39_Belt_Tracer_Green","2000Rnd_65x39_Belt_Tracer_Green_Splash","2000Rnd_65x39_Belt_Tracer_Red","2000Rnd_65x39_Belt_Tracer_Yellow","2000Rnd_65x39_Belt_Tracer_Yellow_Splash","2000Rnd_65x39_Belt_Yellow","2000Rnd_762x51_Belt_T_Green","2000Rnd_762x51_Belt_T_Red","2000Rnd_762x51_Belt_T_Yellow","200Rnd_65x39_Belt","200Rnd_65x39_Belt_Tracer_Green","200Rnd_65x39_Belt_Tracer_Red","200Rnd_65x39_Belt_Tracer_Yellow","5000Rnd_762x51_Belt","5000Rnd_762x51_Yellow_Belt"}; class manual: MGun { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.075; //0.015; + dispersion = 0.00093; //0.006; }; class close: manual {}; class short: close {}; class medium: close {}; class far: close {}; }; + class LMG_Minigun_heli: LMG_Minigun { showAimCursorInternal = 0; class manual: manual { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.015; //0.033; Note: This is a way to fast ROF (requires over 60 FPS) @todo + dispersion = 0.006; //0.0087; }; class close: manual {}; class short: close {}; class medium: close {}; class far: close {}; }; + class M134_minigun: MGunCore { class LowROF: Mode_FullAuto { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.015; //0.03; same as above @todo + dispersion = 0.006; //0.0023; }; class HighROF: LowROF { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.015; //0.03; + dispersion = 0.006; //0.0023; }; class close: HighROF {}; class short: close {}; @@ -100,19 +105,10 @@ class CfgWeapons { class Gatling_30mm_Plane_CAS_01_F: CannonCore { autoFire = 1; burst = 1; - reloadTime = 0.0154; class LowROF: Mode_FullAuto { autoFire = 0; - //burst = 65; - burst = 22; - //reloadTime = 0.0154; - reloadTime = 0.0462; - //sound[] = {"A3\Sounds_F_epc\weapons\cas_02_cannon",1.77828,1,3800}; - sound[] = {"A3\Sounds_F_EPC\Weapons\gau_03_burst",2.51189,1,4500,{25704,32159}}; - weaponSoundEffect = "DefaultRifle"; - dispersion = 0.005; - soundContinuous = 1; - textureType = "burst"; + burst = 22; //65; + reloadTime = 0.0462; //0.0154; //0.034; multiplier = 3; }; class close: LowROF {}; @@ -121,120 +117,4 @@ class CfgWeapons { class medium: close {}; class far: close {}; }; - - class RocketPods; - class Missile_AA_04_Plane_CAS_01_F: RocketPods { - holdsterAnimValue = 2; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - autoFire = 0; - cursor = "EmptyCursor"; - cursorAim = "missile"; - nameSound = "MissileLauncher"; - textureType = "fullAuto"; - weaponLockDelay = 3; - minRange = 300; - minRangeProbab = 0.25; - midRange = 2500; - midRangeProbab = 0.9; - maxRange = 9000; - maxRangeProbab = 0.01; - }; - - class MissileLauncher; - class Missile_AGM_02_Plane_CAS_01_F: MissileLauncher { - holdsterAnimValue = 3; - magazineReloadTime = 30; - reloadTime = 0.001; - textureType = "semi"; - weaponLockDelay = 3; - weaponSoundEffect = "DefaultRifle"; - }; - - class Rocket_04_HE_Plane_CAS_01_F: RocketPods { - holdsterAnimValue = 4; - canLock = 1; - modes[] = {"Far_AI","Medium_AI","Close_AI","Burst"}; - weaponLockDelay = 0; - class Far_AI: RocketPods { - canLock = 1; - weaponLockDelay = 0; - showToPlayer = 0; - minRange = 800; - minRangeProbab = 0.31; - midRange = 2500; - midRangeProbab = 0.71; - maxRange = 3200; - maxRangeProbab = 0.1; - burst = 1; - reloadTime = 0.001; - autoFire = 0; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - }; - class Medium_AI: Far_AI {}; - class Close_AI: Far_AI {}; - class Burst: RocketPods { - burst = 1; - reloadTime = 0.002; - minRange = 300; - minRangeProbab = 0.25; - midRange = 400; - midRangeProbab = 0.7; - maxRange = 1300; - maxRangeProbab = 0.1; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - autoFire = 0; - soundContinuous = 0; - textureType = "fullAuto"; - weaponSoundEffect = "DefaultRifle"; - }; - }; - - class Rocket_04_AP_Plane_CAS_01_F: Rocket_04_HE_Plane_CAS_01_F { - holdsterAnimValue = 5; - }; - - class Bomb_04_Plane_CAS_01_F: RocketPods { - holdsterAnimValue = 6; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - missileLockCone = 180; - nameSound = ""; - textureType = "fullAuto"; - weaponLockDelay = 1; - }; - - class Cannon_30mm_Plane_CAS_02_F: CannonCore { - scope = 1; - holdsterAnimValue = 1; - ballisticsComputer = 2; - canLock = 1; - modes[] = {"LowROF","close","near","short","medium","far"}; - nameSound = "cannon"; - shotFromTurret = 0; - muzzlePos = "Cannon_muzzleflash"; - muzzleEnd = "Cannon_barrel_end"; - selectionFireAnim = "Cannon_muzzleflash"; - autoFire = 1; - burst = 5; - reloadTime = 0.04; - class GunParticles { - class Effect { - effectName = "MachineGun2"; - positionName = "Cannon_barrel_start"; - directionName = "Cannon_barrel_end"; - }; - }; - class LowROF: Mode_FullAuto { - dispersion = 0.0055; - reloadTime = 0.04; - }; - class close: LowROF {}; - class near: close {}; - class short: close {}; - class medium: close {}; - class far: close {}; - }; }; diff --git a/addons/aircraft/config.cpp b/addons/aircraft/config.cpp index 93e4eb8efe..86135c4bc9 100644 --- a/addons/aircraft/config.cpp +++ b/addons/aircraft/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"KoffeinFlummi","Crusty"}; + author[] = {"KoffeinFlummi","Crusty","commy2"}; authorUrl = "https://github.com/KoffeinFlummi/"; VERSION_CONFIG; }; diff --git a/addons/aircraft/stringtable.xml b/addons/aircraft/stringtable.xml index da013cac5e..4d1c49fff6 100644 --- a/addons/aircraft/stringtable.xml +++ b/addons/aircraft/stringtable.xml @@ -14,6 +14,18 @@ Rajada Raffica + + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + Open Cargo Door Laderampe öffnen @@ -35,4 +47,4 @@ Закрыть грузовой отсек - \ No newline at end of file + diff --git a/addons/attach/$PBOPREFIX$ b/addons/attach/$PBOPREFIX$ index 1e4e48a4ca..71a2f40af8 100644 --- a/addons/attach/$PBOPREFIX$ +++ b/addons/attach/$PBOPREFIX$ @@ -1 +1 @@ -z\ace\Addons\laser \ No newline at end of file +z\ace\Addons\attach \ No newline at end of file diff --git a/addons/attach/CfgEventHandlers.hpp b/addons/attach/CfgEventHandlers.hpp index 5eca7fa129..f0a9f14d91 100644 --- a/addons/attach/CfgEventHandlers.hpp +++ b/addons/attach/CfgEventHandlers.hpp @@ -1,5 +1,6 @@ + class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); - }; -}; \ No newline at end of file + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/attach/CfgMagazines.hpp b/addons/attach/CfgMagazines.hpp index 293a075d70..d63b8db36b 100644 --- a/addons/attach/CfgMagazines.hpp +++ b/addons/attach/CfgMagazines.hpp @@ -1,10 +1,12 @@ + class CfgMagazines { - class CA_Magazine; - class B_IR_Grenade: CA_Magazine { - ACE_Attachable = 1; - }; - class SmokeShell; - class Chemlight_green: SmokeShell { - ACE_Attachable = 1; - }; -}; \ No newline at end of file + class CA_Magazine; + class B_IR_Grenade: CA_Magazine { + ACE_Attachable = 1; + }; + + class SmokeShell; + class Chemlight_green: SmokeShell { + ACE_Attachable = 1; + }; +}; diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index a8653b9e06..b681c0f7f7 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -1,104 +1,154 @@ -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -}; + +#define MACRO_ATTACHTOVEHICLE \ + class ACE_Actions { \ + class ACE_MainActions { \ + selection = ""; \ + distance = 5; \ + condition = "true"; \ + class GVAR(AttachVehicle) { \ + displayName = "$STR_ACE_Attach_AttachDetach"; \ + condition = QUOTE(([ARR_3(_player, _target, '')] call FUNC(canAttach))); \ + statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI);); \ + exceptions[] = {"ACE_Drag_isNotDragging"}; \ + showDisabled = 0; \ + priority = 0; \ + icon = PATHTOF(UI\attach_ca.paa); \ + distance = 4; \ + }; \ + class GVAR(DetachVehicle) { \ + displayName = "$STR_ACE_Attach_Detach"; \ + condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canDetach))); \ + statement = QUOTE( [ARR_2(_player, _target)] call FUNC(detach) ); \ + exceptions[] = {"ACE_Drag_isNotDragging"}; \ + showDisabled = 0; \ + priority = 0; \ + icon = PATHTOF(UI\detach_ca.paa); \ + distance = 4; \ + }; \ + }; \ + }; class CfgVehicles { - class Man; - class CAManBase: Man { - class ACE_SelfActions { - class ACE_Equipment { - class GVAR(Attach) { - displayName = "$STR_ACE_Attach_AttachDetach"; - condition = QUOTE( [_player, ''] call FUNC(canAttach) ); - statement = QUOTE( [_player] call FUNC(openAttachUI); ); - exceptions[] = {"ACE_Drag_isNotDragging"}; - showDisabled = 0; - priority = 5; - icon = PATHTOF(UI\attach_ca.paa); - hotkey = "T"; + class LandVehicle; + class Car: LandVehicle { + MACRO_ATTACHTOVEHICLE + }; + + class Tank: LandVehicle { + MACRO_ATTACHTOVEHICLE + }; + + class Air; + class Helicopter: Air { + MACRO_ATTACHTOVEHICLE + }; + + class Plane: Air { + MACRO_ATTACHTOVEHICLE + }; + + class Ship; + class Ship_F: Ship { + MACRO_ATTACHTOVEHICLE + }; + + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(Attach) { + displayName = "$STR_ACE_Attach_AttachDetach"; + condition = QUOTE(([ARR_3(_player, _player, '')] call FUNC(canAttach))); + statement = QUOTE( [ARR_2(_player, _player)] call FUNC(openAttachUI); ); + exceptions[] = {"ACE_Drag_isNotDragging"}; + showDisabled = 0; + priority = 5; + icon = PATHTOF(UI\attach_ca.paa); + hotkey = "T"; + }; + class GVAR(Detach) { + displayName = "$STR_ACE_Attach_Detach"; + condition = QUOTE(([ARR_2(_player, _player)] call FUNC(canDetach))); + statement = QUOTE( [ARR_2(_player, _player)] call FUNC(detach) ); + exceptions[] = {"ACE_Drag_isNotDragging"}; + showDisabled = 0; + priority = 5; + icon = PATHTOF(UI\detach_ca.paa); + hotkey = "T"; + }; + }; }; - class GVAR(Detach) { - displayName = "$STR_ACE_Attach_Detach"; - condition = QUOTE( [_player] call FUNC(canDetach) ); - statement = QUOTE( [_player] call FUNC(detach) ); - exceptions[] = {"ACE_Drag_isNotDragging"}; - showDisabled = 0; - priority = 5; - icon = PATHTOF(UI\detach_ca.paa); - hotkey = "T"; + }; + + class All; + class ACE_IR_Strobe_Effect: All { + scope = 1; + displayName = "IR Strobe"; + model = "\A3\Weapons_F\empty.p3d"; + simulation = "nvmarker"; + + class NVGMarker { + diffuse[] = {0.006, 0.006, 0.006, 1}; + ambient[] = {0.005, 0.005, 0.005, 1}; + brightness = 0.2; + name = "pozicni blik"; + drawLightSize = 0.2; + drawLightCenterSize = 0.003; + activeLight = 0; + blinking=1; + blinkingStartsOn=1; + blinkingPattern[] = {2,2}; + blinkingPatternGuarantee = false; + dayLight = 0; + onlyInNvg = 1; + useFlare = 0; }; - }; + + side = 7;//-1=NO_SIDE yellow box,3=CIV grey box,4=NEUTRAL yellow box,6=FRIENDLY green box,7=LOGIC no radar signature + accuracy = 1000; + cost = 0; + armor = 500; + threat[] = {0,0,0}; + nameSound = ""; + type = 0; + weapons[] = {}; + magazines[] = {}; + nvTarget = 1; + destrType = "DestructNo"; + brightness = 20; }; - }; - class All; - class ACE_IR_Strobe_Effect: All { - scope = 1; - displayName = "IR Strobe"; - model = "\A3\Weapons_F\empty.p3d"; - simulation = "nvmarker"; - - class NVGMarker { - diffuse[] = {0,0,0}; - ambient[] = {0,0,0}; - brightness = 0.004; - name = "pozicni blik"; - drawLight = 1; - drawLightSize = 0.005; - drawLightCenterSize = 0.003; - activeLight = 0; - blinking=1; - dayLight = 0; - onlyInNvg = 1; - useFlare = 0; + class NATO_Box_Base; + class Box_NATO_Support_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); + }; }; - side = 7;//-1=NO_SIDE yellow box,3=CIV grey box,4=NEUTRAL yellow box,6=FRIENDLY green box,7=LOGIC no radar signature - accuracy = 1000; - cost = 0; - armor = 500; - threat[] = {0,0,0}; - nameSound = ""; - type = 0; - weapons[] = {}; - magazines[] = {}; - nvTarget = 1; - destrType = "DestructNo"; - brightness = 20; - }; - class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class FIA_Box_Base_F; - - class Box_NATO_Support_F: NATO_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + class EAST_Box_Base; + class Box_East_Support_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); + }; }; - }; - class Box_East_Support_F: EAST_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + class IND_Box_Base; + class Box_IND_Support_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); + }; }; - }; - class Box_IND_Support_F: IND_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + class FIA_Box_Base_F; + class Box_FIA_Support_F: FIA_Box_Base_F { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); + }; }; - }; - class Box_FIA_Support_F: FIA_Box_Base_F { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); + }; }; - }; - - class ACE_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) - }; - }; -}; \ No newline at end of file +}; diff --git a/addons/attach/CfgWeapons.hpp b/addons/attach/CfgWeapons.hpp index 65ca397ec9..4ad34832c5 100644 --- a/addons/attach/CfgWeapons.hpp +++ b/addons/attach/CfgWeapons.hpp @@ -1,16 +1,19 @@ -class CfgWeapons { - class ACE_ItemCore; - class InventoryItem_Base_F; - class ACE_IR_Strobe_Item: ACE_ItemCore { - displayName = "$STR_ACE_IrStrobe_Name"; - descriptionShort = "$STR_ACE_IrStrobe_Description"; - model = "\A3\weapons_F\ammo\mag_univ.p3d"; - picture = PATHTOF(UI\irstrobe_item.paa); - scope = 2; - ACE_attachable = 1; - class ItemInfo: InventoryItem_Base_F { - mass = 1; +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_IR_Strobe_Item: ACE_ItemCore { + ACE_attachable = 1; + author = "$STR_ACE_Common_ACETeam"; + scope = 2; + displayName = "$STR_ACE_IrStrobe_Name"; + descriptionShort = "$STR_ACE_IrStrobe_Description"; + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + picture = PATHTOF(UI\irstrobe_item.paa); + + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; }; - }; -}; \ No newline at end of file +}; diff --git a/addons/attach/README.md b/addons/attach/README.md index 7ac36f109d..5fb73d0645 100644 --- a/addons/attach/README.md +++ b/addons/attach/README.md @@ -1,7 +1,8 @@ ace_attach ========== -Introducing the ability to attach various throwables to yourself to mark your position and assist in IFF. +Introducing the ability to attach various throwables to yourself or vehicles, to mark your position and assist in IFF. +Adds item `ACE_IR_Strobe_Item`. ## Maintainers @@ -11,3 +12,4 @@ The people responsible for merging changes to this component or answering potent - [esteldunedain](https://github.com/esteldunedain) - [bux578](https://github.com/bux578) - [KoffeinFlummi](https://github.com/KoffeinFlummi) +- [PabstMirror](https://github.com/PabstMirror) diff --git a/addons/attach/XEH_preInit.sqf b/addons/attach/XEH_preInit.sqf index bcbd7e543c..63eb2e8438 100644 --- a/addons/attach/XEH_preInit.sqf +++ b/addons/attach/XEH_preInit.sqf @@ -1,7 +1,13 @@ #include "script_component.hpp" +ADDON = false; + PREP(attach); PREP(canAttach); PREP(canDetach); PREP(detach); -PREP(openAttachUI); \ No newline at end of file +PREP(openAttachUI); +PREP(placeApprove); +PREP(placeCancel); + +ADDON = true; diff --git a/addons/attach/config.cpp b/addons/attach/config.cpp index 4143f6eb44..dd7e1add3b 100644 --- a/addons/attach/config.cpp +++ b/addons/attach/config.cpp @@ -1,21 +1,18 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {"ACE_IR_Strobe_Item"}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common", "ace_interaction"}; - author[] = {"KoffeinFlummi", "eRazeri", "CAA-Picard"}; - authorUrl = "https://github.com/KoffeinFlummi/"; - VERSION_CONFIG; - }; + class ADDON { + units[] = {}; + weapons[] = {"ACE_IR_Strobe_Item"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"KoffeinFlummi","eRazeri","CAA-Picard"}; + authorUrl = "https://github.com/KoffeinFlummi/"; + VERSION_CONFIG; + }; }; #include "CfgEventHandlers.hpp" - -#include "CfgVehicles.hpp" - -#include "CfgWeapons.hpp" - #include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index ab920c6428..3aa06bacc2 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -1,62 +1,90 @@ +/* + * Author: eRazeri and CAA-Picard + * Attach an item to the unit + * + * Arguments: + * 0: unit doing the attach (player) + * 1: vehicle that it will be attached to (player or vehicle) + * 2: Name of the attachable item + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ #include "script_component.hpp" -/* -Author: eRazeri and CAA-Picard +PARAMS_3(_unit,_attachToVehicle,_itemName); -Attach an item to the unit +//Sanity Check (_unit has item in inventory, not over attach limit) +if !([_unit, _attachToVehicle, _itemName] call FUNC(canAttach)) exitWith {ERROR("Tried to attach, but check failed");}; -Arguments: -0: unit -1: Item name +private ["_itemVehClass", "_onAtachText", "_selfAttachPosition"]; -Return Value: -none -*/ +_itemVehClass = ""; +_onAtachText = ""; +_selfAttachPosition = [_unit, [-0.05, 0, 0.12], "rightshoulder"]; -private ["_unit", "_itemName", "_attachedItem"]; - -_unit = _this select 0; -_itemName = _this select 1; - -// Check if unit has an attached item -if (_unit getVariable [QGVAR(ItemName), ""] != "") exitWith {}; - -// Check if the unit still has the item -if !((_itemName in items _unit) or (_itemName in magazines _unit)) exitWith {}; - -// Attach item -switch true do { - case (_itemName == "ACE_IR_Strobe_Item") : { - _attachedItem = "ACE_IR_Strobe_Effect" createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[0,-0.11,0.16],"pilot"];//makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri - [localize "STR_ACE_Attach_IrStrobe_Attached"] call EFUNC(common,displayTextStructured); - }; - case (_itemName == "B_IR_Grenade") : { - _attachedItem = "B_IRStrobe" createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[-0.05,0,0.12],"rightshoulder"]; - [localize "STR_ACE_Attach_IrGrenade_Attached"] call EFUNC(common,displayTextStructured); - }; - case (_itemName == "O_IR_Grenade") : { - _attachedItem = "O_IRStrobe" createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[-0.05,0,0.12],"rightshoulder"]; - [localize "STR_ACE_Attach_IrGrenade_Attached"] call EFUNC(common,displayTextStructured); - }; - case (_itemName == "I_IR_Grenade") : { - _attachedItem = "I_IRStrobe" createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[-0.05,0,0.12],"rightshoulder"]; - [localize "STR_ACE_Attach_IrGrenade_Attached"] call EFUNC(common,displayTextStructured); - }; - case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}) : { - _attachedItem = _itemName createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[-0.05,0,0.12],"rightshoulder"]; - [localize "STR_ACE_Attach_Chemlight_Attached"] call EFUNC(common,displayTextStructured);; - }; - default { - if (true) exitWith {}; - }; +switch (true) do { + case (_itemName == "ACE_IR_Strobe_Item"): { + _itemVehClass = "ACE_IR_Strobe_Effect"; + _onAtachText = localize "STR_ACE_Attach_IrStrobe_Attached"; + //_selfAttachPosition = [_unit, [0, -0.11, 0.16], "pilot"]; //makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri + }; + case (_itemName == "B_IR_Grenade"): { + _itemVehClass = "B_IRStrobe"; + _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; + }; + case (_itemName == "O_IR_Grenade"): { + _itemVehClass = "O_IRStrobe"; + _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; + }; + case (_itemName == "I_IR_Grenade"): { + _itemVehClass = "I_IRStrobe"; + _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; + }; + case (toLower _itemName in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]): { + _itemVehClass = _itemName; + _onAtachText = localize "STR_ACE_Attach_Chemlight_Attached"; + }; }; -// Remove item -_unit removeItem _itemName; -_unit setVariable [QGVAR(ItemName), _itemName, true]; -_unit setVariable [QGVAR(Item), _attachedItem, true]; +if (_itemVehClass == "") exitWith {ERROR("no _itemVehClass for Item");}; + +if (_unit == _attachToVehicle) then { //Self Attachment + _unit removeItem _itemName; // Remove item + _attachedItem = _itemVehClass createVehicle [0,0,0]; + _attachedItem attachTo _selfAttachPosition; + [_onAtachText] call EFUNC(common,displayTextStructured); + _attachToVehicle setVariable [QGVAR(Objects), [_attachedItem], true]; + _attachToVehicle setVariable [QGVAR(ItemNames), [_itemName], true]; +} else { + GVAR(setupObject) = _itemVehClass createVehicleLocal [0,0,-10000]; + GVAR(setupObject) enableSimulationGlobal false; + GVAR(SetupPlacmentText) = _onAtachText; + GVAR(SetupPlacmentItem) = _itemName; + GVAR(SetupAttachVehicle) = _attachToVehicle; + GVAR(placer) = _unit; + [_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); + + [QGVAR(PlacementEachFrame),"OnEachFrame", { + private "_player"; + _player = ACE_player; + //Stop if player switch or player gets to far from vehicle + if (GVAR(placer) != _player || {_player distance GVAR(SetupAttachVehicle) > 7}) exitWith { + call FUNC(placeCancel); + }; + GVAR(pfeh_running) = true; + _pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); + GVAR(setupObject) setPosATL _pos; + }] call BIS_fnc_addStackedEventHandler; // @todo replace with CBA PFH + + //had to delay the mouseHint, not sure why + [{[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint)}, [], 0, 0] call EFUNC(common,waitAndExecute); + + _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) && {!isNull (GVAR(setupObject))}}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; + _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) && {!isNull (GVAR(setupObject))}}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; +}; diff --git a/addons/attach/functions/fnc_canAttach.sqf b/addons/attach/functions/fnc_canAttach.sqf index fe5191d7e2..1c33f7b112 100644 --- a/addons/attach/functions/fnc_canAttach.sqf +++ b/addons/attach/functions/fnc_canAttach.sqf @@ -1,21 +1,27 @@ -#include "script_component.hpp" - /* * Author: commy2 - * * Check if a unit can attach a specific item. - * - * Argument: - * 0: Unit that wants to attach the object (Object) - * 1: Name of the attachable item (String) - * - * Return value: - * Boolean (Bool) + * + * Arguments: + * 0: unit doing the attach (player) + * 1: vehicle that it will be attached to (player or vehicle) + * 2: Name of the attachable item + * + * Return Value: + * Boolean + * + * Example: + * Nothing + * + * Public: No */ +#include "script_component.hpp" -private ["_unit", "_item"]; +PARAMS_3(_unit,_attachToVehicle,_item); -_unit = _this select 0; -_item = _this select 1; +private ["_attachLimit", "_attachedObjects"]; -canStand _unit && {_unit getVariable [QGVAR(ItemName), ""] == ""} && {_item in (magazines _unit + items _unit + [""])} +_attachLimit = [10, 1] select (_unit == _attachToVehicle); +_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; + +canStand _unit && {alive _attachToVehicle} && {count _attachedObjects < _attachLimit} && {_item in (itemsWithMagazines _unit + [""])} diff --git a/addons/attach/functions/fnc_canDetach.sqf b/addons/attach/functions/fnc_canDetach.sqf index 3ddfc6c11e..ad2f68776c 100644 --- a/addons/attach/functions/fnc_canDetach.sqf +++ b/addons/attach/functions/fnc_canDetach.sqf @@ -1,19 +1,40 @@ -#include "script_component.hpp" - /* * Author: commy2 - * * Check if a unit has an item attached and if it can remove that item. - * - * Argument: - * 0: Unit that wants to detach something (Object) - * - * Return value: - * Boolean (Bool) + * + * Arguments: + * 0: unit doing the detaching (player) + * 1: vehicle that it will be detached from (player or vehicle) + * + * Return Value: + * Boolean + * + * Example: + * Nothing + * + * Public: No */ +#include "script_component.hpp" -private "_unit"; +PARAMS_2(_unit,_attachToVehicle); -_unit = _this select 0; +private ["_attachedObjects", "_inRange"]; -canStand _unit && {_unit getVariable [QGVAR(ItemName), ""] != ""} +_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; + +_inRange = false; +if (_unit == _attachToVehicle) then { + _inRange = count _attachedObjects > 0; +} else { + //Scan if unit is within range (using 2d distance) + private ["_unitPos", "_objectPos"]; + _unitPos = getPos _unit; + _unitPos set [2,0]; + { + _objectPos = getPos _x; + _objectPos set [2, 0]; + if (_objectPos distance _unitPos < 4) exitWith {_inRange = true}; + } forEach _attachedObjects; +}; + +canStand _unit && {_inRange} && {alive _attachToVehicle} diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index 3ecac44d62..8fb9e3cc9c 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -1,63 +1,86 @@ +/* + * Author: eRazeri and CAA-Picard + * Detach an item from a unit + * + * Arguments: + * 0: unit doing the attaching (player) + * 1: vehicle that it will be detached from (player or vehicle) + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ #include "script_component.hpp" -/* -Author: eRazeri and CAA-Picard +PARAMS_2(_unit,_attachToVehicle); -Detach an item from a unit +private ["_attachedObjects", "_attachedItems"]; -Arguments: -unit +_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; +_attachedItems = _attachToVehicle getVariable [QGVAR(ItemNames), []]; -Return Value: -none -*/ +private ["_attachedObject", "_attachedIndex", "_itemName", "_minDistance", "_unitPos", "_objectPos"]; -private ["_unit", "_itemName", "_count", "_attachedItem", "_fnc_detachDelay"]; +_attachedObject = objNull; +_attachedIndex = -1; +_itemName = ""; -_unit = _this select 0; -_itemName = _unit getVariable [QGVAR(ItemName), ""]; -_attachedItem = _unit getVariable [QGVAR(Item), objNull]; +//Find closest attached object +_minDistance = 1000; +_unitPos = getPos _unit; +_unitPos set [2,0]; +{ + _objectPos = getPos _x; + _objectPos set [2, 0]; + if (_objectPos distance _unitPos < _minDistance) then { + _minDistance = _objectPos distance _unitPos; + _attachedObject = _x; + _itemName = _attachedItems select _forEachIndex; + _attachedIndex = _forEachIndex; + }; +} forEach _attachedObjects; // Check if unit has an attached item -if (_itemName == "") exitWith {}; +if (isNull _attachedObject || {_itemName == ""}) exitWith {ERROR("Could not find attached object")}; -// Add item to inventory -_count = (count items _unit) + (count magazines _unit); -_unit addItem _itemName; -if ((count items _unit) + (count magazines _unit) <= _count) exitWith { - [localize "STR_ACE_Attach_Inventory_Full"] call EFUNC(common,displayTextStructured); +// Exit if can't add the item +if !(_unit canAdd _itemName) exitWith { + [localize "STR_ACE_Attach_Inventory_Full"] call EFUNC(common,displayTextStructured); }; -if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") then { - // Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle - detach _attachedItem; - _attachedItem setPos [getPos _unit select 0, getPos _unit select 1, ((getPos _unit select 2) - 1000)]; - // Delete attached item after 0.5 seconds - _fnc_detachDelay = { - deleteVehicle (_this select 0); - }; - [_fnc_detachDelay, [_attachedItem], 0.5, 0] call EFUNC(common,waitAndExecute); +// Add item to inventory +_unit addItem _itemName; + +if (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) then { + // Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle + detach _attachedObject; + _attachedObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]); + // Delete attached item after 0.5 seconds + [{deleteVehicle (_this select 0)}, [_attachedObject], 0.5, 0] call EFUNC(common,waitAndExecute); } else { - // Delete attached item - deleteVehicle _attachedItem; + // Delete attached item + deleteVehicle _attachedObject; }; // Reset unit variables -_unit setVariable [QGVAR(ItemName),"", true]; -_unit setVariable [QGVAR(Item),nil, true]; +_attachedObjects deleteAt _attachedIndex; +_attachedItems deleteAt _attachedIndex; +_attachToVehicle setVariable [QGVAR(Objects), _attachedObjects, true]; +_attachToVehicle setVariable [QGVAR(ItemNames), _attachedItems, true]; // Display message -switch true do { - case (_itemName == "ACE_IR_Strobe_Item") : { - [localize "STR_ACE_Attach_IrStrobe_Detached"] call EFUNC(common,displayTextStructured); - }; - case (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") : { - [localize "STR_ACE_Attach_IrGrenade_Detached"] call EFUNC(common,displayTextStructured); - }; - case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}) : { - [localize "STR_ACE_Attach_Chemlight_Detached"] call EFUNC(common,displayTextStructured); - }; - default { - if (true) exitWith {}; - }; +switch (true) do { + case (_itemName == "ACE_IR_Strobe_Item") : { + [localize "STR_ACE_Attach_IrStrobe_Detached"] call EFUNC(common,displayTextStructured); + }; + case (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) : { + [localize "STR_ACE_Attach_IrGrenade_Detached"] call EFUNC(common,displayTextStructured); + }; + case (toLower _itemName in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]) : { + [localize "STR_ACE_Attach_Chemlight_Detached"] call EFUNC(common,displayTextStructured); + }; }; diff --git a/addons/attach/functions/fnc_openAttachUI.sqf b/addons/attach/functions/fnc_openAttachUI.sqf index 97046fa80b..5533956bb6 100644 --- a/addons/attach/functions/fnc_openAttachUI.sqf +++ b/addons/attach/functions/fnc_openAttachUI.sqf @@ -1,63 +1,67 @@ +/* + * Author: Garth de Wet (LH) + * Opens the UI for attaching objects. + * + * Arguments: + * 0: unit + * 1: target + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ #include "script_component.hpp" -/* - Author: Garth de Wet (LH) +private ["_actions", "_attachables", "_item"]; - Description: - Opens the UI for attaching objects. +PARAMS_2(_unit,_target); - Parameters: - 0: OBJECT - unit - - Returns: - Nothing - - Example: - [player] call ACE_Attach_fnc_openAttachUI; -*/ -private ["_unit", "_actions", "_attachables", "_item"]; -_unit = _this select 0; +GVAR(attachTarget) = _target; _listed = []; _attachables = magazines _unit; _actions = [localize "STR_ACE_Attach_AttachDetach", localize "STR_ACE_Attach_Attach"] call EFUNC(interaction,prepareSelectMenu); { - if !(_x in _listed) then { - _item = ConfigFile >> "CfgMagazines" >> _x; - if (getNumber (_item >> "ACE_Attachable") == 1) then { - _actions = [ - _actions, - getText(_item >> "displayName"), - getText(_item >> "picture"), - _x - ] call EFUNC(interaction,addSelectableItem); + if !(_x in _listed) then { + _item = ConfigFile >> "CfgMagazines" >> _x; + if (getNumber (_item >> "ACE_Attachable") == 1) then { + _actions = [ + _actions, + getText(_item >> "displayName"), + getText(_item >> "picture"), + _x + ] call EFUNC(interaction,addSelectableItem); + }; + _listed pushBack _x; }; - _listed pushBack _x; - }; } forEach _attachables; _attachables = items _unit; { - if !(_x in _listed) then { - _item = ConfigFile >> "CfgWeapons" >> _x; - if (getNumber (_item >> "ACE_Attachable") == 1) then { - _actions = [ - _actions, - getText(_item >> "displayName"), - getText(_item >> "picture"), - _x - ] call EFUNC(interaction,addSelectableItem); + if !(_x in _listed) then { + _item = ConfigFile >> "CfgWeapons" >> _x; + if (getNumber (_item >> "ACE_Attachable") == 1) then { + _actions = [ + _actions, + getText(_item >> "displayName"), + getText(_item >> "picture"), + _x + ] call EFUNC(interaction,addSelectableItem); + }; + _listed pushBack _x; }; - _listed pushBack _x; - }; } forEach _attachables; [ - _actions, - { - [ACE_player, _this] call FUNC(attach); - call EFUNC(interaction,hideMenu); - }, - { - call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; - } + _actions, + { + [ACE_player, GVAR(attachTarget), _this] call FUNC(attach); + call EFUNC(interaction,hideMenu); + }, + { + call EFUNC(interaction,hideMenu); + if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; + } ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf new file mode 100644 index 0000000000..c6277e2961 --- /dev/null +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -0,0 +1,110 @@ +/* + * Author: Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) + * Approves placement of the lightObject, scans for an appropriate location and attaches + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ +#include "script_component.hpp" + +private ["_setupObject", "_setupClassname", "_itemClassname", "_placementText", "_attachToVehicle", "_placer", "_startingPosition", "_startingOffset", "_distanceFromCenter", "_closeInUnitVector", "_keepGoingCloser", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_currentObjects", "_currentItemNames"]; + + +if (GVAR(pfeh_running)) then { + [QGVAR(PlacementEachFrame),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; + GVAR(pfeh_running) = false; +}; + +_setupObject = GVAR(setupObject); +_setupClassname = typeOf _setupObject; +_itemClassname = GVAR(SetupPlacmentItem); +_placementText = GVAR(SetupPlacmentText); +_attachToVehicle = GVAR(SetupAttachVehicle); +_placer = GVAR(placer); + +GVAR(SetupPlacmentItem) = ""; +GVAR(SetupPlacmentText) = ""; +GVAR(setupObject) = objNull; +GVAR(SetupAttachVehicle) = objNull; +GVAR(placer) = objNull; + +[_placer, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +[_placer, "DefaultAction", _placer getVariable [QGVAR(placeActionEH), -1]] call EFUNC(common,removeActionEventHandler); +[_placer, "MenuBack", _placer getVariable [QGVAR(cancelActionEH), -1]] call EFUNC(common,removeActionEventHandler); +call EFUNC(interaction,hideMouseHint); + +//A player can release the attachObject with it floating in mid-air. +//This will use lineIntersectsWith to scan towards the center of the vehicle to find a collision +//ArmA's collision detection is of couse terrible and often misses collisions (difference between what we see and collision LOD) +//So it does multiple scans at slighly different angles +//This is VERY computationaly intensive, but doesn't happen that often. + +_startingPosition = _setupObject modelToWorld [0,0,0]; +_startingOffset = _attachToVehicle worldToModel _startingPosition; + +_distanceFromCenter = vectorMagnitude _startingOffset; +_closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]); +_keepGoingCloser = true; +_closeInDistance = 0; + +while {_keepGoingCloser} do { + if (_closeInDistance >= _distanceFromCenter) exitWith {}; + + _closeInDistance = _closeInDistance + 0.01; //10mm each step + _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); + _endPosTestOffset set [2, (_startingOffset select 2)]; + _endPosTest = _attachToVehicle modelToWorld _endPosTestOffset; + + { + _startingPosShifted = _startingPosition vectorAdd _x; + _startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted}; + { + _endPosShifted = _endPosTest vectorAdd _x; + _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; + + //Uncomment to see the lazor show, and see how the scanning works: + drawLine3D [_startingPosShifted, _endPosShifted, [1,0,0,1]]; + + if (_attachToVehicle in lineIntersectsWith [_startASL, _endASL, _placer, _setupObject]) exitWith {_keepGoingCloser = false}; + } forEach [[0,0,0.045], [0,0,-0.045], [0,0.045,0], [0,-0.045,0], [0.045,0,0], [-0.045,0,0]]; + } forEach [[0,0,0], [0,0,0.05], [0,0,-0.05]]; +}; + +//Delete Local Placement Object +deleteVehicle _setupObject; + +//Checks +if ((_closeInDistance >= _distanceFromCenter) || (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach)))) exitWith { + TRACE_2("no valid spot found",_closeInDistance,_distanceFromCenter); + [localize "STR_ACE_Attach_Failed"] call EFUNC(common,displayTextStructured); +}; + +//Move it out slightly, for visability sake (better to look a little funny than be embedded//sunk in the hull) +_closeInDistance = (_closeInDistance - 0.0085); + +//Create New 'real' Object +_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); +_endPosTestOffset set [2, (_startingOffset select 2)]; +_attachedObject = _setupClassname createVehicle (getPos _placer); +_attachedObject attachTo [_attachToVehicle, _endPosTestOffset]; + +//Remove Item from inventory +_placer removeItem _itemClassname; + +//Add Object to ACE_AttachedObjects and ACE_AttachedItemNames +_currentObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; +_currentObjects pushBack _attachedObject; +_attachToVehicle setVariable [QGVAR(Objects), _currentObjects, true]; +_currentItemNames = _attachToVehicle getVariable [QGVAR(ItemNames), []]; +_currentItemNames pushBack _itemClassname; +_attachToVehicle setVariable [QGVAR(ItemNames), _currentItemNames, true]; + +[_placementText] call EFUNC(common,displayTextStructured); diff --git a/addons/attach/functions/fnc_placeCancel.sqf b/addons/attach/functions/fnc_placeCancel.sqf new file mode 100644 index 0000000000..3abdf848ba --- /dev/null +++ b/addons/attach/functions/fnc_placeCancel.sqf @@ -0,0 +1,35 @@ +/* + * Author: Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) + * Cancels placement of the lightObject + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ +#include "script_component.hpp" + +if (GVAR(pfeh_running)) then { + [QGVAR(PlacementEachFrame),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; + GVAR(pfeh_running) = false; +}; +if (!isNull (GVAR(setupObject))) then { + deleteVehicle GVAR(setupObject); +}; + +[GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +call EFUNC(interaction,hideMouseHint); +[GVAR(placer), "DefaultAction", GVAR(placer) getVariable [QGVAR(placeActionEH), -1]] call EFUNC(common,removeActionEventHandler); +[GVAR(placer), "MenuBack", GVAR(placer) getVariable [QGVAR(cancelActionEH), -1]] call EFUNC(common,removeActionEventHandler); + +GVAR(placer) = objNull; +GVAR(SetupPlacmentItem) = ""; +GVAR(SetupPlacmentText) = ""; +GVAR(setupObject) = objNull; +GVAR(SetupAttachVehicle) = objNull; diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index 877f26e623..13c468184b 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -1,5 +1,5 @@  - + @@ -146,5 +146,34 @@ Az infravörös jeladóval megjelölheted a helyzetedet úgy, hogy annak pulzáló fénye csak éjjellátó készülékkel látható. ИК строб позволяет сигнализировать свое местоположение через пульсирующий маяк, видимый только через ПНВ. + + Place + Platzieren + Colocar + Umieść + Placer + Položit + Colocar + Posiziona + Elhelyez + + + Cancel + Abbrechen + Cancelar + Anuluj + Annuler + Zrušit + Cancelar + Annulla + Mégse + + + Attach Failed + Échec du Attacher + Befestigen Fehlgeschlagen + Присоединить Ошибка + Error en Acoplar + - \ No newline at end of file + diff --git a/addons/backblast/$PBOPREFIX$ b/addons/backblast/$PBOPREFIX$ deleted file mode 100644 index c5ed230994..0000000000 --- a/addons/backblast/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\backblast \ No newline at end of file diff --git a/addons/backblast/CfgEventHandlers.hpp b/addons/backblast/CfgEventHandlers.hpp deleted file mode 100644 index a336a5dd41..0000000000 --- a/addons/backblast/CfgEventHandlers.hpp +++ /dev/null @@ -1,17 +0,0 @@ - -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit) ); - }; -}; - -class Extended_FiredNear_EventHandlers { - class CAManBase { - class GVAR(LauncherBackblast) { - FiredNear = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_Backblast_Damage') > 0}) then {_this call FUNC(launcherBackblast)} ); - }; - class GVAR(TankDangerZone) { - FiredNear = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_DangerZone_Damage') > 0}) then {_this call FUNC(tankDangerZone)} ); - }; - }; -}; diff --git a/addons/backblast/CfgWeapons.hpp b/addons/backblast/CfgWeapons.hpp deleted file mode 100644 index fcb4bde0c5..0000000000 --- a/addons/backblast/CfgWeapons.hpp +++ /dev/null @@ -1,44 +0,0 @@ -class CfgWeapons { - - class LauncherCore; - class Launcher: LauncherCore { - ACE_Backblast_Angle = 60; - ACE_Backblast_Range = 10; - ACE_Backblast_Damage = 0.7; - }; - class Launcher_Base_F: Launcher {}; - - class launch_Titan_base: Launcher_Base_F { - ACE_Backblast_Angle = 40; - ACE_Backblast_Range = 8; - ACE_Backblast_Damage = 0.5; - }; - class launch_Titan_short_base: launch_Titan_base { - ACE_Backblast_Angle = 40; - ACE_Backblast_Range = 8; - ACE_Backblast_Damage = 0.5; - }; - - class launch_NLAW_F: Launcher_Base_F { - ACE_Backblast_Angle = 40; - ACE_Backblast_Range = 5; - ACE_Backblast_Damage = 0.6; - }; - class launch_RPG32_F: Launcher_Base_F { - ACE_Backblast_Angle = 60; - ACE_Backblast_Range = 15; - ACE_Backblast_Damage = 0.7; - }; - - class CannonCore; - class cannon_120mm: CannonCore { - ACE_DangerZone_Angle = 90; - ACE_DangerZone_Range = 50; - ACE_DangerZone_Damage = 0.85; - }; - class mortar_155mm_AMOS: CannonCore { - ACE_DangerZone_Angle = 90; - ACE_DangerZone_Range = 60; - ACE_DangerZone_Damage = 1; - }; -}; diff --git a/addons/backblast/XEH_preInit.sqf b/addons/backblast/XEH_preInit.sqf deleted file mode 100644 index 1becf28c05..0000000000 --- a/addons/backblast/XEH_preInit.sqf +++ /dev/null @@ -1,5 +0,0 @@ -#include "script_component.hpp" - -PREP(getDistance); -PREP(launcherBackblast); -PREP(tankDangerZone); diff --git a/addons/backblast/functions/fnc_getDistance.sqf b/addons/backblast/functions/fnc_getDistance.sqf deleted file mode 100644 index 83b290e2b0..0000000000 --- a/addons/backblast/functions/fnc_getDistance.sqf +++ /dev/null @@ -1,31 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_position", "_direction", "_maxDistance", "_distance", "_iteration", "_laser", "_line"]; - -_position = + _this select 0; -_direction = + _this select 1; -_maxDistance = _this select 2; - -_distance = _maxDistance; -_iteration = _distance; -_laser = []; -_line = [_position, _laser]; - -while { - _iteration > 0.1 -} do { - _iteration = _iteration / 2; - - _laser set [0, (_position select 0) - _distance * (_direction select 0)]; - _laser set [1, (_position select 1) - _distance * (_direction select 1)]; - _laser set [2, (_position select 2) - _distance * (_direction select 2)]; - - _intersections = { - _x isKindOf "Static" || {_x isKindOf "AllVehicles"} - } count (lineIntersectsWith _line); - - _distance = _distance + ([1, -1] select (_intersections > 0)) * _iteration; -}; - -if (_distance > _maxDistance) then {999} else {_distance} diff --git a/addons/backblast/functions/fnc_launcherBackblast.sqf b/addons/backblast/functions/fnc_launcherBackblast.sqf deleted file mode 100644 index b2cde50c5d..0000000000 --- a/addons/backblast/functions/fnc_launcherBackblast.sqf +++ /dev/null @@ -1,72 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -_unit = _this select 0; -_firer = _this select 1; -_distance = _this select 2; -_weapon = _this select 3; - -if (vehicle _unit != _unit || {!([_firer] call EFUNC(common,isPlayer))}) exitWith {}; - -_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Angle") / 2; -_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Range"); -_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Damage"); - -_position = eyePos _firer; -_direction = _firer weaponDirection currentWeapon _firer; - -if (_unit == _firer) then { - _distance = [_position, _direction, _backblastRange] call FUNC(getDistance); - hint format ["%1", _distance]; - if (_distance < _backblastRange) then { - _alpha = sqrt (1 - _distance / _backblastRange); - _beta = sqrt 0.5; - - _damage = 2 * _alpha * _beta * _backblastDamage; - [_damage * 100] call BIS_fnc_bloodEffect; - - // TODO: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - } else { - _unit setDamage (damage _unit + _damage); - }; - - }; -} else { - _direction = [0, 0, 0] vectorDiff _direction; - - _azimuth = (_direction select 0) atan2 (_direction select 1); - _inclination = asin (_direction select 2); - - _relativePosition = eyePos _unit; - _relativeDirection = _relativePosition vectorDiff _position; - - _relativeAzimuth = (_relativeDirection select 0) atan2 (_relativeDirection select 1); - _relativeInclination = asin (_relativeDirection select 2); - - _angle = sqrt ((_relativeAzimuth - _azimuth) ^ 2 + (_relativeInclination - _inclination) ^ 2); - _distance = vectorMagnitude _relativeDirection; - - _line = [_position, _relativePosition]; - - if (_angle < _backblastAngle && {_distance < _backblastRange} && {!lineIntersects _line} && {!terrainIntersectASL _line}) then { - _alpha = sqrt (1 - _distance / _backblastRange); - _beta = sqrt (1 - _angle / _backblastAngle); - - _damage = 2 * _alpha * _beta * _backblastDamage; - if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; - - // TODO: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - _unit spawn { - sleep 0.5; - [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); - }; - } else { - _unit setDamage (damage _unit + _damage); - }; - - }; -}; diff --git a/addons/backblast/functions/fnc_tankDangerZone.sqf b/addons/backblast/functions/fnc_tankDangerZone.sqf deleted file mode 100644 index 0371ec9620..0000000000 --- a/addons/backblast/functions/fnc_tankDangerZone.sqf +++ /dev/null @@ -1,54 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -#define BARREL_MUZZLE "usti hlavne" - -_unit = _this select 0; -_vehicle = vehicle (_this select 1); -_distance = _this select 2; -_weapon = _this select 3; - -if (vehicle _unit != _unit || {!([gunner _firer] call EFUNC(common,isPlayer))}) exitWith {}; - -_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Angle") / 2; -_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Range"); -_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Damage"); - -_position = ATLToASL (_vehicle modelToWorld (_vehicle selectionPosition BARREL_MUZZLE)); -_direction = _vehicle weaponDirection _weapon; - -if (_unit != _vehicle) then { - _azimuth = (_direction select 0) atan2 (_direction select 1); - _inclination = asin (_direction select 2); - - _relativePosition = eyePos _unit; - _relativeDirection = _relativePosition vectorDiff _position; - - _relativeAzimuth = (_relativeDirection select 0) atan2 (_relativeDirection select 1); - _relativeInclination = asin (_relativeDirection select 2); - - _angle = sqrt ((_relativeAzimuth - _azimuth) ^ 2 + (_relativeInclination - _inclination) ^ 2); - _distance = vectorMagnitude _relativeDirection; - - _line = [_position, _relativePosition]; - - if (_angle < _dangerZoneAngle && {_distance < _dangerZoneRange} && {!lineIntersects (_line + [_vehicle])} && {!terrainIntersectASL _line}) then { - _alpha = sqrt (1 - _distance / _dangerZoneRange); - _beta = sqrt (1 - _angle / _dangerZoneAngle); - - _damage = 2 * _alpha * _beta * _dangerZoneDamage; - if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; - - // TODO: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - _unit spawn { - sleep 0.5; - [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); - }; - } else { - _unit setDamage (damage _unit + _damage); - }; - - }; -}; diff --git a/addons/backblast/functions/script_component.hpp b/addons/backblast/functions/script_component.hpp deleted file mode 100644 index 817131570f..0000000000 --- a/addons/backblast/functions/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\backblast\script_component.hpp" \ No newline at end of file diff --git a/addons/backblast/script_component.hpp b/addons/backblast/script_component.hpp deleted file mode 100644 index 9f2a71f2d5..0000000000 --- a/addons/backblast/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT backblast -#include "\z\ace\Addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_BACKBLAST - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_BACKBLAST - #define DEBUG_SETTINGS DEBUG_SETTINGS_BACKBLAST -#endif - -#include "\z\ace\Addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/captives/$PBOPREFIX$ b/addons/captives/$PBOPREFIX$ new file mode 100644 index 0000000000..aac16576c4 --- /dev/null +++ b/addons/captives/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\captives \ No newline at end of file diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp new file mode 100644 index 0000000000..722750f915 --- /dev/null +++ b/addons/captives/CfgEventHandlers.hpp @@ -0,0 +1,48 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +//release escorted captive when entering a vehicle +class Extended_GetIn_EventHandlers { + class All { + class GVAR(AutoDetachCaptive) { + getIn = QUOTE(_this call FUNC(handleGetIn)); + }; + }; +}; + +//reset captive animation after leaving vehicle +class Extended_GetOut_EventHandlers { + class All { + class GVAR(AutoDetachCaptive) { + getOut = QUOTE(_this call FUNC(handleGetOut)); + }; + }; +}; + +//reset captivity and escorting status when getting killed +class Extended_Killed_EventHandlers { + class CAManBase { + class GVAR(AutoDetachCaptive) { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; + +//mission start +class Extended_InitPost_EventHandlers { + class CAManBase { + class GVAR(InitPost) { + init = QUOTE(_this call FUNC(handleUnitInitPost)); + }; + }; +}; + diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp new file mode 100644 index 0000000000..6e67f3615b --- /dev/null +++ b/addons/captives/CfgMoves.hpp @@ -0,0 +1,83 @@ +class CfgMovesBasic { + class Actions { + class CivilStandActions; + class ACE_CivilStandHandcuffedActions: CivilStandActions { + turnL = ""; + turnR = ""; + stop = "ACE_AmovPercMstpScapWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; + default = "ACE_AmovPercMstpScapWnonDnon"; + PutDown = ""; + getOver = ""; + throwPrepare = ""; + throwGrenade[] = {"","Gesture"}; + }; + class ACE_CivilStandSurrenderActions: ACE_CivilStandHandcuffedActions { + stop = "ACE_AmovPercMstpSsurWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpSsurWnonDnon"; + default = "ACE_AmovPercMstpSsurWnonDnon"; + PutDown = ""; + }; + }; +}; + +class CfgMovesMaleSdr: CfgMovesBasic { + class StandBase; + class States { + class AmovPercMstpSnonWnonDnon: StandBase { + ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; + }; + + class CutSceneAnimationBase; + + //Handcuffed Anims: + class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { + actions = "ACE_CivilStandHandcuffedActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; + speed = 1; + looped = 0; + interpolationRestart = 2; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; + class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; + speed = 0; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01}; + looped = 1; + }; + class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + actions = "CivilStandActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; + ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + }; + + //Surrender Anims: + class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { + actions = "ACE_CivilStandSurrenderActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"; + speed = 1; + looped = 0; + interpolationRestart = 2; + ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; + class ACE_AmovPercMstpSsurWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon"; + speed = 0; + looped = 1; + ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01}; + }; + class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + speed = 0.333; //for gameplay reasons, slow this down + actions = "CivilStandActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; + ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; + }; + }; +}; + diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp new file mode 100644 index 0000000000..57f9644a4a --- /dev/null +++ b/addons/captives/CfgVehicles.hpp @@ -0,0 +1,202 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_Actions { + class ACE_RightHandActions { + selection = "righthand"; + displayName = "Right hand"; + distance = 5; + condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)) || ([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs))); + class ACE_ApplyHandcuffs { + displayName = "$STR_ACE_Captives_SetCaptive"; + distance = 4; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); + exceptions[] = {}; + showDisabled = 0; + priority = 2.4; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + hotkey = "C"; + }; + class ACE_RemoveHandcuffs { + displayName = "$STR_ACE_Captives_ReleaseCaptive"; + distance = 4; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); + exceptions[] = {}; + showDisabled = 0; + priority = 2.4; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + hotkey = "R"; + }; + }; + class ACE_MainActions { + class ACE_EscortCaptive { + displayName = "$STR_ACE_Captives_EscortCaptive"; + distance = 4; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); + statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doEscortCaptive)); + exceptions[] = {}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.3; + hotkey = "E"; + }; + class ACE_StopEscorting { + displayName = "$STR_ACE_Captives_StopEscorting"; + distance = 4; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting)); + statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive)); + exceptions[] = {QGVAR(isNotEscorting)}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.3; + hotkey = "E"; + }; + class ACE_LoadCaptive { + displayName = "$STR_ACE_Captives_LoadCaptive"; + distance = 4; + condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); + statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(doLoadCaptive)); + exceptions[] = {QGVAR(isNotEscorting)}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.2; + hotkey = "L"; + }; + class ACE_FriskPerson { + displayName = "$STR_ACE_Captives_FriskPerson"; + distance = 2; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doFriskPerson)); + showDisabled = 0; + //icon = ""; //@todo + priority = 3; + hotkey = "F"; + }; + }; + }; + + class ACE_SelfActions { + class ACE_StopEscortingSelf { + displayName = "$STR_ACE_Captives_StopEscorting"; + condition = QUOTE([ARR_2(_player, objNull)] call FUNC(canStopEscorting)); + statement = QUOTE([ARR_3(_player,objNull, false)] call FUNC(doEscortCaptive)); + exceptions[] = {QGVAR(isNotEscorting)}; + showDisabled = 0; + priority = 2.3; + hotkey = "C"; + }; + class ACE_StartSurrenderingSelf { + displayName = "$STR_ACE_Captives_StartSurrendering"; + condition = QUOTE([ARR_2(_player, true)] call FUNC(canSurrender)); + statement = QUOTE([ARR_2(_player, true)] call FUNC(surrender)); + exceptions[] = {}; + showDisabled = 0; + priority = 0; + }; + class ACE_StopSurrenderingSelf { + displayName = "$STR_ACE_Captives_StopSurrendering"; + condition = QUOTE([ARR_2(_player, false)] call FUNC(canSurrender)); + statement = QUOTE([ARR_2(_player, false)] call FUNC(surrender)); + exceptions[] = {QGVAR(isNotSurrendering)}; + showDisabled = 0; + priority = 0; + }; + }; + }; + +#define MACRO_LOADUNLOADCAPTIVE \ + class ACE_Actions { \ + class ACE_MainActions { \ + selection = ""; \ + class ACE_LoadCaptive { \ + displayName = "$STR_ACE_Captives_LoadCaptive"; \ + distance = 4; \ + condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ + statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \ + exceptions[] = {QGVAR(isNotEscorting)}; \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "L"; \ + }; \ + class ACE_UnloadCaptive { \ + displayName = "$STR_ACE_Captives_UnloadCaptive"; \ + distance = 4; \ + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "C"; \ + }; \ + }; \ + }; + + class LandVehicle; + class Car: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + class Tank: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class Air; + class Helicopter: Air { + MACRO_LOADUNLOADCAPTIVE + }; + class Plane: Air { + MACRO_LOADUNLOADCAPTIVE + }; + + class Ship; + class Ship_F: Ship { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticWeapon: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticMortar; + class Mortar_01_base_F: StaticMortar { + MACRO_LOADUNLOADCAPTIVE + }; + +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_CableTie,12) + }; + }; + + + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits {}; + class ModuleDescription {}; + }; + + class GVAR(ModuleSurrender): Module_F { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "Make Unit Surrender"; + function = QUOTE(DFUNC(moduleSurrender)); + scope = 2; //show in editor + scopeCurator = 2; //show in zeus + curatorCost = 0; //??? + isGlobal = 1; //run global + isTriggerActivated = 1; //Wait for triggers + // icon = QUOTE(PATHTOF(ui\todo.paa)); + functionPriority = 0; + class Arguments {}; + class ModuleDescription: ModuleDescription { + description = "Sync a unit to make them surrender.
Source: ace_captives"; + sync[] = {"AnyAI"}; + }; + }; +}; diff --git a/addons/captives/CfgWeapons.hpp b/addons/captives/CfgWeapons.hpp new file mode 100644 index 0000000000..be2149ca88 --- /dev/null +++ b/addons/captives/CfgWeapons.hpp @@ -0,0 +1,15 @@ +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_CableTie: ACE_ItemCore { + displayName = "$STR_ACE_Captives_CableTie"; + descriptionShort = "$STR_ACE_Captives_CableTieDescription"; + model = QUOTE(PATHTOF(models\ace_cabletie.p3d)); + picture = QUOTE(PATHTOF(UI\ace_cabletie_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; + }; +}; diff --git a/addons/captives/README.md b/addons/captives/README.md new file mode 100644 index 0000000000..3938720f08 --- /dev/null +++ b/addons/captives/README.md @@ -0,0 +1,14 @@ +ace_captives +============ + +Allows taking people captive/handcuffed + +####Items: +`ACE_CableTie` - adds ability to take someone captive + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [PabstMirror](https://github.com/PabstMirror) diff --git a/TO_MERGE/agm/Captives/UI/agm_cabletie_x_ca.paa b/addons/captives/UI/ace_cabletie_ca.paa similarity index 100% rename from TO_MERGE/agm/Captives/UI/agm_cabletie_x_ca.paa rename to addons/captives/UI/ace_cabletie_ca.paa diff --git a/TO_MERGE/agm/Captives/UI/captive_ca.paa b/addons/captives/UI/captive_ca.paa similarity index 100% rename from TO_MERGE/agm/Captives/UI/captive_ca.paa rename to addons/captives/UI/captive_ca.paa diff --git a/TO_MERGE/agm/Captives/UI/handcuff_ca.paa b/addons/captives/UI/handcuff_ca.paa similarity index 100% rename from TO_MERGE/agm/Captives/UI/handcuff_ca.paa rename to addons/captives/UI/handcuff_ca.paa diff --git a/addons/captives/XEH_postInit.sqf b/addons/captives/XEH_postInit.sqf new file mode 100644 index 0000000000..9d1a242d4d --- /dev/null +++ b/addons/captives/XEH_postInit.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" + +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); +["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); + +//Handles when someone starts escorting and then disconnects, leaving the captive attached +//This is normaly handled by the PFEH in doEscortCaptive, but that won't be running if they DC +if (isServer) then { + addMissionEventHandler ["HandleDisconnect", { + PARAMS_1(_disconnectedPlayer); + _escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull]; + if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then { + detach _escortedUnit; + systemChat "debug: DC detach"; + }; + if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then { + _disconnectedPlayer setVariable [QGVAR(isEscorting), false, true]; + }; + }]; +}; + +//TODO: Medical Integration Events??? + +// [_unit, "knockedOut", { +// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; +// }] call ACE_Core_fnc_addCustomEventhandler; + +// [_unit, "wokeUp", { +// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; +// }] call ACE_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf new file mode 100644 index 0000000000..75ee77e9bc --- /dev/null +++ b/addons/captives/XEH_preInit.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(canApplyHandcuffs); +PREP(canEscortCaptive); +PREP(canFriskPerson); +PREP(canLoadCaptive); +PREP(canRemoveHandcuffs); +PREP(canStopEscorting); +PREP(canSurrender); +PREP(canUnloadCaptive); +PREP(doApplyHandcuffs); +PREP(doEscortCaptive); +PREP(doFriskPerson); +PREP(doLoadCaptive); +PREP(doRemoveHandcuffs); +PREP(doUnloadCaptive); +PREP(handleGetIn); +PREP(handleGetOut); +PREP(handleKilled); +PREP(handleKnockedOut); +PREP(handlePlayerChanged); +PREP(handleUnitInitPost); +PREP(handleWokeUp); +PREP(moduleSurrender); +PREP(setHandcuffed); +PREP(surrender); +PREP(vehicleCaptiveMoveIn); +PREP(vehicleCaptiveMoveOut); + +ADDON = true; diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp new file mode 100644 index 0000000000..27b7c4ec60 --- /dev/null +++ b/addons/captives/config.cpp @@ -0,0 +1,31 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {QGVAR(ModuleSurrender)}; + weapons[] = {"ACE_CableTie"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ACE_Interaction"}; + author[] = {"commy2", "KoffeinFlummi"}; + authorUrl = "https://github.com/commy2/"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgMoves.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" + + +class ACE_canInteractConditions { + class GVAR(isNotEscorting) { + condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false))); + }; + class GVAR(isNotHandcuffed) { + condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false))); + }; + class GVAR(isNotSurrendering) { + condition = QUOTE(!(GETVAR(player,QGVAR(isSurrendering),false))); + }; +}; diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf new file mode 100644 index 0000000000..f69bb2544d --- /dev/null +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -0,0 +1,25 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to apply handcuffs + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * [player, bob] call ACE_captives_fnc_canApplyHandcuffs + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +//Player has cableTie, target is alive and not already handcuffed + +("ACE_CableTie" in (items _unit)) && +{alive _target} && +{!(_target getVariable [QGVAR(isHandcuffed), false])} diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf new file mode 100644 index 0000000000..85bd8bbd3e --- /dev/null +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -0,0 +1,26 @@ +/* + * Author: PabstMirror + * Tests if can escort target (attach) + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * [player, bob] call ACE_captives_fnc_canEscortCaptive + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +//Alive, handcuffed, not being escored, and not unconscious + +(_target getVariable [QGVAR(isHandcuffed), false]) && +{isNull (attachedTo _target)} && +{alive _target} && +{!(_target getVariable ["ACE_isUnconscious", false])} diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf new file mode 100644 index 0000000000..5eecc453d4 --- /dev/null +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -0,0 +1,24 @@ +/* + * Author: bux578 + * Checks the conditions for being able to frisk a unit + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * [player, bob] call ACE_captives_fnc_canFriskPerson + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +_target getVariable [QGVAR(isHandcuffed), false] +|| {_target getVariable [QGVAR(isSurrendering), false]} +|| {_target getVariable ["ACE_isSearchable", false]} +|| {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf new file mode 100644 index 0000000000..04b33ad42d --- /dev/null +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -0,0 +1,39 @@ +/* + * Author: commy2 + * Check if the unit can load the target object into a vehicle. + * + * Arguments: + * 0: Unit that wants to load a captive + * 1: A captive. ObjNull for the first escorted captive (may be null) + * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (may be null) + * + * Return Value: + * The return value + * + * Example: + * [player, bob] call ACE_captives_fnc_canLoadCaptive + * + * Public: No + */ +#include "script_component.hpp" + +private ["_objects"]; + +PARAMS_3(_unit,_target,_vehicle); + +if (isNull _target) then { + _objects = attachedObjects _unit; + _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); + if ((count _objects) > 0) then {_target = _objects select 0;}; +}; + +if (isNull _vehicle) then { + _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10]; + if ((count _objects) > 0) then {_vehicle = _objects select 0;}; +}; + +(!isNull _target) +&& {!isNull _vehicle} +&& {_unit getVariable [QGVAR(isEscorting), false]} +&& {_target getVariable [QGVAR(isHandcuffed), false]} +&& {_vehicle emptyPositions "cargo" > 0} diff --git a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf new file mode 100644 index 0000000000..4642cd90fd --- /dev/null +++ b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf @@ -0,0 +1,23 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to remove handcuffs + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * [player, bob] call ACE_captives_fnc_canRemoveHandcuffs + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +//Unit is handcuffed and not currently being escorted +_target getVariable [QGVAR(isHandcuffed), false] && +{isNull (attachedTo _target)} diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf new file mode 100644 index 0000000000..56065a43fc --- /dev/null +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -0,0 +1,28 @@ +/* + * Author: PabstMirror + * Tests if player can stop escorting + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * [player, bob] call ACE_captives_fnc_canStopEscorting + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); +DEFAULT_PARAM(1,_target,objNull); + +if (isNull _target) then { + _target = _unit getVariable [QGVAR(escortedUnit), objNull]; +}; + +if (isNull _target) exitWith {false}; + +(_target in (attachedObjects _unit)) && {_target getVariable [QGVAR(isHandcuffed), false]} diff --git a/addons/captives/functions/fnc_canSurrender.sqf b/addons/captives/functions/fnc_canSurrender.sqf new file mode 100644 index 0000000000..238087c62b --- /dev/null +++ b/addons/captives/functions/fnc_canSurrender.sqf @@ -0,0 +1,22 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to surrender + * + * Arguments: + * 0: caller (player) + * 1: New Surrender State to test + * + * Return Value: + * The return value + * + * Example: + * [Jean, true] call ACE_captives_fnc_canSurrender; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_newSurrenderState); + +//TODO: any other conditions?? +(!((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _newSurrenderState)) diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf new file mode 100644 index 0000000000..a86bdae588 --- /dev/null +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -0,0 +1,28 @@ +/* + * Author: commy2 + * Check if the unit can unload a captive from the vehicle. + * + * Arguments: + * 0: Unit that wants to unload a captive + * 1: A captive. ObjNull for the first escorted captive + * 2: Vehicle to unload a captive from + * + * Return Value: + * The return value + * + * Example: + * [player, bob, car1] call ACE_captives_fnc_canUnloadCaptive; + * + * Public: No + */ +#include "script_component.hpp" + +private ["_cargo"]; + +PARAMS_2(_unit,_vehicle); + +_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. + +_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); + +count _cargo > 0 diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf new file mode 100644 index 0000000000..0d15f503e8 --- /dev/null +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -0,0 +1,25 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to apply handcuffs + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * [player, bob] call ACE_captives_fnc_doApplyHandcuffs; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +_unit removeItem "ACE_CableTie"; + +playSound3D [QUOTE(PATHTO_R(sounds\cable_tie_zipping.ogg)), objNull, false, (getPosASL _target), 1, 1, 10]; + +["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf new file mode 100644 index 0000000000..299aa81631 --- /dev/null +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -0,0 +1,59 @@ +/* + * Author: Nic547 + * Attaches a Captive to the _unit + * + * Arguments: + * 0: _unit-Player + * 1: target + * 2: _state + * + * Return Value: + * The return value + * + * Example: + * [player, bob, true] call ACE_captives_fnc_doEscorteCaptive; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_unit,_target,_state); + +if (_state) then { + if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; + + [_unit, _target] call EFUNC(common,claim); + _unit setVariable [QGVAR(isEscorting), true, true]; + + _target attachTo [_unit, [0, 1, 0]]; + + _unit setVariable [QGVAR(escortedUnit), _target, true]; + + //Add Actionmenu to release captive + _actionID = _unit addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], + {[(_this select 0), ((_this select 0) getVariable [QGVAR(escortedUnit), objNull]), false] call FUNC(doEscortCaptive);}, + nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))]; + + private "_escortFnc"; + _escortFnc = { + EXPLODE_3_PVT((_this select 0),_unit,_target,_actionID); + if (_unit getVariable [QGVAR(isEscorting), false]) then { + if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { + _unit setVariable [QGVAR(isEscorting), false, true]; + }; + }; + + if (!(_unit getVariable [QGVAR(isEscorting), false])) then { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + [objNull, _target] call EFUNC(common,claim); + detach _target; + _unit removeAction _actionID; + _unit setVariable [QGVAR(escortedUnit), objNull, true]; + }; + }; + [_escortFnc, 0.2, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler; + +} else { + _unit setVariable [QGVAR(isEscorting), false, true]; + _unit setVariable [QGVAR(escortedUnit), objNull, true]; +}; diff --git a/addons/captives/functions/fnc_doFriskPerson.sqf b/addons/captives/functions/fnc_doFriskPerson.sqf new file mode 100644 index 0000000000..14b18ffd0e --- /dev/null +++ b/addons/captives/functions/fnc_doFriskPerson.sqf @@ -0,0 +1,70 @@ +/* + * Author: bux578 + * Open the select menu with the "personal" items of a frisked unit. It only shows "handgunWeapon", "uniformItems", "vestItems", "backpackItems" and "assignedItems" because every other item is visible on the character + * + * Arguments: + * 0: player unit + * 1: unit + * + * Return Value: + * Nothing + * + * Example: + * [player, bob] call ACE_captives_fnc_doFristPerson; + * + * Public: No + */ +#include "script_component.hpp" + +private ["_weapon", "_listedItemClasses", "_actions", "_allGear"]; + +PARAMS_2(_player,_unit); + +_weapon = currentWeapon _player; +if (_weapon == primaryWeapon _player && {_weapon != ""}) then { + [_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation); +}; + +_listedItemClasses = []; + +_actions = [localize "STR_ACE_Captives_FriskMenuHeader", localize "STR_ACE_Captives_CancelSelection"] call ACE_Interaction_fnc_prepareSelectMenu; + +_allGear = []; + +if ((handgunWeapon _unit) != "") then { + _allGear pushBack (handgunWeapon _unit); +}; +if (count (uniformItems _unit) > 0) then { + _allGear = _allGear + (uniformItems _unit); +}; +if (count (vestItems _unit) > 0) then { + _allGear = _allGear + (vestItems _unit); +}; +if (count (backpackItems _unit) > 0) then { + _allGear = _allGear + (backpackItems _unit); +}; +if (count (assignedItems _unit) > 0) then { + _allGear = _allGear + (assignedItems _unit); +}; + +// Handgun +// Uniform Items +// Vest Items +// Backpack Items +// Assigned Items +{ + if (!(_x in _listedItemClasses)) then { + private "_item"; + _item = configFile >> "CfgMagazines" >> _x; + if (isNil "_item" || str _item == "") then { //str _item ? + _item = configFile >> "CfgWeapons" >> _x; + }; + _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call ACE_Interaction_fnc_addSelectableItem; + _listedItemClasses pushBack _x; + }; +} forEach (_allGear); + +[_actions, {call ACE_Interaction_fnc_hideMenu;}, {call ACE_Interaction_fnc_hideMenu;}] call ACE_Interaction_fnc_openSelectMenu; + +// don't need an "Ok" Button +ctrlShow [8860, false]; diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf new file mode 100644 index 0000000000..9fd65a130d --- /dev/null +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -0,0 +1,38 @@ +/* + * Author: commy2 + * Unit loads the target object into a vehicle. + * + * Arguments: + * 0: Unit that wants to load a captive + * 1: A captive. ObjNull for the first escorted captive + * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle + * + * Return Value: + * Nothing + * + * Example: + * [bob, tom, car] call ACE_captives_fnc_doLoadCaptive + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_unit,_target,_vehicle); + +if (isNull _target) then { + _objects = attachedObjects _unit; + _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); + if ((count _objects) > 0) then {_target = _objects select 0;}; +}; +if (isNull _target) exitWith {}; + +if (isNull _vehicle) then { + _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; + if ((count _objects) > 0) then {_vehicle = _objects select 0;}; +}; +if (isNull _vehicle) exitWith {}; + +if ((!isNil "_target") && {!isNil "_vehicle"}) then { + _unit setVariable [QGVAR(isEscorting), false, true]; + ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); +}; diff --git a/addons/captives/functions/fnc_doRemoveHandcuffs.sqf b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf new file mode 100644 index 0000000000..a69decf620 --- /dev/null +++ b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf @@ -0,0 +1,20 @@ +/* + * Author: PabstMirror + * Remove handcuffs from a target + * + * Arguments: + * 0: target + * + * Return Value: + * The return value + * + * Example: + * [bob, false] call ACE_captives_fnc_doRemoveHandcuffs + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +["SetHandcuffed", [_target], [_target, false]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doUnloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf new file mode 100644 index 0000000000..b7fa57a7bb --- /dev/null +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -0,0 +1,32 @@ +/* + * Author: commy2 + * Unit unloads a captive from a vehicle. + * + * Arguments: + * 0: Unit that wants to unload a captive + * 1: Vehicle to unload a captive from. + * + * Return Value: + * Nothing + * + * Example: + * [bob, car] call ACE_captives_fnc_doUnloadCaptive + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_vehicle); + +private ["_cargo", "_target"]; + +_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. + +_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); + +if ((count _cargo) > 0) then { + _target = _cargo select 0; + ["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent); +} else { + ERROR("No captive to unload"); +}; diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf new file mode 100644 index 0000000000..54133e2362 --- /dev/null +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * Handles when a unit gets in to a vehicle. Release escorted captive when entering a vehicle + * + * Arguments: + * 0: _vehicle + * 2: dunno + * 1: _unit + * + * Return Value: + * The return value + * + * Example: + * [car2, x, player] call ACE_captives_fnc_handleGetIn + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_vehicle,_dontcare,_unit); + +if ((local _unit) && (_unit getVariable [QGVAR(isEscorting), false])) then { + _unit setVariable [QGVAR(isEscorting), false, true]; +}; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf new file mode 100644 index 0000000000..4bf9a1fa19 --- /dev/null +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -0,0 +1,33 @@ +/* + * Author: commy2 + * Handles when a captive unit gets out of a vehicle. + * + * Arguments: + * 0: _vehicle + * 2: dunno + * 1: _unit + * + * Return Value: + * The return value + * + * Example: + * [car2, x, player] call ACE_captives_fnc_handleGetOut + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_vehicle,_dontcare,_unit); + +if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { + private ["_cargoIndex"]; + + _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1]; + + //If captive was not "unloaded", then move them back into the vehicle. + if (_cargoIndex != -1) exitWith { + _unit moveInCargo [_vehicle, _cargoIndex]; + }; + + [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); +}; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..9e9c5e1ac8 --- /dev/null +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -0,0 +1,30 @@ +/* + * Author: PabstMirror + * Handles when a unit is kill. Reset captivity and escorting status + * + * Arguments: + * 0: _oldUnit + * + * Return Value: + * None + * + * Example: + * [bob1] call ACE_captives_fnc_handleKilled + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_oldUnit); + +if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then { + _oldUnit setVariable [QGVAR(isHandcuffed), false, true]; +}; + +if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { + _oldUnit setVariable [QGVAR(isEscorting), false, true]; +}; + +if (_oldUnit getVariable [QGVAR(isSurrendering), false]) then { + _oldUnit setVariable [QGVAR(isSurrendering), false, true]; +}; diff --git a/TO_MERGE/agm/Captives/functions/fn_handleKnockedOut.sqf b/addons/captives/functions/fnc_handleKnockedOut.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_handleKnockedOut.sqf rename to addons/captives/functions/fnc_handleKnockedOut.sqf diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..13e284ef80 --- /dev/null +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,27 @@ +/* + * Author: commy2 + * Handles playerChanged. Resets "showHUD" based on handcuff status + * + * Arguments: + * 0: _newUnit + * 1: _oldUnit + * + * Return Value: + * The return value + * + * Example: + * [bob1, bob2] call ACE_captives_fnc_handlePlayerChange + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_newUnit,_oldUnit); + +if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then { + TRACE_1("Player Change (showHUD false)",_newUnit); + showHUD false; +} else { + TRACE_1("Player Change (showHUD true)",_newUnit); + showHUD true; +}; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf new file mode 100644 index 0000000000..1a5a8f2ecd --- /dev/null +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -0,0 +1,34 @@ +/* + * Author: commy2 + * handle captive and unconsciousness state and prevent grenades + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * [bob] call ACE_captives_fnc_handleUnitInitPost + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +// prevent players from throwing grenades (added to all units) +[_unit, "Throw", {((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}}, {}] call EFUNC(common,addActionEventhandler); + +if (local _unit) then { + // reset status on mission start + if (_unit getVariable [QGVAR(isHandcuffed), false]) then { + _unit setVariable [QGVAR(isHandcuffed), false]; + [_unit, true] call FUNC(setHandcuffed); + }; + + if (_unit getVariable [QGVAR(isSurrendering), false]) then { + _unit setVariable [QGVAR(isSurrendering), false]; + [_unit, true] call FUNC(surrender); + }; +}; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf new file mode 100644 index 0000000000..9bf2e1a2bc --- /dev/null +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -0,0 +1,23 @@ +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * [bob] call ACE_captives_fnc_handleWokeUp + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); +}; diff --git a/addons/captives/functions/fnc_moduleSurrender.sqf b/addons/captives/functions/fnc_moduleSurrender.sqf new file mode 100644 index 0000000000..5cbf43aacc --- /dev/null +++ b/addons/captives/functions/fnc_moduleSurrender.sqf @@ -0,0 +1,46 @@ +/* + * Author: PabstMirror + * Module Function to make a unit surrender (can be called from editor, or placed with zeus) + * + * Arguments: + * 0: The Module Logic Object + * 1: synced objects + * 2: Activated + * + * Return Value: + * Nothing + * + * Example: + * Called from module + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_logic,_units,_activated); + +if (!_activated) exitWith {}; + +if (local _logic) then { + if ((!isnull curatorcamera) && {((count curatorMouseOver) == 2) && {(curatorMouseOver select 1) == _logic}}) then {//in zeus interface and we placed the module + _bisMouseOver = missionNamespace getVariable ["bis_fnc_curatorObjectPlaced_mouseOver", []];//bis caches the previous curatorMouseOver + if ((count _bisMouseOver) == 2) then {//check what mouse was over before the module was placed + _mouseOverObject = _bisMouseOver select 1; + if ((_mouseOverObject isKindOf "CAManBase") && {(vehicle _mouseOverObject) == _mouseOverObject}) then { + systemChat format ["Debug - module surrendering %1", (name _mouseOverObject)]; + [_mouseOverObject, true] call FUNC(surrender); + } else { + systemChat format ["Only use on dismounted inf"]; + }; + } else { + systemChat format ["Nothing under mouse"]; + }; + } else {//an editor module + { + systemChat format ["Debug - module surrendering %1", (name _x)]; + [_x, true] call FUNC(surrender); + } forEach _units; + }; + + deleteVehicle _logic; +}; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf new file mode 100644 index 0000000000..912b00662f --- /dev/null +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -0,0 +1,63 @@ +/* + * Author: Nic547, commy2 + * Handcuffs a unit. + * + * Arguments: + * 0: Unit + * 1: True to take captive, false to release captive + * + * Return Value: + * Nothing + * + * Example: + * [bob, true] call ACE_captives_fnc_setHandcuffed; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_state); + +// We only want this function to work on local machines +if (!local _unit) exitwith { + [_this, QUOTE(FUNC(setHandcuffed)), _unit] call EFUNC(common,execRemoteFnc); + TRACE_2("running setHandcuffed on remote unit",_unit,_state); +}; + +if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) then { + LOG("setHandcuffed: current state same as new"); +}; + +if (_state) then { + _unit setVariable [QGVAR(isHandcuffed), true, true]; + [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); + _unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true]; + + if (_unit == ACE_player) then { + showHUD false; + }; + + // fix anim on mission start (should work on dedicated servers) + [{ + PARAMS_1(_unit); + if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); + }; + }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); +} else { + _unit setVariable [QGVAR(isHandcuffed), false, true]; + [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); + if ((vehicle _unit) == _unit) then { + //Break out of hands up animation loop (doAnimation handles Unconscious prioity) + [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + }; + + if (_unit getVariable [QGVAR(CargoIndex), -1] != -1) then { + _unit setVariable [QGVAR(CargoIndex), -1, true]; + }; + + if (_unit == ACE_player) then { + showHUD true; + }; +}; diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf new file mode 100644 index 0000000000..1f0e232926 --- /dev/null +++ b/addons/captives/functions/fnc_surrender.sqf @@ -0,0 +1,76 @@ +/* + * Author: commy2 PabstMirror + * Lets a unit surrender + * + * Arguments: + * 0: Unit + * 1: State + * + * Return Value: + * Nothing + * + * Example: + * [Pierre, true] call ACE_captives_fnc_surrender; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_state); + +// We only want this function to work on local machines +if (!local _unit) exitwith { + [_this, QUOTE(FUNC(surrender)), _unit] call EFUNC(common,execRemoteFnc); + TRACE_2("running surrender on remote unit",_unit,_state); +}; + +if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) then { + LOG("Surrender: current state same as new"); +}; + +if (_state) then { + _unit setVariable [QGVAR(isSurrendering), true, true]; + [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); + + if (_unit == ACE_player) then { + showHUD false; + }; + + // fix anim on mission start (should work on dedicated servers) + [{ + PARAMS_1(_unit); + if (_unit getVariable [QGVAR(isSurrendering), false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); + }; + }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); + + //PFEH - (TODO: move to event system?) + [{ + EXPLODE_1_PVT((_this select 0),_unit); + if (_unit getVariable [QGVAR(isSurrendering), false]) then { + //If unit dies, gets knocked out, or is handcuffed then end surrender + if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { + [_unit, false] call FUNC(surrender); + [(_this select 1)] call CBA_fnc_removePerFrameHandler; + }; + } else { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; + }, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; +} else { + _unit setVariable [QGVAR(isSurrendering), false, true]; + [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); + + if ((vehicle _unit) == _unit) then { + //Break out of hands up animation loop (doAnimation handles Unconscious prioity) + [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + }; + + if (_unit == ACE_player) then { + //only re-enable HUD if not handcuffed + if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { + showHUD true; + }; + }; +}; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf new file mode 100644 index 0000000000..626a0b34e4 --- /dev/null +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -0,0 +1,26 @@ +/* + * Author: PabstMirror + * Loads a captive into a vehicle + * + * Arguments: + * 0: The Captive + * 1: The Vehicle + * + * Return Value: + * Nothing + * + * Example: + * [bob, car1] call ACE_captives_fnc_vehicleCaptiveMoveIn; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_target,_vehicle); + +private ["_cargoIndex"]; + +_target moveInCargo _vehicle; +_target assignAsCargo _vehicle; +_cargoIndex = _vehicle getCargoIndex _target; +_target setVariable [QGVAR(CargoIndex), _cargoIndex, true]; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf new file mode 100644 index 0000000000..5ef6f01406 --- /dev/null +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf @@ -0,0 +1,24 @@ +/* + * Author: PabstMirror + * Unloads a captive from a vehicle. + * + * Arguments: + * 0: Captive Unit being unloaded + * + * Return Value: + * Nothing + * + * Example: + * [bob] call ACE_captives_fnc_vehicleCaptiveMoveOut; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +_unit setVariable [QGVAR(CargoIndex), -1, true]; + +moveOut _unit; +[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); +unassignVehicle _unit; diff --git a/addons/captives/functions/script_component.hpp b/addons/captives/functions/script_component.hpp new file mode 100644 index 0000000000..e91d5c843b --- /dev/null +++ b/addons/captives/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\captives\script_component.hpp" \ No newline at end of file diff --git a/addons/captives/models/ace_cabletie.p3d b/addons/captives/models/ace_cabletie.p3d new file mode 100644 index 0000000000..72a6facd2b Binary files /dev/null and b/addons/captives/models/ace_cabletie.p3d differ diff --git a/addons/captives/models/ace_default.rvmat b/addons/captives/models/ace_default.rvmat new file mode 100644 index 0000000000..c7a241ca38 --- /dev/null +++ b/addons/captives/models/ace_default.rvmat @@ -0,0 +1,79 @@ +ambient[]={1,1,1,1}; +diffuse[]={1,1,1,1}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.01,0.01,0.01,1}; //amount of glossiness - the higher the number, the higher the glossiness +specularPower=500; //area of glossiness - the higher the number, the smaller the area +PixelShaderID="Super"; +VertexShaderID="Super"; + +class Stage1 { + texture="#(rgb,1,1,1)color(0.5,0.5,1,1)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,mc)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 { + texture="#(argb,8,8,3)color(1,1,1,1,as)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,1}; + }; +}; +class Stage5 { + texture="#(rgb,1,1,1)color(0.2,0.2,1,1)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 { + texture="#(ai,64,64,1)fresnel(4.7,1.2)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; +class Stage7 { + texture="a3\data_f\env_land_ca.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/captives/script_component.hpp b/addons/captives/script_component.hpp new file mode 100644 index 0000000000..e68eb19d2f --- /dev/null +++ b/addons/captives/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT captives +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_CAPTIVES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_CAPTIVES + #define DEBUG_SETTINGS DEBUG_SETTINGS_CAPTIVES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/captives/sounds/cable_tie_zipping.ogg b/addons/captives/sounds/cable_tie_zipping.ogg new file mode 100644 index 0000000000..4f76037eb1 Binary files /dev/null and b/addons/captives/sounds/cable_tie_zipping.ogg differ diff --git a/TO_MERGE/agm/Captives/stringtable.xml b/addons/captives/stringtable.xml similarity index 84% rename from TO_MERGE/agm/Captives/stringtable.xml rename to addons/captives/stringtable.xml index 060f89d9ec..7d8096b3e6 100644 --- a/TO_MERGE/agm/Captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -1,8 +1,8 @@  - - + + - + Take Prisoner Gefangen nehmen Tomar prisionero @@ -14,7 +14,7 @@ Foglyul ejtés Взять в плен - + Free Prisoner Gefangenen freilassen Liberar prisionero @@ -26,7 +26,7 @@ Fogoly szabadon elengedése Освободить пленника - + Escort Prisoner Gefangenen eskortieren Escoltar prisionero @@ -38,7 +38,7 @@ Fogoly kísérése Конвоировать пленника - + Release Prisoner Gefangenen loslassen Soltar prisionero @@ -50,7 +50,7 @@ Fogoly elengedése Прекратить конвоирование - + You need to take him as prisoner first! Du must ihn zuerst gefangen nehmen. Necesitas hacerle prisionero primero! @@ -62,7 +62,7 @@ Először foglyul kell ejtened! Вы должны сначала взять его в плен! - + Load Captive Gefangenen einladen Cargar prisionero @@ -71,8 +71,9 @@ Naložit zajatce Fogoly berakása Загрузить пленного + Embarcar Prisioneiro - + Unload Captive Gefangenen ausladen Descargar prisionero @@ -81,8 +82,9 @@ Vyložit zajatce Fogoly kivevése Выгрузить пленного + Desembarcar Prisioneiro - + Cable Tie Kabelbinder Opaska zaciskowa @@ -94,7 +96,7 @@ Gyorskötöző Кабельная стяжка - + Cable ties that allow you to restrain prisoners. Kabelbinder ermöglichen es, Gefangene zu fesseln. Opaska zaciskowa pozwala na skrępowanie dłoni u więźnia. @@ -106,7 +108,7 @@ Gyorskötöző emberek fogjulejtéséhez. Кабельные стяжки позволяют связывать пленников. - + Inventory of frisked person Inventar der durchsuchten Person Inventaire de la fouille @@ -115,8 +117,9 @@ Inventář prohledávané osoby Ekwipunek rewidowanej osoby Инвентарь обысканных лиц + Inventário da pessoa revistada - + Frisk person Person durchsuchen Fouiller @@ -125,6 +128,13 @@ Rewiduj osobę Motozás Обыскать человека + Revistar + + + Surrender + + + Stop Surrendering \ No newline at end of file diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index 7ea3b1e1f9..522df03d4f 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -2,7 +2,6 @@ class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); - serverInit = QUOTE(call COMPILE_FILE(scripts\readParameters)); disableModuload = true; }; }; @@ -39,7 +38,7 @@ class Extended_Respawn_EventHandlers { respawn = QUOTE(_this call FUNC(setName)); }; class GVAR(RESETDefaults) { - respawn = QUOTE(_this call FUNC(resetAllDefaults_F)); + respawn = QUOTE(_this call FUNC(resetAllDefaults)); }; }; }; diff --git a/addons/common/HintConfig.hpp b/addons/common/HintConfig.hpp index 3e3493a8ba..5dc0e6384a 100644 --- a/addons/common/HintConfig.hpp +++ b/addons/common/HintConfig.hpp @@ -17,14 +17,15 @@ class RscTitles { class HintBox: RscStructuredText { idc = 1; text = ""; - size = "1 / 40 / (getResolution select 5)"; - sizeEx = 1; + //size = "1 / 40 / (getResolution select 5)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; colorText[] = {1, 1, 1, 1}; colorBackground[] = {0, 0, 0, 0.5}; x = safeZoneW + safeZoneX - 0 * safezoneW; //safeZoneW + safeZoneX - 0.2 * safezoneW; y = safeZoneY + 0.2 * safezoneH; w = 0.2 * safeZoneW; h = 0.1 * SafeZoneH; + font = "PuristaMedium"; }; }; }; @@ -36,13 +37,12 @@ class RscTitles { fadeIn = 0.2; fadeOut = 0.2; name = "ACE_RscErrorHint"; - class controls { class HintBox: RscStructuredText { idc = 1; text = ""; - size = "1 / 40 / (getResolution select 5)"; - sizeEx = 1; + //size = "1 / 40 / (getResolution select 5)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; colorText[] = {1, 1, 1, 1}; colorBackground[] = {0.8, 0, 0, 0.5}; x = 0.3 * safeZoneW + safeZoneX; @@ -52,6 +52,7 @@ class RscTitles { }; }; }; + class ACE_EventHandlerHelper: ACE_Rsc_Display_Base { idd = -1; class controls { diff --git a/addons/common/ProgressScreen.hpp b/addons/common/ProgressScreen.hpp index 31184f00f4..751d48af9f 100644 --- a/addons/common/ProgressScreen.hpp +++ b/addons/common/ProgressScreen.hpp @@ -1,6 +1,3 @@ -class ACE_gui_RscProgress; -class ACE_gui_staticBase; - class GVAR(ProgressBar_Dialog) { idd = -1; @@ -20,7 +17,7 @@ class GVAR(ProgressBar_Dialog) { type = 0; style = 0; size = 1; - colorBackground[] = {0, 0, 0, 0.1}; + colorBackground[] = {0, 0, 0, 0.0}; colorText[] = {0, 0, 0, 0}; x = "safezoneX"; y = "safezoneY"; @@ -34,7 +31,7 @@ class GVAR(ProgressBar_Dialog) { y = "0.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = ".8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorFrame[] = {0,0,0,0.025}; + colorFrame[] = {0,0,0,0.0}; colorBar[] = {0.27,0.5,0.31,0.8}; texture = "#(argb,8,8,3)color(1,1,1,0.7)"; }; diff --git a/addons/common/RscInfoType.hpp b/addons/common/RscInfoType.hpp index d0b08c50c2..fe21b05265 100644 --- a/addons/common/RscInfoType.hpp +++ b/addons/common/RscInfoType.hpp @@ -26,5 +26,5 @@ class RscDisplayInventory { }; class RscDisplayChannel { - onLoad = QUOTE(_this call GVAR(onLoadRscDisplayChannel)); + onLoad = QUOTE(_this call FUNC(onLoadRscDisplayChannel)); }; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 542c4277cf..dbb665d446 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -1,6 +1,25 @@ // ACE - Common #include "script_component.hpp" +// Load settings from profile +if (hasInterface) then { + call FUNC(loadSettingsFromProfile); +}; + +// Listens for global "SettingChanged" events, to update the force status locally +["SettingChanged", { + + PARAMS_2(_name,_value); + if !(count _this > 2) exitWith {}; + + _force = _this select 2; + if (_force) then { + _settingData = [_name] call FUNC(getSettingData); + if (count _settingData == 0) exitWith {}; + _settingData set [6,_force]; + }; +}] call FUNC(addEventhandler); + // hack to get PFH to work in briefing [QGVAR(onBriefingPFH), "onEachFrame", { if (time > 0) exitWith { @@ -63,7 +82,7 @@ enableCamShake true; }] call FUNC(addEventhandler); -GVAR(OldPlayerInventory) = ACE_player call FUNC(getAllGear); +GVAR(OldPlayerInventory) = [ACE_player] call FUNC(getAllGear); GVAR(OldPlayerVisionMode) = currentVisionMode ACE_player; GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312); GVAR(OldCameraView) = cameraView; @@ -74,7 +93,7 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); [{ // "playerInventoryChanged" event - _newPlayerInventory = ACE_player call FUNC(getAllGear); + _newPlayerInventory = [ACE_player] call FUNC(getAllGear); if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then { // Raise ACE event locally GVAR(OldPlayerInventory) = _newPlayerInventory; @@ -134,3 +153,8 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); [QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable); [QGVAR(carriedBy),objNull,false,QUOTE(ADDON)] call FUNC(defineVariable); [QGVAR(carriedObj),objNull,false,QUOTE(ADDON)] call FUNC(defineVariable); + +["VehicleSetFuel", { +PARAMS_2(_vehicle,_fuelLevel); +_vehicle setFuel _fuelLevel; +}] call FUNC(addEventhandler); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 3cfb392784..62fbd7404f 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -1,6 +1,8 @@ // by commy2 #include "script_component.hpp" +ADDON = false; + // ACE Common Function PREP(addActionEventHandler); PREP(addActionMenuEventHandler); @@ -9,15 +11,21 @@ PREP(addCustomEventHandler); PREP(addLineToDebugDraw); PREP(addMapMarkerCreatedEventHandler); PREP(addScrollWheelEventHandler); +PREP(addSetting); PREP(adminKick); PREP(ambientBrightness); PREP(applyForceWalkStatus); +PREP(beingCarried); PREP(binarizeNumber); +PREP(blurScreen); PREP(callCustomEventHandlers); PREP(callCustomEventHandlersGlobal); PREP(canGetInPosition); +PREP(canInteract); PREP(canInteractWith); PREP(canUseWeapon); +PREP(carriedByObj); +PREP(carryObj); PREP(changeProjectileDirection); PREP(checkPBOs); PREP(claim); @@ -27,7 +35,12 @@ PREP(codeToString); PREP(convertKeyCode); PREP(createOrthonormalReference); PREP(currentChannel); +PREP(debug); +PREP(debugModule); +PREP(defineVariable); +PREP(disableAI); PREP(disableUserInput); +PREP(displayIcon); PREP(displayText); PREP(displayTextPicture); PREP(displayTextStructured); @@ -39,20 +52,32 @@ PREP(execRemoteFnc); PREP(executePersistent); PREP(filter); PREP(fixLoweredRifleAnimation); +PREP(getAllDefinedSetVariables); PREP(getAllGear); PREP(getCaptivityStatus); +PREP(getCarriedBy); +PREP(getCarriedObj); PREP(getConfigCommander); PREP(getConfigGunner); +PREP(getDeathAnim); PREP(getDefaultAnim); +PREP(getDefinedVariable); +PREP(getDefinedVariableDefault); +PREP(getDefinedVariableInfo); PREP(getDoorTurrets); +PREP(getFirstObjectIntersection); +PREP(getFirstTerrainIntersection); PREP(getForceWalkStatus); +PREP(getGunner); PREP(getHitPoints); PREP(getHitPointsWithSelections); PREP(getInPosition); PREP(getMarkerType); PREP(getName); PREP(getNumberFromMissionSQM); +PREP(getNumberMagazinesIn); PREP(getPitchBankYaw); +PREP(getSettingData); PREP(getStringFromMissionSQM); PREP(getTargetAzimuthAndInclination); PREP(getTargetDistance); @@ -69,57 +94,97 @@ PREP(getUavControlPosition); PREP(getVehicleCargo); PREP(getVehicleCodriver); PREP(getVehicleCrew); +PREP(getVersion); PREP(getWeaponAzimuthAndInclination); +PREP(getWeaponIndex); PREP(getWeaponType); PREP(getWindDirection); PREP(goKneeling); PREP(hadamardProduct); +PREP(hasItem); +PREP(hasMagazine); +PREP(inheritsFrom); +PREP(insertionSort); PREP(interpolateFromArray); PREP(inTransitionAnim); +PREP(inWater); +PREP(isArrested); PREP(isAutoWind); +PREP(isAwake); PREP(isEngineer); PREP(isEOD); PREP(isInBuilding); +PREP(isModLoaded); PREP(isPlayer); PREP(isTurnedOut); PREP(letterToCode); +PREP(limitMovementSpeed); +PREP(loadPerson); +PREP(loadPersonLocal); +PREP(loadSettingsFromProfile); +PREP(loadSettingsOnServer); PREP(map); PREP(moduleCheckPBOs); PREP(moduleLSDVehicles); +PREP(moveToTempGroup); PREP(muteUnit); PREP(numberToDigits); PREP(numberToDigitsString); +PREP(onAnswerRequest); PREP(onLoadRscDisplayChannel); PREP(owned); PREP(player); PREP(playerSide); PREP(progressBar); PREP(queueAnimation); -PREP(readBooleanParameterFromModule); -PREP(readNumericParameterFromModule); +PREP(readSettingFromModule); +PREP(receiveRequest); PREP(removeActionEventHandler); PREP(removeActionMenuEventHandler); PREP(removeCameraEventHandler); PREP(removeCustomEventHandler); PREP(removeMapMarkerCreatedEventHandler); PREP(removeScrollWheelEventHandler); +PREP(requestCallback); +PREP(resetAllDefaults); PREP(restoreVariablesJIP); PREP(revertKeyCodeLocalized); PREP(sanitizeString); +PREP(sendRequest); PREP(serverLog); +PREP(setArrestState); +PREP(setCanInteract); PREP(setCaptivityStatus); +PREP(setCarriedBy); +PREP(setDefinedVariable); +PREP(setDisableUserInputStatus); PREP(setForceWalkStatus); +PREP(setHearingCapability); PREP(setName); PREP(setParameter); PREP(setPitchBankYaw); +PREP(setProne); +PREP(setSetting); +PREP(setSettingFromConfig); PREP(setVariableJIP); +PREP(setVariablePublic); +PREP(setVolume); +PREP(sortAlphabeticallyBy); +PREP(stringCompare); PREP(stringToColoredText); +PREP(stringRemoveWhiteSpace); PREP(subString); +PREP(switchToGroupSide); +PREP(throttledPublicVariable); PREP(toBin); PREP(toBitmask); PREP(toHex); PREP(toNumber); +PREP(uniqueElementsOnly); +PREP(unloadPerson); PREP(unmuteUnit); +PREP(useItem); +PREP(useMagazine); PREP(waitAndExecute); // ACE_Debug @@ -160,7 +225,10 @@ PREP(hashListSelect); PREP(hashListSet); PREP(hashListPush); - +// Load settings +if (isServer) then { + call FUNC(loadSettingsOnServer); +}; ACE_player = player; @@ -181,76 +249,6 @@ if (hasInterface) then { }, 0, []] call cba_fnc_addPerFrameHandler; }; - -PREP(stringCompare); -PREP(string_removeWhiteSpace); -PREP(isHC); -PREP(sendRequest_f); -PREP(requestCallback); -PREP(receiveRequest); -PREP(onAnswerRequest); -PREP(debug); -PREP(debugModule); -PREP(defineVariable); -PREP(setDefinedVariable); -PREP(getDefinedVariable); -PREP(getAllDefinedSetVariables); -PREP(getDefinedVariableInfo); -PREP(getDefinedVariableDefault); -PREP(getDeathAnim); -PREP(insertionSort); -PREP(uniqueElementsOnly); -PREP(sortAlphabeticallyBy); -PREP(hasMagazine); -PREP(useMagazine); -PREP(findMagazine); -PREP(hasItem); -PREP(useItem); -PREP(findItem); -PREP(getNumberMagazinesIn); -PREP(setCanInteract); -PREP(getCanInteract); -PREP(canInteract); -PREP(resetAllDefaults_f); -PREP(broadcastSound3D_f); - -PREP(isAwake); -PREP(setProne); - -PREP(setDisableUserInputStatus); - -PREP(dropWeapon_f); -PREP(inWater_f); -PREP(setVolume_f); -PREP(closeAllDialogs_f); -PREP(disableAI_f); -PREP(switchToGroupSide_f); -PREP(getFirstObjectIntersection); -PREP(getFirstTerrainIntersection); -PREP(setHearingCapability); -PREP(revealObject_f); -PREP(getWeaponItems_f); -PREP(isModLoaded_f); -PREP(inheritsFrom); -PREP(getVersion); -PREP(carryObj); -PREP(carriedByObj); -PREP(getCarriedObj); -PREP(getCarriedBy); -PREP(beingCarried); -PREP(setCarriedBy); - - -PREP(moveToTempGroup); - - -PREP(limitMovementSpeed); -PREP(setArrestState); -PREP(isArrested); -PREP(loadPerson_F); -PREP(loadPersonLocal_F); -PREP(unloadPerson_F); - - - ADDON = true; + +isHC = !(hasInterface || isDedicated); diff --git a/addons/common/config.cpp b/addons/common/config.cpp index 2be05e6b57..d562d185ec 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -57,13 +57,78 @@ class ACE_canInteractConditions { }; }; -class ACE_Options { +class ACE_Settings { + /* + *class GVAR(sampleSetting) { + * Value + * value = 1; + * + * Type (SCALAR, BOOL, STRING, ARRAY, COLOR) + * typeName = "SCALAR"; + * + * Force the setting? + * force = 0; + * + * Does it appear on the options menu? + * isClientSetable = 1; + * + * The following settings only apply when isClientSetable == 1 + * Stringtable entry with the setting name + * displayName = "$STR_ACE_Common_SettingName"; + * + * Stringtable entry with the setting description + * description = "$STR_ACE_Common_SettingDescription"; + * + * Stringtable entries that describe the options + * Only applies if typeName == "SCALAR"; + * values[] = {"Disabled", "Enabled", "Only Cursor", "Only On Keypress", "Only Cursor and KeyPress"}; + *}; + */ + class GVAR(forceAllSettings) { + value = 0; + typeName = "BOOL"; + }; class GVAR(enableNumberHotkeys) { + value = 1; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_Common_EnableNumberHotkeys"; - default = 1; + }; + class GVAR(settingFeedbackIcons) { + value = 1; + typeName = "SCALAR"; + force = 0; + isClientSetable = 1; + displayName = "$STR_ACE_Common_SettingFeedbackIconsName"; + description = "$STR_ACE_Common_SettingFeedbackIconsDesc"; + values[] = {"Hide", "Top right, downwards", "Top right, to the left", "Top left, downwards", "Top left, to the right"}; + }; + class GVAR(SettingProgressBarLocation) { + value = 0; + typeName = "SCALAR"; + force = 0; + isClientSetable = 1; + displayName = "$STR_ACE_Common_SettingProgressbarLocationName"; + description = "$STR_ACE_Common_SettingProgressbarLocationDesc"; + values[] = {"Top", "Bottom"}; + }; + class GVAR(displayTextColor) { + value[] = {0,0,0,0.1}; + typeName = "COLOR"; + isClientSetable = 1; + displayName = "$STR_ACE_Common_SettingDisplayTextColorName"; + description = "$STR_ACE_Common_SettingDisplayTextColorDesc"; + }; + class GVAR(displayTextFontColor) { + value[] = {1,1,1,1}; + typeName = "COLOR"; + isClientSetable = 1; + displayName = "$STR_ACE_Common_SettingDisplayTextFontColorName"; + description = "$STR_ACE_Common_SettingDisplayTextFontColorDesc"; }; }; +#include "define.hpp" #include #include #include @@ -71,3 +136,23 @@ class ACE_Options { #include #include +class CfgUIGrids { + class IGUI { + class Presets { + class Arma3 { + class Variables { + grid_ACE_displayText[] = {{((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40)),safeZoneY + 0.175 * safezoneH, (10 *(((safezoneW / safezoneH) min 1.2) / 40)), (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))}, "(((safezoneW / safezoneH) min 1.2) / 40)","((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"}; + }; + }; + }; + + class Variables { + class grid_ACE_displayText { + displayName = "ACE Hint"; + description = "Textual in game feedback to the player."; + preview = "\a3\Ui_f\data\GUI\Cfg\UIGrids\grid_hint_ca.paa"; + saveToProfile[] = {0,1}; + }; + }; + }; +}; diff --git a/addons/gui/UI/define.hpp b/addons/common/define.hpp similarity index 97% rename from addons/gui/UI/define.hpp rename to addons/common/define.hpp index 13ce7d8a3e..f1cc009864 100644 --- a/addons/gui/UI/define.hpp +++ b/addons/common/define.hpp @@ -182,12 +182,12 @@ class ACE_gui_buttonBase { bottom = 0.00; }; textureNoShortcut = ""; - animTextureNormal = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa) ); - animTextureDisabled = QUOTE( PATHTOF(data\buttonDisabled_gradient.paa)); - animTextureOver = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa)); - animTextureFocused = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa)); - animTexturePressed = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa)); - animTextureDefault = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa)); + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.8)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; period = 0.5; font = FontCSE; soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1}; diff --git a/addons/common/functions/fnc_addSetting.sqf b/addons/common/functions/fnc_addSetting.sqf new file mode 100644 index 0000000000..866b7fb35b --- /dev/null +++ b/addons/common/functions/fnc_addSetting.sqf @@ -0,0 +1,40 @@ +/* + * Author: CAA-Picard + * Adds a new setting at runtime, with all it's metadata. + * If has only local effects. + * + * Arguments: + * 0: _name (String) + * 1: _typeName (String) + * 2: _isClientSetable (Bool) + * 3: _localizedName (String) + * 4: _localizedDescription (String) + * 5: _possibleValues (Array) + * 6: _isForced (Bool) + * 7: _defaultValue (Any) + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_8_PVT(_this,_name,_typeName,_isClientSetable,_localizedName,_localizedDescription,_possibleValues,_isForced,_value); + +_settingData = [_name] call FUNC(getSettingData); + +// Exit if the setting already exists +if (count _settingData > 0) exitWith {}; + +// Update the variable +TRACE_2("Setting added",_name,_value); + +// Init the variable +missionNamespace setVariable [_name, _value]; + +// Add the setting data +GVAR(settings) pushBack _this; + +// Raise event locally +["SettingChanged", [_name, _value]] call FUNC(localEvent); diff --git a/addons/gui/functions/fnc_blurScreen.sqf b/addons/common/functions/fnc_blurScreen.sqf similarity index 99% rename from addons/gui/functions/fnc_blurScreen.sqf rename to addons/common/functions/fnc_blurScreen.sqf index 1cde214587..c3d101a37e 100644 --- a/addons/gui/functions/fnc_blurScreen.sqf +++ b/addons/common/functions/fnc_blurScreen.sqf @@ -39,4 +39,4 @@ if (_show) then { GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil; }; }; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_broadcastSound3D_f.sqf b/addons/common/functions/fnc_broadcastSound3D_f.sqf deleted file mode 100644 index 93f95bb431..0000000000 --- a/addons/common/functions/fnc_broadcastSound3D_f.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/** - * fn_broadcastSound3D_f.sqf - * @Descr: Plays a sound in 3D - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, sound STRING] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -if (isDedicated) exitwith{}; -_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; -_sound = [_this, 1, "",[""]] call BIS_fnc_Param; -_unit say3D _sound; \ No newline at end of file diff --git a/addons/common/functions/fnc_closeAllDialogs_f.sqf b/addons/common/functions/fnc_closeAllDialogs_f.sqf deleted file mode 100644 index b5ce1bc280..0000000000 --- a/addons/common/functions/fnc_closeAllDialogs_f.sqf +++ /dev/null @@ -1,14 +0,0 @@ -/** - * fn_closeAllDialogs_f.sqf - * @Descr: Close all dialogs - * @Author: Glowbal - * - * @Arguments: [] - * @Return: void - * @PublicAPI: true - */ -#include "script_component.hpp" - -while {dialog} do { - closeDialog 0; -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_currentChannel.sqf b/addons/common/functions/fnc_currentChannel.sqf index 115364fb24..a7ca8c1dd5 100644 --- a/addons/common/functions/fnc_currentChannel.sqf +++ b/addons/common/functions/fnc_currentChannel.sqf @@ -14,4 +14,4 @@ #define CHANNELS ["group", "side", "global", "command", "vehicle", "direct"] #define CHANNELS_LOCALIZED [localize "str_channel_group", localize "str_channel_side", localize "str_channel_global", localize "str_channel_command", localize "str_channel_vehicle", localize "str_channel_direct"] -CHANNELS select (CHANNELS_LOCALIZED find (uiNamespace getVariable ["ACE_currentChannel", ""])) max 0 +CHANNELS select (CHANNELS_LOCALIZED find (uiNamespace getVariable [QGVAR(currentChannel), ""])) max 0 diff --git a/addons/common/functions/fnc_disableAI_f.sqf b/addons/common/functions/fnc_disableAI.sqf similarity index 100% rename from addons/common/functions/fnc_disableAI_f.sqf rename to addons/common/functions/fnc_disableAI.sqf diff --git a/addons/common/functions/fnc_displayIcon.sqf b/addons/common/functions/fnc_displayIcon.sqf new file mode 100644 index 0000000000..1fbc4e89aa --- /dev/null +++ b/addons/common/functions/fnc_displayIcon.sqf @@ -0,0 +1,120 @@ +/* +* Author: Glowbal +* +* Draw progress bar and execute given function if succesful. +* Finish/Failure/Conditional are all passed [_args, _elapsedTime, _totalTime, _errorCode] +* +* Argument: +* 0: icon ID +* 1: show +* 2: Icon Path +* 3: Icon color +* 4: timeAlive. -1 = forever +* +* Return value: +* Nothing +* +* Example: +* ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1], 0] call ace_gui_fnc_displayIcon; +*/ + + +#include "script_component.hpp" + +// positions for the icon UI +#define RIGHT_SIDE (safezoneW + safezoneX) +#define LEFT_SIDE safezoneX +#define TOP_SIDE safeZoneY +#define BOTTOM_SIDE (safeZoneH + safezoneY) +#define ICON_WIDTH (2 * (((safezoneW / safezoneH) min 1.2) / 40)) +#define X_POS_ICONS (RIGHT_SIDE - (1.5 * ICON_WIDTH)) +#define Y_POS_ICONS (TOP_SIDE + (2.5 * ICON_WIDTH)) +#define DIFFERENCE_ICONS (1.1 * ICON_WIDTH) +#define X_POS_ICONS_SECOND (RIGHT_SIDE - (4.4 * ICON_WIDTH)) +#define Y_POS_ICONS_SECOND (TOP_SIDE + (1.1 * ICON_WIDTH)) + +// setting values +#define TOP_RIGHT_DOWN 1 +#define TOP_RIGHT_LEFT 2 +#define TOP_LEFT_DOWN 3 +#define TOP_LEFT_RIGHT 4 + +// other constants +#define DEFAULT_TIME 6 + +private ["_iconId", "_show", "_icon", "_allControls", "_refresh", "_timeAlive", "_list", "_color"]; +_iconId = _this select 0; +_show = _this select 1; +_icon = _this select 2; +_color = _this select 3; +_timeAlive = if (count _this > 4) then {_this select 4} else {DEFAULT_TIME}; + +disableSerialization; +_list = missionNamespace getvariable [QGVAR(displayIconList),[]]; + +_refresh = { + private ["_allControls"]; + // Refreshing of all icons.. + _allControls = missionNamespace getvariable [QGVAR(displayIconListControls), []]; + { + ctrlDelete _x; + }foreach _allControls; + + _allControls = []; + + private ["_ctrl", "_setting"]; + _setting = missionNamespace getvariable[QGVAR(settingFeedbackIcons), 0]; + if (_setting > 0) then { + { + // +19000 because we want to make certain we are using free IDCs.. + _ctrl = ((findDisplay 46) ctrlCreate ["RscPicture", _foreachIndex + 19000]); + _position = switch (_setting) do { + case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; + case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]}; + case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; + case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]}; + default {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; + }; + _ctrl ctrlSetPosition _position; + _ctrl ctrlsetText (_x select 1); + _ctrl ctrlSetTextColor (_x select 2); + _ctrl ctrlCommit 0; + _allControls pushback _ctrl; + }foreach (missionNamespace getvariable [QGVAR(displayIconList),[]]); + }; + missionNamespace setvariable [QGVAR(displayIconListControls), _allControls]; +}; + +if (_show) then { + if ({(_x select 0 == _iconId)} count _list == 0) then { + _list pushback [_iconId, _icon, _color, time]; + } else { + { + if (_x select 0 == _iconId) exitwith { + _list set [_foreachIndex, [_iconId, _icon, _color, time]]; + }; + }foreach _list; + }; + missionNamespace setvariable [QGVAR(displayIconList), _list]; + call _refresh; + + if (_timeAlive >= 0) then { + [{ + [_this select 0, false, "", [0,0,0], 0] call FUNC(displayIcon); + }, [_iconId], _timeAlive, _timeAlive] call EFUNC(common,waitAndExecute); + }; + +} else { + if ({(_x select 0 == _iconId)} count _list == 1) then { + private "_newList"; + _newList = []; + { + if (_x select 0 != _iconId) then { + _newList pushback _x; + }; + }foreach _list; + + missionNamespace setvariable [QGVAR(displayIconList), _newList]; + call _refresh; + }; +}; diff --git a/addons/common/functions/fnc_displayText.sqf b/addons/common/functions/fnc_displayText.sqf index c6a68cbab2..7121ef6813 100644 --- a/addons/common/functions/fnc_displayText.sqf +++ b/addons/common/functions/fnc_displayText.sqf @@ -18,36 +18,32 @@ #define DEFAULT_DELAY 2 #define DEFAULT_PRIORITY 0 -if (isNil QGVAR(lastHint)) then { - GVAR(lastHint) = [0, 0]; -}; - _this resize 4; -_this spawn { - private ["_text", "_sound", "_delay", "_priority", "_lastHintTime", "_lastHintPriority", "_time"]; +private ["_text", "_sound", "_delay", "_priority", "_lastHintTime", "_lastHintPriority", "_time"]; +_text = _this select 0; +_sound = _this select 1; +_delay = _this select 2; +_priority = _this select 3; - _text = _this select 0; - _sound = _this select 1; - _delay = _this select 2; - _priority = _this select 3; +if (isNil QGVAR(lastHint)) then { + GVAR(lastHint) = [0, 0]; +}; - _lastHintTime = GVAR(lastHint) select 0; - _lastHintPriority = GVAR(lastHint) select 1; +_lastHintTime = GVAR(lastHint) select 0; +_lastHintPriority = GVAR(lastHint) select 1; - if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text}; - if (isNil "_sound") then {_sound = DEFAULT_PLAY_SOUND}; - if (isNil "_delay") then {_delay = DEFAULT_DELAY}; - if (isNil "_priority") then {_priority = DEFAULT_PRIORITY}; +if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text}; +if (isNil "_sound") then {_sound = DEFAULT_PLAY_SOUND}; +if (isNil "_delay") then {_delay = DEFAULT_DELAY}; +if (isNil "_priority") then {_priority = DEFAULT_PRIORITY}; - _time = time; - if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then { +_time = time; +if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then { hintSilent _text; if (_sound) then {playSound "ACE_Sound_Click"}; GVAR(lastHint) set [0, _time]; GVAR(lastHint) set [1, _priority]; - sleep _delay; - if (_time == GVAR(lastHint) select 0) then {hintSilent ""}; - }; + [{if ((_this select 0) == GVAR(lastHint) select 0) then {hintSilent ""};}, [_time], _delay, 0] call FUNC(waitAndExecute); }; diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index 8d46d8d38e..8472b3d1b6 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -1,30 +1,30 @@ /* - * Author: commy2 + * Author: commy2, Glowbal * * Display a structured text with image. * * Argument: - * 0: Text (Anything) - * 1: Image (String) + * 0: Text + * 1: Image + * 2: Image color * * Return value: * Nothing */ + #include "script_component.hpp" -private ["_text", "_image"]; - +private ["_text", "_image", "_imageColor"]; _text = _this select 0; _image = _this select 1; +_imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]}; +_imageColor resize 3; if (typeName _text != "TEXT") then { - _text = parseText format ["%1", _text]; + if (typeName _text == "STRING" && {isLocalized _text}) then { + _text = localize _text; + }; + _text = parseText format ["%1", _text]; }; - -_text = composeText [ - parseText format ["", _image], - lineBreak, - _text -]; - -[_text] call FUNC(displayTextStructured); +_text = composeText [parseText format ["", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text]; +[_text, 2] call FUNC(displayTextStructured); diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 62db6a829f..054e98de70 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -1,26 +1,30 @@ /* - * Author: commy2 + * Author: commy2, Glowbal * * Display a structured text. * * Argument: - * 0: Text (Anything) - * 1: Size of the textbox (Number, optional default: 1) + * 0: Text + * 1: Size of the textbox * * Return value: * Nothing */ + #include "script_component.hpp" -private ["_text", "_size", "_isShown", "_ctrlHint"]; +private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position"]; _text = _this select 0; _size = _this select 1; -if (isNil "_size") then {_size = 1}; +if (isNil "_size") then {_size = 1.5}; if (typeName _text != "TEXT") then { - _text = composeText [lineBreak, parseText format ["%1", _text]]; + if (typeName _text == "STRING" && {isLocalized _text}) then { + _text = localize _text; + }; + _text = composeText [lineBreak, parseText format ["%1", _text]]; }; _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); @@ -30,19 +34,25 @@ _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); disableSerialization; _ctrlHint = uiNamespace getVariable "ACE_ctrlHint"; -_ctrlHint ctrlSetPosition [ - safeZoneW + safeZoneX - 0 * safezoneW, - safeZoneY + 0.2 * safezoneH, - 0.2 * safeZoneW, - _size * 0.1 * SafeZoneH -]; +_ctrlHint ctrlSetBackgroundColor GVAR(displayTextColor); +_ctrlHint ctrlSetTextColor GVAR(displayTextFontColor); +/* +// This does not function at the moment. Has been disabled until it fixed. +_xPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_X", ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40))]; +_yPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH]; +_wPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))]; +_hPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_H", (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))]; +*/ + +_xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40)); +_yPos = safeZoneY + 0.175 * safezoneH; +_wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40)); +_hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)); +_position = [_xPos, _yPos, _wPos, _size * _hPos]; + +_ctrlHint ctrlSetPosition _position; _ctrlHint ctrlCommit 0; _ctrlHint ctrlSetStructuredText _text; -_ctrlHint ctrlSetPosition [ - safeZoneW + safeZoneX - 0.2 * safezoneW, - safeZoneY + 0.2 * safezoneH, - 0.2 * safeZoneW, - _size * 0.1 * SafeZoneH -]; -_ctrlHint ctrlCommit ([0.2, 0] select _isShown); +_ctrlHint ctrlSetPosition _position; +_ctrlHint ctrlCommit ([0.5, 0] select _isShown); diff --git a/addons/common/functions/fnc_dropWeapon_f.sqf b/addons/common/functions/fnc_dropWeapon_f.sqf deleted file mode 100644 index bf1358b5e7..0000000000 --- a/addons/common/functions/fnc_dropWeapon_f.sqf +++ /dev/null @@ -1,39 +0,0 @@ -/** - * fn_dropWeapon_f.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" -private ["_unit","_currentWeapon","_currentAnimation", "_WeaponHolder"]; -_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; - -_currentWeapon = currentWeapon _unit; -_currentAnimation = animationState _unit; -_WeaponHolder = "GroundWeaponHolder" createVehicle position _unit; - -_unit removeWeapon _currentWeapon; -_weaponHolder addWeaponCargoGlobal [_currentWeapon, 1]; -//_unit action [ "DropWeapon", _WeaponHolder, _currentWeapon ]; -_WeaponHolder setPos (getPos _unit); -//_unit switchMove _currentAnimation; - -_primairyWeapon = primaryWeapon _unit; -_secondairyWeapon = secondaryWeapon _unit; -_handGunWeapon = handgunWeapon _unit; - -switch (_currentWeapon) do { - case _primairyWeapon: { - - }; - case _secondairyWeapon: { - - }; - case _handGunWeapon: { - - }; - default {}; -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_endRadioTransmission.sqf b/addons/common/functions/fnc_endRadioTransmission.sqf index 990d4e03d8..772a34a06b 100644 --- a/addons/common/functions/fnc_endRadioTransmission.sqf +++ b/addons/common/functions/fnc_endRadioTransmission.sqf @@ -14,17 +14,17 @@ // ACRE if (isClass (configFile >> "CfgPatches" >> "acre_main")) then { - [-1] call acre_core_fnc_handleMultiPttKeyPressUp; - [0] call acre_core_fnc_handleMultiPttKeyPressUp; - [1] call acre_core_fnc_handleMultiPttKeyPressUp; - [2] call acre_core_fnc_handleMultiPttKeyPressUp; + [-1] call acre_core_fnc_handleMultiPttKeyPressUp; + [0] call acre_core_fnc_handleMultiPttKeyPressUp; + [1] call acre_core_fnc_handleMultiPttKeyPressUp; + [2] call acre_core_fnc_handleMultiPttKeyPressUp; }; // TFAR if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then { - call TFAR_fnc_onSwTangentReleased; - call TFAR_fnc_onAdditionalSwTangentReleased; - call TFAR_fnc_onLRTangentReleased; - call TFAR_fnc_onAdditionalLRTangentReleased; - call TFAR_fnc_onDDTangentReleased; + call TFAR_fnc_onSwTangentReleased; + call TFAR_fnc_onAdditionalSwTangentReleased; + call TFAR_fnc_onLRTangentReleased; + call TFAR_fnc_onAdditionalLRTangentReleased; + call TFAR_fnc_onDDTangentReleased; }; diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf index 10c88d6bca..c298785c26 100644 --- a/addons/common/functions/fnc_exportConfig.sqf +++ b/addons/common/functions/fnc_exportConfig.sqf @@ -1,8 +1,8 @@ // by commy2 /* - usage: + usage: - (configFile >> "CfgAmmo") call FUNC(exportConfig); + (configFile >> "CfgAmmo") call FUNC(exportConfig); */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_findItem.sqf b/addons/common/functions/fnc_findItem.sqf deleted file mode 100644 index 5c4469ea7f..0000000000 --- a/addons/common/functions/fnc_findItem.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/** - * fn_findItem.sqf - * @Descr: - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: true - */ -#include "script_component.hpp" -private ["_unit","_magazine","_return"]; -_unit = _this select 0; -_item = _this select 1; - -if (_item in (uniformItems _unit)) exitwith {1}; -if (_item in (vestItems _unit)) exitwith {2}; -if (_item in (backpackItems _unit)) exitwith {3}; -if (_item in (assignedItems _unit)) exitwith {4}; -if (_item in (primaryWeaponItems _unit)) exitwith {5}; -if (_item in (secondaryWeaponItems _unit)) exitwith {6}; -if (_item in (handgunItems _unit)) exitwith {7}; -if (_item in (items _unit)) exitwith {8}; // in case it is in items but cannot be found in any other container (should never reach this) - -// If we cannot find the item, return 0. -0; \ No newline at end of file diff --git a/addons/common/functions/fnc_findMagazine.sqf b/addons/common/functions/fnc_findMagazine.sqf deleted file mode 100644 index 549d016e8d..0000000000 --- a/addons/common/functions/fnc_findMagazine.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/** - * fn_findMagazine.sqf - * @Descr: Find where the current magazines are. Order: uniform, vest, backpack, any. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, magazine STRING (Classname of magazine)] - * @Return: NUMBER 0 = none, 1 = in uniform, 2 = in vest, 3 = in backpack, 4 = found outside container - * @PublicAPI: true - */ -#include "script_component.hpp" -private ["_unit","_magazine"]; -_unit = _this select 0; -_magazine = _this select 1; - -if (_magazine in (getMagazineCargo uniformContainer _unit)) exitwith {1}; -if (_magazine in (getMagazineCargo vestContainer _unit)) exitwith {2}; -if (_magazine in (getMagazineCargo backpackContainer _unit)) exitwith {3}; -if (_magazine in (magazines _unit)) exitwith {4}; // in case it cannot be found in any other container. Most likely loaded in a weapon. - -// If we cannot find the item, return 0. -0; \ No newline at end of file diff --git a/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf b/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf index 55bc6865b0..411fdd2eb3 100644 --- a/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf +++ b/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf @@ -1,10 +1,22 @@ -// by commy2 +/* + * Author: commy2 + * Fixes the lowered rifle animation + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [_player] call ace_common_fnc_fixLoweredRifleAnimation + * + * Public: No + */ #include "script_component.hpp" -private "_unit"; +PARAMS_1(_unit); -_unit = _this select 0; - -if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"}) then { +if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {(vehicle _unit) == _unit}) then { [_unit, "amovpercmstpsraswrfldnon", 0] call FUNC(doAnimation); }; diff --git a/addons/common/functions/fnc_getCanInteract.sqf b/addons/common/functions/fnc_getCanInteract.sqf deleted file mode 100644 index 87f572b93d..0000000000 --- a/addons/common/functions/fnc_getCanInteract.sqf +++ /dev/null @@ -1,12 +0,0 @@ -/** - * fn_getCanInteract.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" - -((_this select 0) getvariable [QGVAR(canInteract),0]) \ No newline at end of file diff --git a/addons/common/functions/fnc_getCustomResults_f.sqf b/addons/common/functions/fnc_getCustomResults_f.sqf deleted file mode 100644 index 4b68f85c9c..0000000000 --- a/addons/common/functions/fnc_getCustomResults_f.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/** - * fn_getCustomResults_f.sqf - * @Descr: Executes custom results eventhandlers, collects their output and returns this. - * @Author: Glowbal - * - * @Arguments: [arguments ANY, handle STRING] - * @Return: ARRAY Collection of all return values of all executed CustomResult handlers - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_arguments","_handle","_ehCfg","_eventHandlerCollection","_eventHandlerName","_cfg","_code","_classType", "_return"]; -_arguments = _this select 0; -_handle = _this select 1; - -_eventHandlerName = ("ace_f_custom_results_eventhandler_" + _handle); -_eventHandlerCollection = missionNamespace getvariable _eventHandlerName; -if (isnil "_eventHandlerCollection") then { - _eventHandlerCollection = []; - - // TODO Get a replacement for this - _cfg = (ConfigFile >> "Advanced_Combat_Environment" >> "CustomResults" >> _handle); - if (isClass _cfg) then { - _numberOfEH = count _cfg; - for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do { - _ehCfg = _cfg select _EHiterator; - if (isClass _ehCfg) then { - _classType = (ConfigName _ehCfg); - _code = (compile getText(_ehCfg >> "onCall")); - _eventHandlerCollection pushback [_classType, _code]; - true; - }; - }; - }; - missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection]; -}; - -_return = []; -{ - _return pushback (_arguments call (_x select 1)); - false; -}count _eventHandlerCollection; - -_return diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf new file mode 100644 index 0000000000..71191083e0 --- /dev/null +++ b/addons/common/functions/fnc_getGunner.sqf @@ -0,0 +1,28 @@ +/* + * Author: commy2 + * + * Get the gunner of a vehicle who uses the given weapon type. Requires every turret to have a different weapon. + * + * Argument: + * 0: The vehicle (Object) + * 1: weapon of the vehicle (String) + * + * Return value: + * The turret gunner with this weapon (Object) + */ + +private ["_vehicle", "_weapon"]; + +_vehicle = _this select 0; +_weapon = _this select 1; + +private "_gunner"; +_gunner = objNull; + +{ + if (_weapon in (_vehicle weaponsTurret _x)) exitWith { + _gunner = _vehicle turretUnit _x; + }; +} forEach allTurrets _vehicle; + +_gunner diff --git a/addons/common/functions/fnc_getHitPoints.sqf b/addons/common/functions/fnc_getHitPoints.sqf index a6d75e41b9..26b0b1b840 100644 --- a/addons/common/functions/fnc_getHitPoints.sqf +++ b/addons/common/functions/fnc_getHitPoints.sqf @@ -23,33 +23,33 @@ _hitpoints = []; private "_hitpointClasses"; _hitpointClasses = [_config >> "HitPoints"]; { - private "_class"; - _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; + private "_class"; + _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; - if (isClass _class) then { - _hitpointClasses pushBack _class; - }; + if (isClass _class) then { + _hitpointClasses pushBack _class; + }; } forEach allTurrets _vehicle; // iterate through all classes with hitpoints and their parents { - private "_class"; - _class = _x; + private "_class"; + _class = _x; - while {isClass _class} do { + while {isClass _class} do { - for "_i" from 0 to (count _class - 1) do { - private "_entry"; - _entry = configName (_class select _i); + for "_i" from 0 to (count _class - 1) do { + private "_entry"; + _entry = configName (_class select _i); - if (!(_entry in _hitpoints) && {!isNil {_vehicle getHitPointDamage _entry}}) then { - _hitpoints pushBack _entry; - }; - }; + if (!(_entry in _hitpoints) && {!isNil {_vehicle getHitPointDamage _entry}}) then { + _hitpoints pushBack _entry; + }; + }; - _class = inheritsFrom _class; - }; + _class = inheritsFrom _class; + }; } forEach _hitpointClasses; diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf index e9a7a8fac5..f0c9801382 100644 --- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf +++ b/addons/common/functions/fnc_getHitPointsWithSelections.sqf @@ -24,36 +24,36 @@ _selections = []; private "_hitpointClasses"; _hitpointClasses = [_config >> "HitPoints"]; { - private "_class"; - _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; + private "_class"; + _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; - if (isClass _class) then { - _hitpointClasses pushBack _class; - }; + if (isClass _class) then { + _hitpointClasses pushBack _class; + }; } forEach allTurrets _vehicle; // iterate through all classes with hitpoints and their parents { - private "_class"; - _class = _x; + private "_class"; + _class = _x; - while {isClass _class} do { + while {isClass _class} do { - for "_i" from 0 to (count _class - 1) do { - private ["_entry", "_selection"]; + for "_i" from 0 to (count _class - 1) do { + private ["_entry", "_selection"]; - _entry = configName (_class select _i); - _selection = getText (_class select _i >> "name"); + _entry = configName (_class select _i); + _selection = getText (_class select _i >> "name"); - if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { - _hitpoints pushBack _entry; - _selections pushBack _selection; - }; - }; + if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { + _hitpoints pushBack _entry; + _selections pushBack _selection; + }; + }; - _class = inheritsFrom _class; - }; + _class = inheritsFrom _class; + }; } forEach _hitpointClasses; diff --git a/addons/common/functions/fnc_getSettingData.sqf b/addons/common/functions/fnc_getSettingData.sqf new file mode 100644 index 0000000000..3dd2582860 --- /dev/null +++ b/addons/common/functions/fnc_getSettingData.sqf @@ -0,0 +1,31 @@ +/* + * Author: CAA-Picard + * Returns the metadata of a setting if it exists + * + * Arguments: + * 0: Name of the setting (String) + * + * Return Value: + * Setting Data (Array) + * 0: _name + * 1: _typeName + * 2: _isClientSetable + * 3: _localizedName + * 4: _localizedDescription + * 5: _possibleValues + * 6: _isForced + * 7: _defaultValue + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_1_PVT(_this,_name); + +private ["_value"]; +_value = []; +{ + if ((_x select 0) == _name) exitWith {_value = _x}; +} forEach GVAR(settings); + +_value diff --git a/addons/common/functions/fnc_getWeaponIndex.sqf b/addons/common/functions/fnc_getWeaponIndex.sqf new file mode 100644 index 0000000000..f2b8bce9f2 --- /dev/null +++ b/addons/common/functions/fnc_getWeaponIndex.sqf @@ -0,0 +1,25 @@ +/* + * Author: commy2 + * Get the index of the weapon. + * 0 = primary, 1 = secondary, 2 = handgun, -1 = other + * + * Argument: + * 0: Unit + * 1: Weapon + * + * Return value: + * Weapon index + * + * Public: No + */ + #include "script_component.hpp" + + EXPLODE_2_PVT(_this,_unit,_weapon); + +if (_weapon == "") exitWith {-1}; + +[ + primaryWeapon _unit, + secondaryWeapon _unit, + handgunWeapon _unit +] find _weapon diff --git a/addons/common/functions/fnc_getWeaponItems_f.sqf b/addons/common/functions/fnc_getWeaponItems_f.sqf deleted file mode 100644 index d18ce28a72..0000000000 --- a/addons/common/functions/fnc_getWeaponItems_f.sqf +++ /dev/null @@ -1,14 +0,0 @@ -/** - * fn_getWeaponItems_f.sqf - * @Descr: Get the weapon items from the unit. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" -private "_unit"; -_unit = _this select 0; - -[primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit]; \ No newline at end of file diff --git a/addons/common/functions/fnc_hashGet.sqf b/addons/common/functions/fnc_hashGet.sqf index 6147d06a73..7682b2f6a2 100644 --- a/addons/common/functions/fnc_hashGet.sqf +++ b/addons/common/functions/fnc_hashGet.sqf @@ -9,18 +9,18 @@ _key = _this select 1; ERRORDATA(2); _val = nil; try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index != -1) then { - _val = (_hash select 1) select _index; - if(IS_STRING(_val) && {_val == "ACREHASHREMOVEDONOTUSETHISVAL"}) then { - _val = nil; - }; - }; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index != -1) then { + _val = (_hash select 1) select _index; + if(IS_STRING(_val) && {_val == "ACREHASHREMOVEDONOTUSETHISVAL"}) then { + _val = nil; + }; + }; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; _val diff --git a/addons/common/functions/fnc_hashHasKey.sqf b/addons/common/functions/fnc_hashHasKey.sqf index d69ad2f3e8..8011e987fb 100644 --- a/addons/common/functions/fnc_hashHasKey.sqf +++ b/addons/common/functions/fnc_hashHasKey.sqf @@ -9,15 +9,15 @@ _key = _this select 1; ERRORDATA(2); _val = false; try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index != -1) then { - _val = true; - }; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index != -1) then { + _val = true; + }; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; _val diff --git a/addons/common/functions/fnc_hashListCreateHash.sqf b/addons/common/functions/fnc_hashListCreateHash.sqf index fef9c79b85..cdad5987cd 100644 --- a/addons/common/functions/fnc_hashListCreateHash.sqf +++ b/addons/common/functions/fnc_hashListCreateHash.sqf @@ -7,12 +7,12 @@ _hashList = _this select 0; ERRORDATA(1); _hashKeys = []; try { - if(VALIDHASH(_hashList)) then { - _hashKeys = (_hashList select 0); - } else { - ERROR("Input hashlist is not valid"); - }; + if(VALIDHASH(_hashList)) then { + _hashKeys = (_hashList select 0); + } else { + ERROR("Input hashlist is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; [_hashKeys, []]; diff --git a/addons/common/functions/fnc_hashListPush.sqf b/addons/common/functions/fnc_hashListPush.sqf index e783f7c324..afd092a1b9 100644 --- a/addons/common/functions/fnc_hashListPush.sqf +++ b/addons/common/functions/fnc_hashListPush.sqf @@ -7,11 +7,11 @@ _hashList = _this select 0; _value = _this select 1; ERRORDATA(2); try { - if(VALIDHASH(_hashList)) then { - [_hashList, (count (_hashList select 1)), _value] call FUNC(hashListSet); - } else { - ERROR("Input hashlist in push not valid"); - }; + if(VALIDHASH(_hashList)) then { + [_hashList, (count (_hashList select 1)), _value] call FUNC(hashListSet); + } else { + ERROR("Input hashlist in push not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; diff --git a/addons/common/functions/fnc_hashListSelect.sqf b/addons/common/functions/fnc_hashListSelect.sqf index e1ee0aae0f..0c552d072e 100644 --- a/addons/common/functions/fnc_hashListSelect.sqf +++ b/addons/common/functions/fnc_hashListSelect.sqf @@ -8,20 +8,20 @@ _index = _this select 1; ERRORDATA(2); _hash = nil; try { - if(VALIDHASH(_hashList)) then { - _keys = _hashList select 0; - _hashes = _hashList select 1; - if(_index < (count _hashes)) then { - _values = _hashes select _index; + if(VALIDHASH(_hashList)) then { + _keys = _hashList select 0; + _hashes = _hashList select 1; + if(_index < (count _hashes)) then { + _values = _hashes select _index; - _hash = [_keys, _values, 1]; - } else { - ERROR("Index of hashlist is out of range"); - }; - } else { - ERROR("Input hashlist is not valid"); - }; + _hash = [_keys, _values, 1]; + } else { + ERROR("Index of hashlist is out of range"); + }; + } else { + ERROR("Input hashlist is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; _hash; diff --git a/addons/common/functions/fnc_hashListSet.sqf b/addons/common/functions/fnc_hashListSet.sqf index 8b7239dffd..c384bc15c9 100644 --- a/addons/common/functions/fnc_hashListSet.sqf +++ b/addons/common/functions/fnc_hashListSet.sqf @@ -8,17 +8,17 @@ _index = _this select 1; _value = _this select 2; ERRORDATA(3); try { - if(VALIDHASH(_hashList)) then { - if(VALIDHASH(_value)) then { - _vals = _value select 1; - - (_hashList select 1) set[_index, _vals]; - } else { - ERROR("Set hash in hashlist is not valid"); - }; - } else { - ERROR("Input hashlist is not valid"); - }; + if(VALIDHASH(_hashList)) then { + if(VALIDHASH(_value)) then { + _vals = _value select 1; + + (_hashList select 1) set[_index, _vals]; + } else { + ERROR("Set hash in hashlist is not valid"); + }; + } else { + ERROR("Input hashlist is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; diff --git a/addons/common/functions/fnc_hashRem.sqf b/addons/common/functions/fnc_hashRem.sqf index 86898fb3df..000dbbefe0 100644 --- a/addons/common/functions/fnc_hashRem.sqf +++ b/addons/common/functions/fnc_hashRem.sqf @@ -8,23 +8,23 @@ _key = _this select 1; ERRORDATA(2); _val = nil; try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index != -1) then { - (_hash select 1) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; - // is this hash is not part of a hash list? - // if it is we need to leave the keys intact. - if((count _hash) == 2) then { - // if this is a standalone hash then we can clean it up - (_hash select 0) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; - _hash set[0, ((_hash select 0) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; - _hash set[1, ((_hash select 1) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; - }; - }; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index != -1) then { + (_hash select 1) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; + // is this hash is not part of a hash list? + // if it is we need to leave the keys intact. + if((count _hash) == 2) then { + // if this is a standalone hash then we can clean it up + (_hash select 0) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; + _hash set[0, ((_hash select 0) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; + _hash set[1, ((_hash select 1) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; + }; + }; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; true diff --git a/addons/common/functions/fnc_hashSet.sqf b/addons/common/functions/fnc_hashSet.sqf index 23438eaf83..0e374d5f12 100644 --- a/addons/common/functions/fnc_hashSet.sqf +++ b/addons/common/functions/fnc_hashSet.sqf @@ -9,19 +9,19 @@ _key = _this select 1; _val = _this select 2; ERRORDATA(3); try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index == -1) then { - _index = (_hash select 0) find "ACREHASHREMOVEDONOTUSETHISVAL"; - if(_index == -1) then { - _index = (count (_hash select 0)); - }; - (_hash select 0) set[_index, _key]; - }; - (_hash select 1) set[_index, _val]; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index == -1) then { + _index = (_hash select 0) find "ACREHASHREMOVEDONOTUSETHISVAL"; + if(_index == -1) then { + _index = (count (_hash select 0)); + }; + (_hash select 0) set[_index, _key]; + }; + (_hash select 1) set[_index, _val]; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; diff --git a/addons/common/functions/fnc_inWater_f.sqf b/addons/common/functions/fnc_inWater.sqf similarity index 100% rename from addons/common/functions/fnc_inWater_f.sqf rename to addons/common/functions/fnc_inWater.sqf diff --git a/addons/common/functions/fnc_isHC.sqf b/addons/common/functions/fnc_isHC.sqf deleted file mode 100644 index 82a9d49ba2..0000000000 --- a/addons/common/functions/fnc_isHC.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/** - * fn_isHC.sqf - * @Descr: Check if current locality is a headless client - * @Author: Glowbal - * - * @Arguments: [] - * @Return: BOOL True if locality is headless client OR is not in multiplayer - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_return"]; - -if (!isMultiplayer) then { - _return = true; -} else { - if (isServer && !isDedicated) then { - _return = true; - } else { - _return = !(hasInterface || isDedicated); - }; -}; -_return \ No newline at end of file diff --git a/addons/common/functions/fnc_isModLoaded_f.sqf b/addons/common/functions/fnc_isModLoaded.sqf similarity index 100% rename from addons/common/functions/fnc_isModLoaded_f.sqf rename to addons/common/functions/fnc_isModLoaded.sqf diff --git a/addons/common/functions/fnc_loadPerson_f.sqf b/addons/common/functions/fnc_loadPerson.sqf similarity index 86% rename from addons/common/functions/fnc_loadPerson_f.sqf rename to addons/common/functions/fnc_loadPerson.sqf index 5944879c62..0d2995db1b 100644 --- a/addons/common/functions/fnc_loadPerson_f.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -10,7 +10,7 @@ #include "script_component.hpp" -#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F)) +#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) private ["_caller", "_unit","_vehicle", "_loadcar", "_loadhelicopter", "_loadtank"]; _caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; @@ -34,9 +34,9 @@ if (_unit distance _loadcar <= 10) then { }; }; if (!isNull _vehicle) then { - [_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f); + [_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide); [_caller,objNull] call FUNC(carryObj); [_unit,objNull] call FUNC(carryObj); - [[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal_F)), _unit, false] call EFUNC(common,execRemoteFnc); + [[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal)), _unit, false] call EFUNC(common,execRemoteFnc); }; _vehicle \ No newline at end of file diff --git a/addons/common/functions/fnc_loadPersonLocal_f.sqf b/addons/common/functions/fnc_loadPersonLocal.sqf similarity index 83% rename from addons/common/functions/fnc_loadPersonLocal_f.sqf rename to addons/common/functions/fnc_loadPersonLocal.sqf index dbba09111a..6e31050cf9 100644 --- a/addons/common/functions/fnc_loadPersonLocal_f.sqf +++ b/addons/common/functions/fnc_loadPersonLocal.sqf @@ -16,13 +16,13 @@ _vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param; _caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param; if (!alive _unit) then { - _unit = [_unit,_caller] call FUNC(makeCopyOfBody_F); + _unit = [_unit,_caller] call FUNC(makeCopyOfBody); }; _unit moveInCargo _vehicle; -_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]]; +_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; _loaded pushback _unit; -_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true]; +_vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; if (!([_unit] call FUNC(isAwake))) then { _handle = [_unit,_vehicle] spawn { private ["_unit","_vehicle"]; diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf new file mode 100644 index 0000000000..1e8e9001aa --- /dev/null +++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf @@ -0,0 +1,37 @@ +/* + * Author: CAA-Picard + * Load the user setable settings from the user profile. + * Config < Server UserConfig < Mission Config < Client settings + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +// Iterate through settings +{ + _name = _x select 0; + _isClientSetable = _x select 2; + _isForced = _x select 6; + + // If setting is user setable + if (_isClientSetable) then { + // If setting is not forced + if !(_isForced) then { + _profileValue = profileNamespace getvariable _name; + // If the setting is stored on the profile + if !(isNil "_profileValue") then { + // If the profile variable has the correct type + if (typeName _profileValue == typeName (missionNamespace getvariable _name)) then { + // Load the setting from the profile + missionNamespace setvariable [_name, _profileValue]; + }; + }; + }; + }; +} forEach GVAR(settings); diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf new file mode 100644 index 0000000000..20a7e1c40f --- /dev/null +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -0,0 +1,69 @@ +/* + * Author: CAA-Picard + * Load the parameters on the server. + * Config < Server UserConfig < Mission Config + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(settings) = []; + +// Load settings from main config +_countOptions = count (configFile >> "ACE_Settings"); +for "_index" from 0 to (_countOptions - 1) do { + _optionEntry = (configFile >> "ACE_Settings") select _index; + + [_optionEntry] call FUNC(setSettingFromConfig); +}; +// Check if all settings should be forced +if (GVAR(forceAllSettings)) then { + { + _x set [6, true]; + } forEach GVAR(settings); +}; + +// @todo +// Load settings from server userconfig only if the ACE_ServerSettings is loaded +/*if (isClass (configFile >> "CfgPatches" >> "ACE_ServerSettings")) then { + DFUNC(serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp"; + if !(isNil DFUNC(serverUserConfig)) then { + [] call FUNC(serverUserConfig); + }; + // Check if all settings should be forced + if (GVAR(forceAllSettings)) then { + { + if !(missionNamespace getVariable format ["%1_forced", _x]) then { + missionNamespace setVariable format ["%1_forced", _x, true]; + publicVariable format ["%1_forced", _name]; + }; + } forEach GVAR(settingsList); + }; +};*/ + +// Load settings from mission config +_countOptions = count (missionConfigFile >> "ACE_Settings"); +for "_index" from 0 to (_countOptions - 1) do { + _optionEntry = (missionConfigFile >> "ACE_Settings") select _index; + + [_optionEntry] call FUNC(setSettingFromConfig); +}; +// Check if all settings should be forced +if (GVAR(forceAllSettings)) then { + { + _x set [6, true]; + } forEach GVAR(settings); +}; + +// Publish all settings data +publicVariable QGVAR(settings); +// Publish all setting values +{ + publicVariable (_x select 0); +} forEach GVAR(settings); diff --git a/addons/common/functions/fnc_moveToTempGroup.sqf b/addons/common/functions/fnc_moveToTempGroup.sqf index b146e67ef3..802bc2285d 100644 --- a/addons/common/functions/fnc_moveToTempGroup.sqf +++ b/addons/common/functions/fnc_moveToTempGroup.sqf @@ -18,12 +18,12 @@ if (_moveTo) then { _previousGroup = group _unit; _newGroup = createGroup (side _previousGroup); [_unit] joinSilent _newGroup; - _unit setvariable [QGVAR(previousGroup_F),_previousGroup]; + _unit setvariable [QGVAR(previousGroup),_previousGroup]; } else { - _previousGroup = _unit getvariable QGVAR(previousGroup_F); + _previousGroup = _unit getvariable QGVAR(previousGroup); if (!isnil "_previousGroup") then { _currentGroup = group _unit; - _unit setvariable [QGVAR(previousGroup_F),nil]; + _unit setvariable [QGVAR(previousGroup),nil]; [_unit] joinSilent _previousGroup; if (count units _currentGroup == 0) then { deleteGroup _currentGroup; diff --git a/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf b/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf index 2a2fbfc9a4..ae8113c1b8 100644 --- a/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf +++ b/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf @@ -1,24 +1,29 @@ /* - Name: FUNC(onLoadRscDisplayChannel) - - Author: Pabst Mirror, commy2 - - Description: - When the RscDisplayChannel is loaded, this will constantly uiNamespace variable "ACE_currentChannel" - with the raw localized text of CA_Channel (IDC=101). Only runs while the display is open. - - Parameters: - 0: DISPLAY - RscDisplayChannel - - Returns: - Nothing -*/ + * Author: Pabst Mirror, commy2 + * When the RscDisplayChannel is loaded, this will constantly uiNamespace variable ace_common_currentChannel + * with the raw localized text of CA_Channel (IDC=101). Only runs while the display is open. + * + * Arguments: + * 0: The RscDisplayChannel Display + * + * Return Value: + * Nothing + * + * Example: + * onLoad = QUOTE(_this call FUNC(onLoadRscDisplayChannel)); + * + * Public: No + */ #include "script_component.hpp" -uiNamespace setVariable ["ACE_ctrlChannel", (_this select 0) displayCtrl 101]; +uiNamespace setVariable [QGVAR(currentChannelControl), ((_this select 0) displayCtrl 101)]; ["ACE_currentChannel", "onEachFrame", { - if (ctrlText (uiNamespace getVariable ["ACE_ctrlChannel", controlNull]) != "") then { - uiNamespace setVariable ["ACE_currentChannel", ctrlText (uiNamespace getVariable ["ACE_ctrlChannel", controlNull])]; - }; + if (isNull (uiNamespace getVariable [QGVAR(currentChannelControl), controlNull])) then { + ["ACE_currentChannel", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; + } else { + private "_localizedChannelText"; + _localizedChannelText = ctrlText (uiNamespace getVariable [QGVAR(currentChannelControl), controlNull]); + uiNamespace setVariable [QGVAR(currentChannel), _localizedChannelText]; + }; }] call BIS_fnc_addStackedEventhandler; diff --git a/addons/common/functions/fnc_progressBar.sqf b/addons/common/functions/fnc_progressBar.sqf index ab4cb7b69c..0b8fcc7ac4 100644 --- a/addons/common/functions/fnc_progressBar.sqf +++ b/addons/common/functions/fnc_progressBar.sqf @@ -15,6 +15,9 @@ * * Return value: * Nothing +* +* Example: +* [5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar */ #include "script_component.hpp" @@ -32,14 +35,24 @@ closeDialog 0; createDialog QGVAR(ProgressBar_Dialog); (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle; +if (GVAR(SettingProgressBarLocation) == 1) then { + private "_ctrlPos"; + _ctrlPos = [1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2), 29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2), 38 * (((safezoneW / safezoneH) min 1.2) / 40), 0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)]; + (uiNamespace getVariable QGVAR(ctrlProgressBar)) ctrlSetPosition _ctrlPos; + (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetPosition _ctrlPos; + (uiNamespace getVariable QGVAR(ctrlProgressBar)) ctrlCommit 0; + (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlCommit 0; +}; + + _perFrameFunction = { PARAMS_2(_parameters,_pfhID); EXPLODE_8_PVT(_parameters,_args,_onFinish,_onFail,_condition,_player,_startTime,_totalTime,_exceptions); private ["_elapsedTime", "_errorCode"]; - + _elapsedTime = time - _startTime; _errorCode = -1; - + if (isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then { _errorCode = 1; } else { diff --git a/addons/common/functions/fnc_queueAnimation.sqf b/addons/common/functions/fnc_queueAnimation.sqf index a489a46174..73f3dca109 100644 --- a/addons/common/functions/fnc_queueAnimation.sqf +++ b/addons/common/functions/fnc_queueAnimation.sqf @@ -4,7 +4,7 @@ terminate (missionNamespace getVariable [QGVAR(waitForAnimationHandle), scriptNull]); GVAR(waitForAnimationHandle) = _this spawn { - waitUntil {!([_this select 0] call FUNC(inTransitionAnim))}; + waitUntil {!([_this select 0] call FUNC(inTransitionAnim))}; - _this call FUNC(doAnimation); + _this call FUNC(doAnimation); }; diff --git a/addons/common/functions/fnc_readBooleanParameterFromModule.sqf b/addons/common/functions/fnc_readBooleanParameterFromModule.sqf deleted file mode 100644 index 9ee2faa001..0000000000 --- a/addons/common/functions/fnc_readBooleanParameterFromModule.sqf +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: CAA-Picard - * - * Reads a boolean value from a module, sets de ACE_Parameter. Logs if parameters are missing in the module. - * - * Arguments: - * 0: Module (Object) - * 1: ACE_Parameter name (string) - * 2: Module parameter name (string) - * - * Return Value: - * None - */ -#include "script_component.hpp" - - private ["_logic", "_parameterName", "_moduleParameterName"]; - -_logic = _this select 0; -_parameterName = _this select 1; -_moduleParameterName = _this select 2; - -// Check if the parameter is defined in the module -if (isNil {_logic getVariable _moduleParameterName}) exitWith { - diag_log text format["[ACE]: Warning in %1 module: %2 parameter is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleParameterName]; -}; - -// Set the parameter -[_parameterName , if (_logic getVariable _moduleParameterName) then {1} else {0}] call FUNC(setParameter); diff --git a/addons/common/functions/fnc_readNumericParameterFromModule.sqf b/addons/common/functions/fnc_readNumericParameterFromModule.sqf deleted file mode 100644 index a9c35f5b46..0000000000 --- a/addons/common/functions/fnc_readNumericParameterFromModule.sqf +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: CAA-Picard - * - * Reads a numeric value from a module, sets de ACE_Parameter. Logs if parameters are missing in the module. - * - * Arguments: - * 0: Module (Object) - * 1: ACE_Parameter name (string) - * 2: Module parameter name (string) - * - * Return Value: - * None - */ -#include "script_component.hpp" - - private ["_logic", "_parameterName", "_moduleParameterName", "_value"]; - -_logic = _this select 0; -_parameterName = _this select 1; -_moduleParameterName = _this select 2; - -// Check if the parameter is defined in the module -if (isNil {_logic getVariable _moduleParameterName}) exitWith { - diag_log text format["[ACE]: Warning in %1 module: %2 parameter is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleParameterName] -}; - -// Check if the value is defined as string for backward compatibility -_value = _logic getVariable _moduleParameterName; -if (typeName _value == "STRING") then { - _value = parseNumber _value; -}; - -// Set the parameter -[_parameterName, _value] call FUNC(setParameter); diff --git a/addons/common/functions/fnc_readSettingFromModule.sqf b/addons/common/functions/fnc_readSettingFromModule.sqf new file mode 100644 index 0000000000..0f3ab447b1 --- /dev/null +++ b/addons/common/functions/fnc_readSettingFromModule.sqf @@ -0,0 +1,27 @@ +/* + * Author: CAA-Picard + * + * Reads a setting value from a module, set it and force it. Logs if the setting is missing from the module. + * Must be called on the server, effect is global. + * + * Arguments: + * 0: Module (Object) + * 1: ACE_Parameter name (string) + * 2: Module parameter name (string) + * + * Return Value: + * None + */ +#include "script_component.hpp" + +if !(isServer) exitWith {}; + +EXPLODE_3_PVT(_this,_logic,_settingName,_moduleVariable); + +// Check if the parameter is defined in the module +if (isNil {_logic getVariable _moduleVariable}) exitWith { + diag_log text format["[ACE]: Warning in %1 module: %2 setting is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleVariable]; +}; + +// Set the setting globally and force it +[_settingName, _logic getVariable _moduleVariable, true, true] call FUNC(setSetting); diff --git a/addons/common/functions/fnc_resetAllDefaults_f.sqf b/addons/common/functions/fnc_resetAllDefaults.sqf similarity index 74% rename from addons/common/functions/fnc_resetAllDefaults_f.sqf rename to addons/common/functions/fnc_resetAllDefaults.sqf index c415b5b32c..63e6764d01 100644 --- a/addons/common/functions/fnc_resetAllDefaults_f.sqf +++ b/addons/common/functions/fnc_resetAllDefaults.sqf @@ -17,17 +17,17 @@ _unit setvariable ["ACE_isDead",nil,true]; _unit setvariable ["ACE_isUnconscious", nil, true]; if (isPlayer _unit) then { - [true] call FUNC(setVolume_f); - [false] call FUNC(disableKeyInput_f); - if (["ace_medical"] call FUNC(isModLoader_f)) then { + [true] call FUNC(setVolume); + [false] call FUNC(disableKeyInput); + if (["ace_medical"] call FUNC(isModLoader)) then { [false] call EFUNC(medical,effectBlackOut); }; - if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then { + if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { // clear all disable user input { [_X, false] call FUNC(setDisableUserInputStatus); - }foreach GVAR(DISABLE_USER_INPUT_COLLECTION_F); + }foreach GVAR(DISABLE_USER_INPUT_COLLECTION); }; }; diff --git a/addons/common/functions/fnc_revealObject_f.sqf b/addons/common/functions/fnc_revealObject_f.sqf deleted file mode 100644 index 9c5a34f59a..0000000000 --- a/addons/common/functions/fnc_revealObject_f.sqf +++ /dev/null @@ -1,15 +0,0 @@ -/** - * fnc_revealObject_f.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -if (hasInterface) then { - player reveal (_this select 0); -}; \ No newline at end of file diff --git a/addons/gui/functions/fnc_sendDisplayInformationTo.sqf b/addons/common/functions/fnc_sendDisplayInformationTo.sqf similarity index 95% rename from addons/gui/functions/fnc_sendDisplayInformationTo.sqf rename to addons/common/functions/fnc_sendDisplayInformationTo.sqf index ae4012b5fe..f22894e057 100644 --- a/addons/gui/functions/fnc_sendDisplayInformationTo.sqf +++ b/addons/common/functions/fnc_sendDisplayInformationTo.sqf @@ -42,6 +42,6 @@ if (isPlayer _reciever) then { }foreach _content; - [_title,_content,_type] call EFUNC(gui,displayInformation); + [_title,_content,_type] call EFUNC(common,displayInformation); }; }; \ No newline at end of file diff --git a/addons/gui/functions/fnc_sendDisplayMessageTo.sqf b/addons/common/functions/fnc_sendDisplayMessageTo.sqf similarity index 95% rename from addons/gui/functions/fnc_sendDisplayMessageTo.sqf rename to addons/common/functions/fnc_sendDisplayMessageTo.sqf index c66af97266..3c5b399659 100644 --- a/addons/gui/functions/fnc_sendDisplayMessageTo.sqf +++ b/addons/common/functions/fnc_sendDisplayMessageTo.sqf @@ -41,6 +41,6 @@ if (isPlayer _reciever) then { }foreach _parameters; _content = format _localizationArray; - [_title,_content,_type] call EFUNC(gui,displayMessage); + [_title,_content,_type] call EFUNC(common,displayMessage); }; }; \ No newline at end of file diff --git a/addons/common/functions/fnc_sendRequest_f.sqf b/addons/common/functions/fnc_sendRequest.sqf similarity index 100% rename from addons/common/functions/fnc_sendRequest_f.sqf rename to addons/common/functions/fnc_sendRequest.sqf diff --git a/addons/common/functions/fnc_setDisableUserInputStatus.sqf b/addons/common/functions/fnc_setDisableUserInputStatus.sqf index 2451cbe90f..2cf25b827a 100644 --- a/addons/common/functions/fnc_setDisableUserInputStatus.sqf +++ b/addons/common/functions/fnc_setDisableUserInputStatus.sqf @@ -13,16 +13,16 @@ _id = _this select 0; _disable = _this select 1; -if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then { - GVAR(DISABLE_USER_INPUT_COLLECTION_F) = []; +if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { + GVAR(DISABLE_USER_INPUT_COLLECTION) = []; }; if (_disable) then { - GVAR(DISABLE_USER_INPUT_COLLECTION_F) pushback _id; + GVAR(DISABLE_USER_INPUT_COLLECTION) pushback _id; [true] call FUNC(disableUserInput); } else { - GVAR(DISABLE_USER_INPUT_COLLECTION_F) = GVAR(DISABLE_USER_INPUT_COLLECTION_F) - [_id]; - if (GVAR(DISABLE_USER_INPUT_COLLECTION_F) isEqualTo []) then { + GVAR(DISABLE_USER_INPUT_COLLECTION) = GVAR(DISABLE_USER_INPUT_COLLECTION) - [_id]; + if (GVAR(DISABLE_USER_INPUT_COLLECTION) isEqualTo []) then { [false] call FUNC(disableUserInput); }; }; \ No newline at end of file diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf new file mode 100644 index 0000000000..ae4b1d6655 --- /dev/null +++ b/addons/common/functions/fnc_setSetting.sqf @@ -0,0 +1,78 @@ +/* + * Author: CAA-Picard + * Change the value of an existing setting if it was not previously forced. Force if neccesary. + * If executed on clients it has local effect. + * If executed on server it can have global effect if the last parameter is set to true. + * + * Arguments: + * 0: Setting name (String) + * 1: Value (Any) + * 2: Force it? (Bool) (Optional) + * 3: Broadcast the change to all clients (Bool) (Optional) + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +private ["_name","_value"]; +_name = _this select 0; +_value = _this select 1; + +private ["_force"]; +_force = false; +if (count _this > 2) then { + _force = _this select 2; +}; + +_settingData = [_name] call FUNC(getSettingData); + +// Exit if the setting does not exist +if (count _settingData == 0) exitWith {}; + +// Exit if the setting is already forced +if (_settingData select 6) exitWith {}; + +// If the type is not equal, try to cast it +_failed = false; +if ((typeName _value) != (_settingData select 1)) then { + _failed = true; + if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") then { + // If value is not 0 or 1 consider it invalid and don't set anything + if (_value == 0) then { + _value = false; + _failed = false; + }; + if (_value == 1) then { + _value = true; + _failed = false; + }; + }; + if ((_settingData select 1) == "COLOR" and (typeName _value) == "ARRAY") then { + _failed = false; + }; +}; +if (_failed) exitWith {}; + +// Force it if it was required +_settingData set [6, _force]; + +// Exit if the value didn't change +if (_value isEqualTo (missionNamespace getVariable _name)) exitWith {}; + +// Update the variable +TRACE_2("Variable Updated",_name,_value); +missionNamespace setVariable [_name, _value]; + +if (isServer && {count _this > 3} && {_this select 3}) then { + // Publicize the new value + publicVariable _name; + + // Raise event globally, this publicizes eventual changes in _force status so clients can update it locally + ["SettingChanged", [_name, _value, _force]] call FUNC(globalEvent); +} else { + // Raise event locally + ["SettingChanged", [_name, _value, _force]] call FUNC(localEvent); +}; diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf new file mode 100644 index 0000000000..27c727acab --- /dev/null +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -0,0 +1,103 @@ +/* + * Author: CAA-Picard + * Load a setting from config if it was not previosuly forced. Force if neccesary. + * + * Arguments: + * 0: Config entry (config entry) + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_1_PVT(_this,_optionEntry); + +_fnc_getValueWithType = { + EXPLODE_2_PVT(_this,_optionEntry,_typeName); + + _valueConfig = (_optionEntry >> "value"); + _value = if (isNumber (_optionEntry >> "value")) then {getNumber (_optionEntry >> "value")} else {0}; + TRACE_3("_fnc_getValueWithType:", configName _optionEntry, _typeName, _value); + if (_typeName == "BOOL") exitWith { + _value > 0 + }; + if (_typeName == "STRING") exitWith { + getText (_optionEntry >> "value") + }; + if (_typeName == "ARRAY") exitWith { + getArray (_optionEntry >> "value") + }; + if (_typeName == "COLOR") exitWith { + getArray (_optionEntry >> "value") + }; + _value +}; + +_name = configName _optionEntry; + +// Check if the variable is already defined +if (isNil _name) then { + // That setting was not loaded yet + + // Get type from config + _typeName = getText (_optionEntry >> "typeName"); + if (_typeName == "") then { + _typeName = "SCALAR"; + }; + + // Read entry and cast it to the correct type + _value = [_optionEntry, _typeName] call _fnc_getValueWithType; + + // Init the variable + missionNamespace setVariable [_name, _value]; + + // Add the setting to a list on the server + // Set the variable to not forced + /*_settingData = [ + _name, + _typeName, + _isClientSetable, + _localizedName, + _localizedDescription, + _possibleValues, + _isForced, + _defaultValue + ];*/ + _settingData = [ + _name, + _typeName, + (getNumber (_optionEntry >> "isClientSetable")) > 0, + getText (_optionEntry >> "displayName"), + getText (_optionEntry >> "description"), + getArray (_optionEntry >> "values"), + getNumber (_optionEntry >> "force") > 0, + _value + ]; + + GVAR(settings) pushBack _settingData; + +} else { + // The setting already exists. + + // Check if it's already forced and quit + _settingData = [_name] call FUNC(getSettingData); + if (_settingData select 6) exitWith {}; + + // The setting is not forced, so update the value + + // Get the type from the existing variable + _typeName = _settingData select 1; + + // Read entry and cast it to the correct type + _value = [_optionEntry, _typeName] call _fnc_getValueWithType; + + // Update the variable + missionNamespace setVariable [_name, _value]; + + // Force the setting if requested + if (getNumber (_optionEntry >> "force") > 0) then { + _settingData set [6, true]; + }; +}; diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf new file mode 100644 index 0000000000..81093a2679 --- /dev/null +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -0,0 +1,59 @@ +/* + * Author: commy2 + * + * Sets a public variable, but wait a certain amount of time to transfer the value over the network. Changing the value by calling this function again resets the windup timer. + * + * Argument: + * 0: Object the variable should be assigned to (Object) + * 1: Name of the variable (String) + * 2: Value of the variable (Any) + * 3: Windup time (Number, optional. Default: 1) + * + * Return value: + * Nothing. + */ +#include "script_component.hpp" + +private ["_object", "_varName", "_value", "_sync"]; + +_object = _this select 0; +_varName = _this select 1; +_value = _this select 2; +_sync = _this select 3; + +if (isNil "_sync") then { + _sync = 1; +}; + +// set value locally +_object setVariable [_varName, _value]; + +// "duh" +if (!isMultiplayer) exitWith {}; + +// generate stacked eventhandler id +private "_idName"; +_idName = format ["ACE_setVariablePublic_%1", _varName]; + +// exit now if an eh for that variable already exists +private "_allIdNames"; +_allIdNames = [GETMVAR(BIS_stackedEventHandlers_onEachFrame,[]), {_this select 0}] call FUNC(map); + +if (_idName in _allIdNames) exitWith {}; + +// when to push the value +private "_syncTime"; +_syncTime = diag_tickTime + _sync; + +// add eventhandler +[_idName, "onEachFrame", { + // wait to sync the variable + if (diag_tickTime > _this select 2) then { + // set value public + (_this select 0) setVariable [_this select 1, (_this select 0) getVariable (_this select 1), true]; + + // remove eventhandler + [_this select 3, "onEachFrame"] call BIS_fnc_removeStackedEventHandler + }; +}, [_object, _varName, _syncTime, _idName]] call BIS_fnc_addStackedEventHandler; +nil diff --git a/addons/common/functions/fnc_setVolume_f.sqf b/addons/common/functions/fnc_setVolume.sqf similarity index 100% rename from addons/common/functions/fnc_setVolume_f.sqf rename to addons/common/functions/fnc_setVolume.sqf diff --git a/addons/common/functions/fnc_string_removeWhiteSpace.sqf b/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf similarity index 100% rename from addons/common/functions/fnc_string_removeWhiteSpace.sqf rename to addons/common/functions/fnc_stringRemoveWhiteSpace.sqf diff --git a/addons/common/functions/fnc_switchToGroupSide_f.sqf b/addons/common/functions/fnc_switchToGroupSide.sqf similarity index 92% rename from addons/common/functions/fnc_switchToGroupSide_f.sqf rename to addons/common/functions/fnc_switchToGroupSide.sqf index 97b043adbe..528d32853c 100644 --- a/addons/common/functions/fnc_switchToGroupSide_f.sqf +++ b/addons/common/functions/fnc_switchToGroupSide.sqf @@ -16,7 +16,7 @@ _switch = [_this, 1, false,[false]] call BIS_fnc_Param; _id = [_this, 2, "", [""]] call BIS_fnc_Param; _side = [_this, 3, side _unit,[west]] call BIS_fnc_Param; -_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo_F),[]]; +_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo),[]]; if (_switch) then { // go forward _previousGroup = group _unit; @@ -30,7 +30,7 @@ if (_switch) then { [_unit] joinSilent _newGroup; _previousGroupsList pushback [_previousGroup, _originalSide, _id, true]; - _unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true]; + _unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; } else { // go one back { @@ -60,5 +60,5 @@ if (_switch) then { }foreach _previousGroupsList; _previousGroupsList = _previousGroupsList - [objNull]; reverse _previousGroupsList; // we have to reverse again, to ensure the list is in the right order. - _unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true]; + _unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; }; diff --git a/addons/common/functions/fnc_throttledPublicVariable.sqf b/addons/common/functions/fnc_throttledPublicVariable.sqf new file mode 100644 index 0000000000..6953d39fb5 --- /dev/null +++ b/addons/common/functions/fnc_throttledPublicVariable.sqf @@ -0,0 +1,49 @@ +/* + * Author: CAA-Picard + * Schedules the publishment of an object variable to reduce network overhead + * + * Arguments: + * 0: Unit . + * 1: Variable name + * 2: Maximum delay + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_3_PVT(_this,_unit,_varName,_maxDelay); + +// Create the publish scheduler PFH the first time +if (isNil QGVAR(publishSchedId)) then { + + GVAR(publishVarNames) = []; + GVAR(publishNextTime) = 1e7; + + GVAR(publishSchedId) = [{ + + if (diag_tickTime > GVAR(publishNextTime)) then { + { + EXPLODE_2_PVT(_x,_unit,_varName); + _unit setVariable [_varName, (_unit getVariable _varName), true]; + } forEach GVAR(publishVarNames); + + GVAR(publishVarNames) = []; + GVAR(publishNextTime) = 1e7; + }; + }, 0, []] call cba_fnc_addPerFrameHandler; +}; + +// If the variable is not on the list +if (GVAR(publishVarNames) find [_unit,_varName] == -1) exitWith { + GVAR(publishVarNames) pushBack [_unit,_varName]; + GVAR(publishNextTime) = GVAR(publishNextTime) min (diag_tickTime + _maxDelay); +}; + +// If the variable is on the list +GVAR(publishNextTime) = GVAR(publishNextTime) min (diag_tickTime + _maxDelay); \ No newline at end of file diff --git a/addons/common/functions/fnc_unloadPerson_f.sqf b/addons/common/functions/fnc_unloadPerson.sqf similarity index 89% rename from addons/common/functions/fnc_unloadPerson_f.sqf rename to addons/common/functions/fnc_unloadPerson.sqf index 1aaaee84a1..33c0e9c0c2 100644 --- a/addons/common/functions/fnc_unloadPerson_f.sqf +++ b/addons/common/functions/fnc_unloadPerson.sqf @@ -10,7 +10,7 @@ #include "script_component.hpp" -#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F)) +#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) private ["_caller", "_unit","_vehicle", "_loaded"]; _caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; @@ -27,11 +27,11 @@ if (!alive _unit) then { _unit action ["Eject", vehicle _unit]; }; -[_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f); +[_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide); -_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]]; +_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; _loaded = _loaded - [_unit]; -_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true]; +_vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; if (!([_unit] call FUNC(isAwake))) then { _handle = [_unit,_vehicle] spawn { diff --git a/addons/common/scripts/readParameters.sqf b/addons/common/scripts/readParameters.sqf deleted file mode 100644 index 3b17ea7f1f..0000000000 --- a/addons/common/scripts/readParameters.sqf +++ /dev/null @@ -1,55 +0,0 @@ -// by CAA-Picard -#include "script_component.hpp" - -// Read ACE_Parameters from config and set them on the mission namespace -_config = configFile >> "ACE_Parameters_Numeric"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value] call FUNC(setParameter); -}; - -_config = configFile >> "ACE_Parameters_Boolean"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value > 0] call FUNC(setParameter); -}; - - -// Read ACE_Parameters from mission and set them on the mission namespace, replacing defaults if necesary -_config = missionConfigFile >> "ACE_Parameters"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value] call FUNC(setParameter); -}; - -_config = missionConfigFile >> "ACE_Parameters_Numeric"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value] call FUNC(setParameter); -}; - -_config = missionConfigFile >> "ACE_Parameters_Boolean"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value > 0] call FUNC(setParameter); -}; diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index f2d944eb7a..d1462c1214 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -315,6 +315,30 @@ Ignoruj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności. Rechazar Peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones. + + Feedback icons + + + Select the position of or disable the feedback icons on your screen. These icons will show to provide extra feedback on your character status and actions performed. + + + Progress bar location + + + Set the desired location of the progress bar on your screen. + + + Hint Background color + + + The color of the background from the ACE hints. + + + Hint text font color + + + The color of the text font from the ACE hints. This color is the default color for all text displayed through the ACE Hint system, if the hint text has no other color specified. + \ No newline at end of file diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 3f2c3a4f9a..26543c369a 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -1,6 +1,10 @@ #include "script_component.hpp" +ADDON = false; + PREP(aiDropWeaponCallback); PREP(replaceATWeapon); PREP(takeLoadedATWeapon); PREP(updateInventoryDisplay); + +ADDON = true; diff --git a/addons/explosives/CfgACE_Triggers.hpp b/addons/explosives/CfgACE_Triggers.hpp index 1b686d6092..789786bb4f 100644 --- a/addons/explosives/CfgACE_Triggers.hpp +++ b/addons/explosives/CfgACE_Triggers.hpp @@ -24,6 +24,12 @@ class CfgACE_Triggers { picture = PATHTOF(Data\UI\DeadmanSwitch.paa); requires[] = {"ACE_DeadManSwitch"}; }; + class Cellphone:Command { + displayName = $STR_ACE_Explosives_cellphone_displayName; + picture = PATHTOF(Data\UI\Cellphone_UI.paa); + onPlace = QUOTE(_this call FUNC(addCellphoneIED);false); + requires[] = {"ACE_Cellphone"}; + }; class PressurePlate { displayName = $STR_ACE_Explosives_PressurePlate; picture = PATHTOF(Data\UI\PressurePlate.paa); diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index 7cc1c8a8bd..51c85e607f 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -95,4 +95,33 @@ class CfgMagazines { }; }; }; + + class IEDUrbanBig_Remote_Mag: DemoCharge_Remote_Mag { + ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanBig"; + class ACE_Triggers { + SupportedTriggers[] = {"Command","DeadmanSwitch", "Cellphone"}; + class Command { + FuseTime = 0.5; + }; + class DeadmanSwitch:Command{}; + class Cellphone:Command{}; + }; + }; + class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag{ + ACE_SetupObject = "ACE_Explosives_Place_IEDLandBig"; + }; + class IEDUrbanSmall_Remote_Mag: DemoCharge_Remote_Mag { + ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanSmall"; + class ACE_Triggers { + SupportedTriggers[] = {"Command","DeadmanSwitch", "Cellphone"}; + class Command { + FuseTime = 0.5; + }; + class DeadmanSwitch:Command{}; + class Cellphone:Command{}; + }; + }; + class IEDLandSmall_Remote_Mag: IEDUrbanSmall_Remote_Mag { + ACE_SetupObject = "ACE_Explosives_Place_IEDLandSmall"; + }; }; diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 73477ddce5..983bc0972a 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -49,6 +49,15 @@ class CfgVehicles { priority = 0.8; hotkey = "F"; }; + class ACE_Cellphone { + displayName = $STR_ACE_Explosives_cellphone_displayName; + condition = "('ACE_Cellphone' in (items ace_player))"; + statement = "closeDialog 0;createDialog 'Rsc_ACE_PhoneInterface';"; + exceptions[] = {"ACE_Interaction_isNotSwimming"}; + showDisabled = 0; + icon = PATHTOF(Data\UI\Cellphone_UI.paa); + priority = 0.8; + }; }; }; }; @@ -105,6 +114,27 @@ class CfgVehicles { model = "\A3\Weapons_F\Explosives\mine_SLAM_directional"; }; + // IEDs + class ACE_Explosives_Place_IEDUrbanBig:ACE_Explosives_Place { + displayName = "IED Urban Big"; + model = "\A3\Weapons_F\Explosives\IED_urban_big"; + }; + + class ACE_Explosives_Place_IEDLandBig:ACE_Explosives_Place { + displayName = "IED Land Big"; + model = "\A3\Weapons_F\Explosives\IED_land_big"; + }; + + class ACE_Explosives_Place_IEDUrbanSmall:ACE_Explosives_Place { + displayName = "IED Urban Small"; + model = "\A3\Weapons_F\Explosives\IED_urban_small"; + }; + + class ACE_Explosives_Place_IEDLandSmall:ACE_Explosives_Place { + displayName = "IED Land Small"; + model = "\A3\Weapons_F\Explosives\IED_land_small"; + }; + class NATO_Box_Base; class EAST_Box_Base; class IND_Box_Base; @@ -133,6 +163,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_M26_Clacker,6) MACRO_ADDITEM(ACE_DefusalKit,12) MACRO_ADDITEM(ACE_Deadmanswitch,2) + MACRO_ADDITEM(ACE_Cellphone,3) }; }; @@ -142,6 +173,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_M26_Clacker,2) MACRO_ADDITEM(ACE_DefusalKit,2) MACRO_ADDITEM(ACE_Deadmanswitch,1) + MACRO_ADDITEM(ACE_Cellphone,2) }; }; @@ -151,6 +183,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_M26_Clacker,6) MACRO_ADDITEM(ACE_DefusalKit,12) MACRO_ADDITEM(ACE_Deadmanswitch,6) + MACRO_ADDITEM(ACE_Cellphone,10) }; }; diff --git a/addons/explosives/CfgWeapons.hpp b/addons/explosives/CfgWeapons.hpp index e239ed8841..fd142019e8 100644 --- a/addons/explosives/CfgWeapons.hpp +++ b/addons/explosives/CfgWeapons.hpp @@ -47,6 +47,20 @@ class CfgWeapons { ACE_Range = 100; ACE_Detonator = 1; + class ItemInfo: ACE_ExplosiveItem { + mass = 2; + uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; + }; + }; + class ACE_Cellphone: ACE_ItemCore { + scope = 2; + displayName = $STR_ACE_Explosives_cellphone_displayName; + descriptionShort = $STR_ACE_Explosives_cellphone_description; + picture = PATHTOF(Data\UI\Cellphone_UI.paa); + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + ACE_Range = 15000; + ACE_Detonator = 1; + class ItemInfo: ACE_ExplosiveItem { mass = 2; uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; diff --git a/addons/explosives/Data/Audio/Cellphone_Ring.wss b/addons/explosives/Data/Audio/Cellphone_Ring.wss new file mode 100644 index 0000000000..bafdf7596a Binary files /dev/null and b/addons/explosives/Data/Audio/Cellphone_Ring.wss differ diff --git a/addons/explosives/Data/Audio/DialTone.wss b/addons/explosives/Data/Audio/DialTone.wss new file mode 100644 index 0000000000..4ac52b1acf Binary files /dev/null and b/addons/explosives/Data/Audio/DialTone.wss differ diff --git a/addons/explosives/Data/UI/Cellphone_Background.paa b/addons/explosives/Data/UI/Cellphone_Background.paa new file mode 100644 index 0000000000..9cafe97af8 Binary files /dev/null and b/addons/explosives/Data/UI/Cellphone_Background.paa differ diff --git a/addons/explosives/Data/UI/Cellphone_UI.paa b/addons/explosives/Data/UI/Cellphone_UI.paa new file mode 100644 index 0000000000..38360ee4da Binary files /dev/null and b/addons/explosives/Data/UI/Cellphone_UI.paa differ diff --git a/addons/explosives/ExplosivesUI.hpp b/addons/explosives/ExplosivesUI.hpp index c6c76e573c..769b3dc167 100644 --- a/addons/explosives/ExplosivesUI.hpp +++ b/addons/explosives/ExplosivesUI.hpp @@ -4,16 +4,49 @@ #define GUI_GRID_H (0.04) #define ST_CENTER 0x02 +#define X_OFFSET 0.25 class RscText; class RscButton; - -#define X_OFFSET 0.25 - class RscXSliderH; class IGUIBack; +class RscPicture; +class RscEdit; -class Rsc_ACE_Timer_Slider:RscXSliderH{ +class Rsc_ACE_CallScreen_Edit:RscEdit { + canModify = 1; + colorBackground[] = {0,0,0,1}; + colorText[] = {0,0,0,1}; + colorDisabled[] = {1,1,1,0.25}; + colorSelection[] = { + "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])", + "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])", + "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", + 1 + }; + text = ""; + style = "0x00 + 0x40 + 0x200"; + shadow = 1; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) * 1)"; + x = 0.288594 * safezoneW + safezoneX; + w = 0.0825 * safezoneW; + h = 0.044 * safezoneH; +}; +class Rsc_ACE_HiddenButton:RscButton { + colorText[] = {0, 0, 0, 0}; + colorDisabled[] = {0, 0, 0, 0}; + colorBackground[] = {0, 0, 0, 0}; + colorBackgroundDisabled[] = {0, 0, 0, 0}; + colorBackgroundActive[] = {0, 0, 0, 0}; + colorFocused[] = {0, 0, 0, 0}; + colorShadow[] = {0, 0, 0, 0}; + colorBorder[] = {0, 0, 0, 0}; + w = 0.095589; + h = 0.039216; + shadow = 0; +}; + +class Rsc_ACE_Timer_Slider:RscXSliderH { x = 0.4; y = 0.2; w = 0.3; @@ -21,8 +54,7 @@ class Rsc_ACE_Timer_Slider:RscXSliderH{ colorBackground[] = {0,0,0,0.5}; }; -class RscACE_SelectTimeUI -{ +class RscACE_SelectTimeUI { idd = 8854; movingEnable = 0; class controls { @@ -72,3 +104,185 @@ class RscACE_SelectTimeUI }; }; }; + +class Rsc_ACE_NumKeyButton: Rsc_ACE_HiddenButton{}; +class Rsc_ACE_PhoneInterface { + idd = 8855; + movingEnable = 1; + onLoad = QUOTE(GVAR(IED_CurrentSpeedDial) = -1); + class controls { + class RscPicture_1200: RscPicture { + idc = 1200; + text = PATHTOF(Data\UI\Cellphone_Background.paa); + x = 0.231875 * safezoneW + safezoneX; + y = 0.104 * safezoneH + safezoneY; + w = 0.195937 * safezoneW; + h = 0.704 * safezoneH; + }; + class numkey_1: Rsc_ACE_NumKeyButton { + idc = 1600; + x = 0.278281 * safezoneW + safezoneX; + y = 0.533 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "1"; + action = "ctrlSetText [1400,((ctrlText 1400) + '1')];"; + }; + class numkey_2: Rsc_ACE_NumKeyButton { + idc = 1601; + x = 0.314375 * safezoneW + safezoneX; + y = 0.533 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "2"; + action = "ctrlSetText [1400,((ctrlText 1400) + '2')];"; + }; + class numkey_3: Rsc_ACE_NumKeyButton { + idc = 1602; + x = 0.350469 * safezoneW + safezoneX; + y = 0.533 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "3"; + action = "ctrlSetText [1400,((ctrlText 1400) + '3')];"; + }; + class numkey_4: Rsc_ACE_NumKeyButton { + idc = 1603; + x = 0.278281 * safezoneW + safezoneX; + y = 0.577 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "4"; + action = "ctrlSetText [1400,((ctrlText 1400) + '4')];"; + }; + class numkey_5: Rsc_ACE_NumKeyButton { + idc = 1604; + x = 0.314375 * safezoneW + safezoneX; + y = 0.577 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "5"; + action = "ctrlSetText [1400,((ctrlText 1400) + '5')];"; + }; + class numkey_6: Rsc_ACE_NumKeyButton { + idc = 1605; + x = 0.350469 * safezoneW + safezoneX; + y = 0.577 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "6"; + action = "ctrlSetText [1400,((ctrlText 1400) + '6')];"; + }; + class numkey_7: Rsc_ACE_NumKeyButton { + idc = 1606; + x = 0.278281 * safezoneW + safezoneX; + y = 0.621 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "7"; + action = "ctrlSetText [1400,((ctrlText 1400) + '7')];"; + }; + class numkey_8: Rsc_ACE_NumKeyButton { + idc = 1607; + x = 0.314375 * safezoneW + safezoneX; + y = 0.621 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "8"; + action = "ctrlSetText [1400,((ctrlText 1400) + '8')];"; + }; + class numkey_9: Rsc_ACE_NumKeyButton { + idc = 1608; + x = 0.350469 * safezoneW + safezoneX; + y = 0.621 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "9"; + action = "ctrlSetText [1400,((ctrlText 1400) + '9')];"; + }; + class numkey_0: Rsc_ACE_NumKeyButton { + idc = 1609; + x = 0.314375 * safezoneW + safezoneX; + y = 0.676 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "0"; + action = "ctrlSetText [1400,((ctrlText 1400) + '0')];"; + }; + class speedDialAdd: Rsc_ACE_NumKeyButton { + idc = 1610; + x = 0.278281 * safezoneW + safezoneX; + y = 0.676 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_AddToSpeedDial"; + action = QUOTE([ARR_2(ctrlText 1401,ctrlText 1400)] call FUNC(addToSpeedDial);); + }; + class clear: Rsc_ACE_HiddenButton { + idc = 1610; + x = 0.278281 * safezoneW + safezoneX; + y = 0.445 * safezoneH + safezoneY; + w = 0.020625 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Clear"; + action = QUOTE(ctrlSetText [ARR_2(1400,'')];[ctrlText 1401] call FUNC(removeFromSpeedDial);ctrlSetText [ARR_2(1401,'')];); + }; + class dial: Rsc_ACE_HiddenButton { + idc = 1611; + x = 0.309219 * safezoneW + safezoneX; + y = 0.445 * safezoneH + safezoneY; + w = 0.04125 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_Dial"; + action = QUOTE([ARR_2(ace_player,ctrlText 1400)] call FUNC(dialPhone);); + }; + class up: Rsc_ACE_HiddenButton { + idc = 1612; + x = 0.360781 * safezoneW + safezoneX; + y = 0.445 * safezoneH + safezoneY; + w = 0.020625 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_Up"; + action = QUOTE([true] call FUNC(setSpeedDial)); + }; + class down: Rsc_ACE_HiddenButton { + idc = 1613; + x = 0.345312 * safezoneW + safezoneX; + y = 0.485 * safezoneH + safezoneY; + w = 0.020625 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_Down"; + action = QUOTE([false] call FUNC(setSpeedDial)); + }; + class speedDial_Text: RscText { + idc = 1405; + y = 0.302 * safezoneH + safezoneY; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 22) * 1)"; + x = 0.288594 * safezoneW + safezoneX; + w = 0.0825 * safezoneW; + h = 0.044 * safezoneH; + text = "Name"; + }; + class speedDial_edit: Rsc_ACE_CallScreen_Edit { + idc = 1401; + y = 0.302 * safezoneH + safezoneY; + x = 0.318 * safezoneW + safezoneX; + w = 0.1; + }; + class numberEdit_Text: RscText { + idc = 1406; + y = 0.348 * safezoneH + safezoneY; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 22) * 1)"; + x = 0.288594 * safezoneW + safezoneX; + w = 0.0825 * safezoneW; + h = 0.044 * safezoneH; + text = "#"; + }; + class number_edit: Rsc_ACE_CallScreen_Edit { + canModify = 0; + idc = 1400; + y = 0.348 * safezoneH + safezoneY; + x = 0.3 * safezoneW + safezoneX; + }; + }; +}; diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index fa775511ed..e3b40308c3 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -1,26 +1,24 @@ /* - Name: XEH_postInit.sqf - - Author(s): - Garth de Wet (LH) - - Description: - Initialises explosive behaviour. - - Parameters: - None - - Returns: - None - - Example: - None -*/ + * Author: Garth 'L-H' de Wet + * Initialises the player object for the explosive system. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ #include "script_component.hpp" if !(hasInterface) exitWith {}; GVAR(PlacedCount) = 0; GVAR(Setup) = objNull; GVAR(pfeh_running) = false; +GVAR(CurrentSpeedDial) = 0; [{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); player addEventHandler ["Killed", { diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index 8ccfdb5aae..3747151d16 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -1,28 +1,31 @@ /* -Name: XEH_preInit.sqf - -Author(s): -Garth de Wet (LH) - -Description: -Prepares the functions - -Parameters: -None - -Returns: -None - -Example: -None -*/ + * Author: Garth 'L-H' de Wet + * Initialises the explosives system + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ #include "script_component.hpp" +ADDON = false; + +PREP(addCellphoneIED); PREP(addClacker); +PREP(addToSpeedDial); PREP(canDefuse); PREP(canDetonate); PREP(defuseExplosive); PREP(detonateExplosive); +PREP(dialPhone); +PREP(dialingPhone); PREP(handleScrollWheel); @@ -31,6 +34,7 @@ PREP(hasPlacedExplosives); PREP(getDetonators); PREP(getPlacedExplosives); +PREP(getSpeedDialExplosive); PREP(openDetonateUI); PREP(openPlaceUI); @@ -42,10 +46,14 @@ PREP(place_Approve); PREP(place_Cancel); PREP(placeExplosive); +PREP(removeFromSpeedDial); PREP(selectTrigger); PREP(setupExplosive); PREP(setPosition); +PREP(setSpeedDial); PREP(startDefuse); PREP(startTimer); PREP(triggerType); + +ADDON = true; diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index 8bf463c9f4..da95d45e7e 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { units[] = {}; - weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch"}; + weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch", "ACE_Cellphone"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common", "ace_interaction"}; author[] = {"Garth 'L-H' de Wet"}; @@ -39,7 +39,13 @@ class CfgMineTriggers { }; }; -class ACE_Parameters_Boolean { - GVAR(RequireSpecialist) = 0; - GVAR(PunishNonSpecialists) = 1; +class ACE_Settings { + class GVAR(RequireSpecialist) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(PunishNonSpecialists) { + value = 1; + typeName = "BOOL"; + }; }; diff --git a/addons/explosives/functions/fnc_addCellphoneIED.sqf b/addons/explosives/functions/fnc_addCellphoneIED.sqf new file mode 100644 index 0000000000..84cb57cf4e --- /dev/null +++ b/addons/explosives/functions/fnc_addCellphoneIED.sqf @@ -0,0 +1,51 @@ +/* + * Author: Garth 'L-H' de Wet + * Adds an IED to the cellphone list + * + * Arguments: + * 0: Unit + * 1: Explosive + * 2: Magazine classname + * 3: Extra variables + * + * Return Value: + * None + * + * Example: + * Handled by PlaceExplosive. + * + * Public: No + */ +#include "script_component.hpp" +EXPLODE_4_PVT(_this,_unit,_explosive,_magazineClass,_extra); +// Config is the last item in the list of passed in items. +_config = (_this select 3) select (count (_this select 3) - 1); + +_requiredItems = getArray(_config >> "requires"); +_hasRequired = true; +_detonators = [_unit] call FUNC(getDetonators); +{ + if !(_x in _detonators) exitWith{ + _hasRequired = false; + }; +} count _requiredItems; +private ["_code", "_count", "_codeSet"]; +_codeSet = false; +while {!_codeSet} do { + _code = str(round (random 9999)); + _count = 4 - count (toArray _code); + while {_count > 0} do { + _code = "0" + _code; + _count = _count - 1; + }; + _codeSet = (count ([_code] call FUNC(getSpeedDialExplosive))) == 0; +}; +if (isNil QGVAR(CellphoneIEDs)) then { + GVAR(CellphoneIEDs) = []; +}; +_count = GVAR(CellphoneIEDs) pushBack [_explosive,_code,GetNumber(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> "Cellphone" >> "FuseTime")]; +_count = _count + 1; +publicVariable QGVAR(CellphoneIEDs); +_unit sideChat format ["IED %1 code: %2", _count,_code]; +if !(_hasRequired) exitWith {}; +[format ["IED %1", _count],_code] call FUNC(addToSpeedDial); diff --git a/addons/explosives/functions/fnc_addClacker.sqf b/addons/explosives/functions/fnc_addClacker.sqf index c1f7b51c46..4746dc66f5 100644 --- a/addons/explosives/functions/fnc_addClacker.sqf +++ b/addons/explosives/functions/fnc_addClacker.sqf @@ -1,24 +1,21 @@ /* - Name: ACE_Explosives_fnc_addClacker - - Author(s): - Garth de Wet (LH) - - Description: - Adds an explosive as a clacker item to the passed unit if the unit has a ACE_Clacker item. - - Parameters: - 0: OBJECT - unit - 1: OBJECT - Explosive - 2: STRING - Magazine - 3: ARRAY - Extra vars - - Returns: - Nothing - - Example: - [_unit, _explosive, "SatchelCharge_Remote_Mag", [ConfigFile >> "CfgACE_Triggers" >> "Command"]] call ACE_Explosives_fnc_AddClacker; -*/ + * Author: Garth 'L-H' de Wet + * Adds an explosive as a clacker item to the passed unit if the unit has the required item. + * + * Arguments: + * 0: Unit + * 1: Explosive + * 2: Magazine classname + * 3: Extra variables + * + * Return Value: + * None + * + * Example: + * [player, _explosive, "SatchelCharge_Remote_Mag", [ConfigFile >> "CfgACE_Triggers" >> "Command"]] call ACE_Explosives_fnc_addClacker; + * + * Public: Yes + */ #include "script_component.hpp" private ["_unit", "_explosive", "_clacker", "_config", "_magazineClass", "_requiredItems", "_hasRequired"]; _unit = _this select 0; diff --git a/addons/explosives/functions/fnc_addToSpeedDial.sqf b/addons/explosives/functions/fnc_addToSpeedDial.sqf new file mode 100644 index 0000000000..142996e4c3 --- /dev/null +++ b/addons/explosives/functions/fnc_addToSpeedDial.sqf @@ -0,0 +1,37 @@ +/* + * Author: Garth 'L-H' de Wet + * Sets the speed dial for the UI. + * + * Arguments: + * 0: Name of speed dial + * 1: Code to add to speed dial + * + * Return Value: + * None + * + * Example: + * ["My Speed Dial","2131"] call ACE_explosives_fnc_addToSpeedDial; + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_speedDial", "_found"]; +_speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; +_found = false; + +EXPLODE_2_PVT(_this,_name,_code); + +if ((_code) == "") ExitWith { + [_name] call FUNC(removeFromSpeedDial); +}; +{ + if ((_x select 0) == _name) exitWith { + _speedDial set [_foreachindex, _this]; + _found = true; + }; +} foreach _speedDial; +if (!_found) then { + _speedDial pushBack _this; +}; + +ace_player setVariable [QGVAR(SpeedDial), _speedDial]; diff --git a/addons/explosives/functions/fnc_canDefuse.sqf b/addons/explosives/functions/fnc_canDefuse.sqf index c1bc4484cb..566363c2ad 100644 --- a/addons/explosives/functions/fnc_canDefuse.sqf +++ b/addons/explosives/functions/fnc_canDefuse.sqf @@ -1,20 +1,18 @@ /* - Name: ACE_Explosives_fnc_canDefuse - - Author: Garth de Wet (LH) - - Description: - Checks if a unit can defuse an explosive - - Parameters: - 0: OBJECT - unit - - Returns: - Nothing - - Example: - [player] call ACE_Explosives_fnc_CanDefuse; -*/ + * Author: Garth 'L-H' de Wet + * Whether a unit can perform the defuse action + * + * Arguments: + * 0: Unit + * + * Return Value: + * Able to defuse + * + * Example: + * if ([player] call ACE_Explosives_fnc_canDefuse) then {hint "Can Defuse";}; + * + * Public: Yes + */ #include "script_component.hpp" private "_unit"; _unit = _this select 0; @@ -24,7 +22,7 @@ _isSpecialist = [_unit] call EFUNC(Common,isEOD); if (GVAR(RequireSpecialist) && {!_isSpecialist}) exitWith {false}; _timeBombCore = nearestObject [_unit, "TimeBombCore"]; -_mineBase = nearestObject [_unit, "MineBase"]; +_mineBase = nearestObject [_unit, "MineBase"]; _distCore = _unit distance _timeBombCore; _distBase = _unit distance _mineBase; diff --git a/addons/explosives/functions/fnc_canDetonate.sqf b/addons/explosives/functions/fnc_canDetonate.sqf index 672dc4ca1a..0b96f66f27 100644 --- a/addons/explosives/functions/fnc_canDetonate.sqf +++ b/addons/explosives/functions/fnc_canDetonate.sqf @@ -1,20 +1,18 @@ /* -Name: ACE_Explosives_fnc_canDetonate - -Author: Garth de Wet (LH) - -Description: -Checks if a unit can detonate an explosive - -Parameters: -0: OBJECT - unit - -Returns: -BOOLEAN - if the unit has explosives and detonators. - -Example: -[player] call ACE_Explosives_fnc_canDetonate; -*/ + * Author: Garth 'L-H' de Wet + * Whether the unit is able to detonate explosives + * + * Arguments: + * 0: Unit + * + * Return Value: + * Able to detonate + * + * Example: + * if ([player] call ACE_Explosives_fnc_canDetonate) then { hint "Can Detonate"; }; + * + * Public: Yes + */ #include "script_component.hpp" private "_unit"; _unit = _this select 0; diff --git a/addons/explosives/functions/fnc_defuseExplosive.sqf b/addons/explosives/functions/fnc_defuseExplosive.sqf index 243e6b44e0..5836c9e210 100644 --- a/addons/explosives/functions/fnc_defuseExplosive.sqf +++ b/addons/explosives/functions/fnc_defuseExplosive.sqf @@ -1,21 +1,19 @@ /* - Name: ACE_Explosives_fnc_defuseExplosive - - Author: Garth de Wet (LH) - - Description: - Defuses an Explosive - - Parameters: - 0: OBJECT - unit - 1: OBJECT - Explosive - - Returns: - Nothing - - Example: - [player, ACE_Interaction_Target] call ACE_Explosives_fnc_defuseExplosive; -*/ + * Author: Garth 'L-H' de Wet + * Causes the unit to defuse the passed explosive. + * + * Arguments: + * 0: Unit + * 1: Explosive + * + * Return Value: + * None + * + * Example: + * [player, ACE_Interaction_Target] call ACE_Explosives_fnc_defuseExplosive; + * + * Public: Yes + */ #include "script_component.hpp" private ["_unit", "_explosive"]; _unit = _this select 0; diff --git a/addons/explosives/functions/fnc_detonateExplosive.sqf b/addons/explosives/functions/fnc_detonateExplosive.sqf index 9443be6bc1..697c8eeed7 100644 --- a/addons/explosives/functions/fnc_detonateExplosive.sqf +++ b/addons/explosives/functions/fnc_detonateExplosive.sqf @@ -1,26 +1,23 @@ /* - Name: ACE_Explosives_fnc_detonateExplosive - - Author(s): - Garth de Wet (LH) - - Description: - Detonates a remote Explosive. - - Parameters: - 0: OBJECT - Unit detonating explosive - 1: NUMBER - Max range (-1 to ignore) - 2: ARRAY - Explosive - 0: OBJECT - Explosive - 1: NUMBER - Fuse Time - - Returns: - Nothing - - Example: - // Clacker - [player, 100, [Explosive, 1]] call ACE_Explosives_fnc_detonateExplosive; -*/ + * Author: Garth 'L-H' de Wet + * Causes the unit to detonate the passed explosive. + * + * Arguments: + * 0: Unit + * 1: Max range (-1 to ignore) + * 2: Explosive + * 0: Explosive + * 1: Fuse time + * + * Return Value: + * None + * + * Example: + * [player, 100, [Explosive, 1]] call ACE_Explosives_fnc_detonateExplosive; // has to be within range + * [player, -1, [Explosive, 1]] call ACE_Explosives_fnc_detonateExplosive; // range ignored. + * + * Public: Yes + */ #include "script_component.hpp" private ["_item","_result", "_ignoreRange", "_unit", "_range"]; _unit = _this select 0; @@ -44,8 +41,11 @@ if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhe _exp setPosASL _pos; }; }; -_item spawn { - sleep (_this select 1); - (_this select 0) setDamage 1; -}; +[{ + _explosive = _this; + if (!isNull _explosive) then { + _explosive setDamage 1; + }; +}, _item select 0, _item select 1, 0] call EFUNC(common,waitAndExecute); + _result diff --git a/addons/explosives/functions/fnc_dialPhone.sqf b/addons/explosives/functions/fnc_dialPhone.sqf new file mode 100644 index 0000000000..41b2a4a4f7 --- /dev/null +++ b/addons/explosives/functions/fnc_dialPhone.sqf @@ -0,0 +1,42 @@ +/* + * Author: Garth 'L-H' de Wet + * Dials the number passed and detonates the explosive. + * + * Arguments: + * 0: Unit to do dialing + * 1: Code to dial + * + * Return Value: + * None + * + * Example: + * [ace_player,"2131"] call ACE_explosives_fnc_dialPhone; + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_arr", "_ran", "_i","_speedDial"]; +EXPLODE_2_PVT(_this,_unit,_code); +if (_unit getVariable [QGVAR(Dialing),false]) exitWith {}; +if !(alive _unit) exitWith {}; +_unit setVariable [QGVAR(Dialing), true, true]; + +_ran = (ceil(random 8)) + 1; +_arr = []; +for [{_i=0}, {_i<_ran}, {_i=_i+1}] do { + _arr = _arr + ['.','..','...','']; +}; +if (_unit == ace_player) then { + ctrlSetText [1400,"Calling"]; + [FUNC(dialingPhone), 0.25, [_unit,4,_arr,_code]] call CALLSTACK(CBA_fnc_addPerFrameHandler); +} else { + private ["_explosive"]; + _explosive = [_code] call FUNC(getSpeedDialExplosive); + if ((count _explosive) > 0) then { + [{ + playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75]; + (_this select 0) setVariable [QGVAR(Dialing), false, true]; + }, [_unit,_explosive select 0], 0.25 * (count _arr - 4), 0] call EFUNC(common,waitAndExecute); + [_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2)] call FUNC(startTimer); + }; +}; diff --git a/addons/explosives/functions/fnc_dialingPhone.sqf b/addons/explosives/functions/fnc_dialingPhone.sqf new file mode 100644 index 0000000000..d3c429c9fc --- /dev/null +++ b/addons/explosives/functions/fnc_dialingPhone.sqf @@ -0,0 +1,44 @@ +/* + * Author: Garth 'L-H' de Wet + * Performs the dial tones and detonation of explosive. + * + * Arguments: + * 0: Unit to do dialing + * 1: Index + * 2: Dialing points + * 3: IED code + * + * Return Value: + * None + * + * Example: + * [FUNC(dialingPhone), 0.25, [_unit,4,_arr,_code]] call CALLSTACK(CBA_fnc_addPerFrameHandler); + * + * Public: No + */ +#include "script_component.hpp" +EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code); +if ((_i mod 4) == 0) then { + playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit ModelToWorld [0,0.2,2]), 15,1,2.5]; +}; +ctrlSetText [1400,format["Calling%1",_arr select (_i - 4)]]; + +private "_explosive"; +_explosive = [_code] call FUNC(getSpeedDialExplosive); + +if (_i >= (count _arr + 2)) then { + [_this select 1] call CALLSTACK(cba_fnc_removePerFrameHandler); + if ((count _explosive) > 0) then { + [_unit, -1, [_explosive select 0, _explosive select 2]] call FUNC(detonateExplosive); + }; + _unit setVariable [QGVAR(Dialing), false, true]; + if (_unit == ace_player) then { + ctrlSetText [1400,"Call Ended!"]; + }; +}; +if (_i == (count _arr)) then { + if ((count _explosive) > 0) then { + playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_explosive select 0),3.16228,1,75]; + }; +}; +(_this select 0) set [1, _i + 1]; diff --git a/addons/explosives/functions/fnc_getDetonators.sqf b/addons/explosives/functions/fnc_getDetonators.sqf index 77549c0e3b..83e0087acc 100644 --- a/addons/explosives/functions/fnc_getDetonators.sqf +++ b/addons/explosives/functions/fnc_getDetonators.sqf @@ -1,21 +1,18 @@ /* - Name: ACE_Explosives_fnc_getDetonators - - Author(s): - Garth de Wet (LH) - - Description: - Gets all the detonators of a specific unit - - Parameters: - 0: OBJECT - Unit to get detonators of - - Returns: - ARRAY - Configs of all detonators. - - Example: - _detonators = [player] call ACE_Explosives_fnc_getDetonators; -*/ + * Author: Garth 'L-H' de Wet + * Returns all the detonators of the unit + * + * Arguments: + * 0: Unit + * + * Return Value: + * Configs of all detonators + * + * Example: + * _detonators = [player] call ACE_Explosives_fnc_getDetonators; + * + * Public: Yes + */ #include "script_component.hpp" private ["_unit", "_items", "_result", "_config"]; _unit = _this select 0; diff --git a/addons/explosives/functions/fnc_getPlacedExplosives.sqf b/addons/explosives/functions/fnc_getPlacedExplosives.sqf index 0343b76521..4ebcdb8f0b 100644 --- a/addons/explosives/functions/fnc_getPlacedExplosives.sqf +++ b/addons/explosives/functions/fnc_getPlacedExplosives.sqf @@ -1,22 +1,20 @@ /* - Name: ACE_Explosives_fnc_getPlacedExplosives - - Author: Garth de Wet (LH) - - Description: - Gets all placed explosives, whether Clacker based or not. - - Parameters: - 0: OBJECT - unit - 1: STRING - (OPTIONAL) Trigger classname for filter. - - Returns: - Array: Explosives. - - Example: - _allExplosives = [player] call ACE_Explosives_fnc_getPlacedExplosives; - _deadmanExplosives = [player, "DeadManSwitch"] call ACE_Explosives_fnc_getPlacedExplosives; -*/ + * Author: Garth 'L-H' de Wet + * Gets all placed explosives by unit, optionally filtered by specific trigger type. + * + * Arguments: + * 0: Unit + * 1: Trigger classname - filter (optional) + * + * Return Value: + * Explosives + * + * Example: + * _allExplosives = [player] call ACE_Explosives_fnc_getPlacedExplosives; + * _deadmanExplosives = [player, "DeadManSwitch"] call ACE_Explosives_fnc_getPlacedExplosives; + * + * Public: Yes + */ #include "script_component.hpp" private ["_unit", "_clackerList", "_adjustedList", "_list", "_filter"]; _unit = _this select 0; diff --git a/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf b/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf new file mode 100644 index 0000000000..d6d5b57b3b --- /dev/null +++ b/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf @@ -0,0 +1,27 @@ +/* + * Author: Garth 'L-H' de Wet + * Gets the explosive from the speed dial entry. + * + * Arguments: + * 0: Speed dial entry + * + * Return Value: + * Associated explosive (or ObjNull) + * + * Example: + * ["2113"] call ace_explosives_fnc_getSpeedDialExplosive; + * + * Public: Yes + */ +#include "script_component.hpp" +EXPLODE_1_PVT(_this,_code); +private ["_explosive"]; +if (isNil QGVAR(CellphoneIEDs)) exitWith {[]}; +_explosive = []; +{ + if ((_x select 1) == _code) exitWith { + _explosive = _x; + }; + false +} count GVAR(CellphoneIEDs); +_explosive diff --git a/addons/explosives/functions/fnc_handleScrollWheel.sqf b/addons/explosives/functions/fnc_handleScrollWheel.sqf index ddc64010eb..8c842b8a05 100644 --- a/addons/explosives/functions/fnc_handleScrollWheel.sqf +++ b/addons/explosives/functions/fnc_handleScrollWheel.sqf @@ -1,21 +1,18 @@ /* - Name: ACE_Explosives_fnc_HandleScrollWheel - - Author(s): - L-H - - Description: - Handles rotating of Explosives - - Parameters: - Number: Scroll amount - - Returns: - Boolean: Handled or not. - - Example: - 1.2 call ACE_Explosives_fnc_HandleScrollWheel; -*/ + * Author: Garth 'L-H' de Wet + * Handles rotating of Explosives + * + * Arguments: + * Amount scrolled + * + * Return Value: + * Handled + * + * Example: + * 1.2 call ACE_Explosives_fnc_HandleScrollWheel; + * + * Public: No + */ #include "script_component.hpp" private ["_obj"]; if (isNull(GVAR(Setup)) || {ACE_Modifier == 0} || !GVAR(pfeh_running)) exitWith {false}; diff --git a/addons/explosives/functions/fnc_hasExplosives.sqf b/addons/explosives/functions/fnc_hasExplosives.sqf index 79596b1b1e..ef1deef28a 100644 --- a/addons/explosives/functions/fnc_hasExplosives.sqf +++ b/addons/explosives/functions/fnc_hasExplosives.sqf @@ -1,20 +1,18 @@ /* - Name: ACE_Explosives_fnc_hasExplosives - - Author: Garth de Wet (LH) - - Description: - Whether the passed unit has any explosives on them. - - Parameters: - 0: OBJECT - unit - - Returns: - BOOLEAN - True if the unit has explosives. - - Example: - _hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives; -*/ + * Author: Garth 'L-H' de Wet + * Whether the passed unit has any explosives on them. + * + * Arguments: + * 0: Unit + * + * Return Value: + * The unit has explosives + * + * Example: + * _hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives; + * + * Public: Yes + */ #include "script_component.hpp" private ["_unit", "_result", "_magazines"]; _result = false; diff --git a/addons/explosives/functions/fnc_hasPlacedExplosives.sqf b/addons/explosives/functions/fnc_hasPlacedExplosives.sqf index ad6f29a02e..4a6ccc9de8 100644 --- a/addons/explosives/functions/fnc_hasPlacedExplosives.sqf +++ b/addons/explosives/functions/fnc_hasPlacedExplosives.sqf @@ -1,19 +1,17 @@ /* - Name: ACE_Explosives_fnc_hasPlacedExplosives - - Author: Garth de Wet (LH) - - Description: - Whether the passed unit has placed any explosives or has a clacker that was used when explosives were placed. - - Parameters: - 0: OBJECT - unit - - Returns: - BOOLEAN - True if the unit has explosives. - - Example: - _hasPLacedExplosives = [player] call ACE_Explosives_fnc_hasPlacedExplosives; -*/ + * Author: Garth 'L-H' de Wet + * Whether the passed unit has placed any explosives or has a clacker that was used when explosives were placed. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Configs of all detonators + * + * Example: + * _hasPlacedExplosives = [player] call ACE_Explosives_fnc_hasPlacedExplosives; + * + * Public: Yes + */ #include "script_component.hpp" (count (_this call FUNC(getPlacedExplosives)) > 0) diff --git a/addons/explosives/functions/fnc_module.sqf b/addons/explosives/functions/fnc_module.sqf index 415b537266..432671b551 100644 --- a/addons/explosives/functions/fnc_module.sqf +++ b/addons/explosives/functions/fnc_module.sqf @@ -1,20 +1,18 @@ /* - Name: ACE_Explosives_fnc_module - - Author: Garth de Wet (LH) - - Description: - Initialises the explosives module - - Parameters: - Things - - Returns: - Nothing - - Example: - -*/ + * Author: Garth 'L-H' de Wet + * Initialises the explosives module + * + * Arguments: + * Module things. + * + * Return Value: + * None + * + * Example: + * Called By BIS. + * + * Public: No + */ #include "script_component.hpp" if !(isServer) exitWith {}; _logic = _this select 0; @@ -22,7 +20,7 @@ _activated = _this select 2; if !(_activated) exitWith {}; -[_logic, QGVAR(RequireSpecialist), "RequireSpecialist" ] call EFUNC(Common,readBooleanParameterFromModule); -[_logic, QGVAR(PunishNonSpecialists), "PunishNonSpecialists" ] call EFUNC(Common,readBooleanParameterFromModule); +[_logic, QGVAR(RequireSpecialist), "RequireSpecialist" ] call EFUNC(Common,readSettingFromModule); +[_logic, QGVAR(PunishNonSpecialists), "PunishNonSpecialists" ] call EFUNC(Common,readSettingFromModule); diag_log text "[ACE]: Explosive Module Initialized."; diff --git a/addons/explosives/functions/fnc_openDetonateUI.sqf b/addons/explosives/functions/fnc_openDetonateUI.sqf index 84a874f677..a14865bc20 100644 --- a/addons/explosives/functions/fnc_openDetonateUI.sqf +++ b/addons/explosives/functions/fnc_openDetonateUI.sqf @@ -1,21 +1,19 @@ /* - Name: ACE_Explosives_fnc_openDetonateUI - - Author: Garth de Wet (LH) - - Description: - Opens the UI for explosive detonation selection - - Parameters: - 0: OBJECT - unit - 0: STRING - Classname of detonator - - Returns: - Nothing - - Example: - [player, "ACE_M26_Clacker"] call ACE_Explosives_fnc_openDetonateUI; -*/ + * Author: Garth 'L-H' de Wet + * Opens the UI for explosive detonation selection + * + * Arguments: + * 0: Unit + * 1: Trigger classname + * + * Return Value: + * None + * + * Example: + * [player, "ACE_M26_Clacker"] call ACE_Explosives_fnc_openDetonateUI; + * + * Public: No + */ #include "script_component.hpp" private ["_unit","_result", "_item"]; call EFUNC(interaction,hideMenu); diff --git a/addons/explosives/functions/fnc_openPlaceUI.sqf b/addons/explosives/functions/fnc_openPlaceUI.sqf index af34f40236..5ad79381b1 100644 --- a/addons/explosives/functions/fnc_openPlaceUI.sqf +++ b/addons/explosives/functions/fnc_openPlaceUI.sqf @@ -1,20 +1,18 @@ /* - Name: ACE_Explosives_fnc_openPlaceUI - - Author: Garth de Wet (LH) - - Description: - Opens the UI for explosive placement selection - - Parameters: - 0: OBJECT - unit - - Returns: - Nothing - - Example: - [player] call ACE_Explosives_fnc_openPlaceUI; -*/ + * Author: Garth 'L-H' de Wet + * Opens the UI for explosive placement selection + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [player] call ACE_Explosives_fnc_openPlaceUI; + * + * Public: No + */ #include "script_component.hpp" private ["_unit","_mags", "_item", "_index", "_actions"]; _unit = _this select 0; @@ -53,7 +51,7 @@ _actions = [localize "STR_ACE_Explosives_PlaceMenu", localize "STR_ACE_Explosive }, { call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [EGVAR(interaction,AutoCloseMenu), false]) then { + if !(profileNamespace getVariable [QUOTE(EGVAR(interaction,AutoCloseMenu)), false]) then { "ACE_Explosives" call EFUNC(interaction,openMenuSelf); }; } diff --git a/addons/explosives/functions/fnc_openTimerSetUI.sqf b/addons/explosives/functions/fnc_openTimerSetUI.sqf index e686fc7539..d7f6ef30d8 100644 --- a/addons/explosives/functions/fnc_openTimerSetUI.sqf +++ b/addons/explosives/functions/fnc_openTimerSetUI.sqf @@ -1,20 +1,18 @@ /* - Name: ACE_Explosives_fnc_openTimerSetUI - - Author: Garth de Wet (LH) - - Description: - Opens the UI for timer setting of an explosive - - Parameters: - 0: String - Magazine - - Returns: - Nothing - - Example: - [player] call ACE_Explosives_fnc_openTimerSetUI; -*/ + * Author: Garth 'L-H' de Wet + * Opens the UI for timer setting of an explosive + * + * Arguments: + * 0: Magazine + * + * Return Value: + * None + * + * Example: + * ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_openTimerSetUI; + * + * Public: No + */ #include "script_component.hpp" private ["_mag"]; _mag = _this select 0; diff --git a/addons/explosives/functions/fnc_openTransmitterUI.sqf b/addons/explosives/functions/fnc_openTransmitterUI.sqf index 2311b6eea9..b87673c214 100644 --- a/addons/explosives/functions/fnc_openTransmitterUI.sqf +++ b/addons/explosives/functions/fnc_openTransmitterUI.sqf @@ -1,20 +1,18 @@ /* - Name: ACE_Explosives_fnc_openTransmitterUI - - Author: Garth de Wet (LH) - - Description: - Opens the UI for selecting the transmitter - - Parameters: - 0: OBJECT - Unit - - Returns: - Nothing - - Example: - [player] call ACE_Explosives_fnc_openTransmitterUI; -*/ + * Author: Garth 'L-H' de Wet + * Opens the UI for selecting the transmitter + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call ACE_Explosives_fnc_openTransmitterUI; + * + * Public: No + */ #include "script_component.hpp" private ["_items", "_unit", "_count", "_actions", "_config"]; _unit = _this select 0; diff --git a/addons/explosives/functions/fnc_openTriggerSelectionUI.sqf b/addons/explosives/functions/fnc_openTriggerSelectionUI.sqf index d51b0dc7f4..011bda9bee 100644 --- a/addons/explosives/functions/fnc_openTriggerSelectionUI.sqf +++ b/addons/explosives/functions/fnc_openTriggerSelectionUI.sqf @@ -1,20 +1,18 @@ /* - Name: ACE_Explosives_fnc_openTriggerSelectionUI - - Author: Garth de Wet (LH) - - Description: - Opens the UI for explosive trigger selection - - Parameters: - 0: String - explosive magazine - - Returns: - Nothing - - Example: - [lbData [8866, lbCurSel 8866]] call ACE_Explosives_fnc_openTriggerSelectionUI; -*/ + * Author: Garth 'L-H' de Wet + * Opens the UI for explosive trigger selection + * + * Arguments: + * 0: Explosive Magazine + * + * Return Value: + * None + * + * Example: + * [lbData [8866, lbCurSel 8866]] call ACE_Explosives_fnc_openTriggerSelectionUI; + * + * Public: No + */ #include "script_component.hpp" private ["_magazine", "_hasRequiredItems","_triggerTypes", "_actions", "_detonators", "_required", "_magTriggers"]; _magazine = _this select 0; diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf index f2198c6d0a..1e1ac44bdf 100644 --- a/addons/explosives/functions/fnc_placeExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -1,26 +1,25 @@ /* - Name: ACE_Explosives_fnc_PlaceExplosive - - Author(s): - Garth de Wet (LH) - - Description: - Places an explosive at the requested position - - Parameters: - 0: OBJECT - unit - 1: POSITION - Position to place explosive - 2: NUMBER - Rotation - 3: STRING - Magazine class - 4: Config - Config of trigger - 5: ARRAY - variables required for the trigger type - - Returns: - OBJECT: Placed explosive - - Example: - _explosive = [player, player modelToWorld [0,0.5, 0.1], 134, "SatchelCharge_Remote_Mag", "Command", []] call ACE_Explosives_fnc_PlaceExplosive; -*/ + * Author: Garth 'L-H' de Wet + * Places an explosive at the requested position + * + * Arguments: + * 0: Unit + * 1: Position to place explosive + * 2: Rotation + * 3: Magazine class + * 4: Config of trigger + * 5: Variables required for the trigger type + * 6: Should direction be set + * + * Return Value: + * Placed explosive + * + * Example: + * _explosive = [player, player modelToWorld [0,0.5, 0.1], 134, + * "SatchelCharge_Remote_Mag", "Command", []] call ACE_Explosives_fnc_placeExplosive; + * + * Public: Yes + */ #include "script_component.hpp" private ["_pos", "_dir", "_magazineClass", "_ammo", "_triggerSpecificVars", "_unit", "_triggerConfig", "_explosive"]; _unit = _this select 0; diff --git a/addons/explosives/functions/fnc_place_Approve.sqf b/addons/explosives/functions/fnc_place_Approve.sqf index c906aa777d..77cfbb92a1 100644 --- a/addons/explosives/functions/fnc_place_Approve.sqf +++ b/addons/explosives/functions/fnc_place_Approve.sqf @@ -1,21 +1,19 @@ /* - Name: ACE_Explosives_fnc_Place_Approve - - Author(s): - Garth de Wet (LH) - - Description: - Approves placement of the explosive, releases the placement object for it to settle in a location suitable for the explosive to be created. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call ACE_Explosives_fnc_Place_Approve; -*/ + * Author: Garth 'L-H' de Wet + * Approves placement of the explosive, releases the placement object for it + * to settle in a location suitable for the explosive to be created. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ACE_Explosives_fnc_place_Approve; + * + * Public: No + */ #include "script_component.hpp" if (GVAR(pfeh_running)) then { [QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler); @@ -30,79 +28,78 @@ _player = ACE_player; [_player, "DefaultAction", _player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler); [_player, "MenuBack", _player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); call EFUNC(interaction,hideMouseHint); -if ((_setup getVariable [QGVAR(Class), ""]) != "") then { - _dir = (getDir _setup); - if (_dir > 180) then { - _dir = _dir - 180; - } else { - _dir = 180 + _dir; - }; - _setup setVariable [QGVAR(Direction), _dir]; - _player setVariable [QGVAR(PlantingExplosive), true]; - _setup addEventHandler ["EpeContactStart", { - if (!((_this select 0) getVariable [QGVAR(Handled), false])) then { - private ["_player", "_pos", "_attachTo"]; +if ((_setup getVariable [QGVAR(Class), ""]) == "") exitWith { + deleteVehicle _setup; +}; +_dir = (getDir _setup); +if (_dir > 180) then { + _dir = _dir - 180; +} else { + _dir = 180 + _dir; +}; +_setup setVariable [QGVAR(Direction), _dir]; +_player setVariable [QGVAR(PlantingExplosive), true]; +_setup addEventHandler ["EpeContactStart", { + if (!((_this select 0) getVariable [QGVAR(Handled), false])) then { + private ["_player", "_pos", "_attachTo"]; + _player = ACE_player; + _player setVariable [QGVAR(PlantingExplosive), false]; + _pos = getPosATL (_this select 0); + (_this select 0) enableSimulationGlobal false; + if (surfaceIsWater _pos) then { + _pos = getPosASL (_this select 0); + (_this select 0) setPosASL _pos; + }else{ + (_this select 0) setPosATL _pos; + }; + (_this select 0) setVariable [QGVAR(Handled), true]; + _attachTo = objNull; + if (!isNull (_this select 1) && {(_this select 1) isKindOf "AllVehicles"}) then { + _attachTo = (_this select 1); + }; + [(_this select 0),_attachTo, _pos] spawn { // TODO: Change to scheduled delay execution + private ["_mag", "_setup", "_dir", "_player"]; + _setup = _this select 0; _player = ACE_player; - _pos = getPosATL (_this select 0); - (_this select 0) enableSimulationGlobal false; - if (surfaceIsWater _pos) then { - _pos = getPosASL (_this select 0); - (_this select 0) setPosASL _pos; - }else{ - (_this select 0) setPosATL _pos; - }; - (_this select 0) setVariable [QGVAR(Handled), true]; - _player setVariable [QGVAR(PlantingExplosive), false]; - _attachTo = objNull; - if (!isNull (_this select 1) && {(_this select 1) isKindOf "AllVehicles"}) then { - _attachTo = (_this select 1); - }; - [(_this select 0),_attachTo, _pos] spawn { // TODO: Change to scheduled delay execution - private ["_mag", "_setup", "_dir", "_player"]; - _setup = _this select 0; - _player = ACE_player; - _mag = _setup getVariable [QGVAR(Class), ""]; - _dir = _setup getVariable [QGVAR(Direction), 0]; + _mag = _setup getVariable [QGVAR(Class), ""]; + _dir = _setup getVariable [QGVAR(Direction), 0]; - sleep getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime"); - _explosive = [_player, _this select 2, _dir, _mag, _setup getVariable QGVAR(Trigger), - [_setup getVariable QGVAR(Timer)], isNull (_this select 1)] call FUNC(placeExplosive); - deleteVehicle _setup; - if (!isNull(_explosive)) then { - _player RemoveMagazine _mag; - if (!isNull (_this select 1)) then { - _explosive attachTo [(_this select 1)]; - _dir = _dir - (getDir (_this select 1)); - [[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); - }; + sleep getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime"); + _explosive = [_player, _this select 2, _dir, _mag, _setup getVariable QGVAR(Trigger), + [_setup getVariable QGVAR(Timer)], isNull (_this select 1)] call FUNC(placeExplosive); + deleteVehicle _setup; + if (!isNull(_explosive)) then { + _player RemoveMagazine _mag; + if (!isNull (_this select 1)) then { + _explosive attachTo [(_this select 1)]; + _dir = _dir - (getDir (_this select 1)); + [[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); }; }; }; - }]; - _setup enableSimulationGlobal true; - _player playActionNow "MedicOther"; - [_setup] spawn { // TODO: Change to scheduled delay execution - private ["_setup", "_player"]; - _setup = _this select 0; - _player = ACE_player; - sleep 5; + }; +}]; +_setup enableSimulationGlobal true; +_player playActionNow "MedicOther"; +[_setup] spawn { // TODO: Change to scheduled delay execution + private ["_setup", "_player"]; + _setup = _this select 0; + _player = ACE_player; + sleep 5; + _player setVariable [QGVAR(PlantingExplosive), false]; + if (!isNull _setup) then { + private ["_mag", "_dir", "_delayTime"]; + _mag = _setup getVariable [QGVAR(Class), ""]; + _dir = _setup getVariable [QGVAR(Direction), 0]; + _delayTime = (getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime")) - 5; + if (_delayTime > 0) then { + sleep _delayTime; + }; if (!isNull _setup) then { - private ["_mag", "_dir", "_delayTime"]; - _mag = _setup getVariable [QGVAR(Class), ""]; - _dir = _setup getVariable [QGVAR(Direction), 0]; - _delayTime = (getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime")) - 5; - if (_delayTime > 0) then { - sleep _delayTime; - }; - if (!isNull _setup) then { - [_player, GetPosATL _setup, _dir, _mag, _setup getVariable QGVAR(Trigger), - [_setup getVariable QGVAR(Timer)], true] call FUNC(placeExplosive); - deleteVehicle _setup; - _player RemoveMagazine _mag; - _player setVariable [QGVAR(PlantingExplosive), false]; - }; + [_player, GetPosATL _setup, _dir, _mag, _setup getVariable QGVAR(Trigger), + [_setup getVariable QGVAR(Timer)], true] call FUNC(placeExplosive); + deleteVehicle _setup; + _player RemoveMagazine _mag; }; }; -}else{ - deleteVehicle _setup; }; diff --git a/addons/explosives/functions/fnc_place_Cancel.sqf b/addons/explosives/functions/fnc_place_Cancel.sqf index 3f56e35ff6..c149d35584 100644 --- a/addons/explosives/functions/fnc_place_Cancel.sqf +++ b/addons/explosives/functions/fnc_place_Cancel.sqf @@ -1,21 +1,18 @@ /* - Name: ACE_Explosives_fnc_Place_Cancel - - Author(s): - Garth de Wet (LH) - - Description: - Cancels placement of the explosive - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call ACE_Explosives_fnc_Place_Cancel; -*/ + * Author: Garth 'L-H' de Wet + * Cancels placement of the explosive + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ACE_Explosives_fnc_place_Cancel; + * + * Public: Yes + */ #include "script_component.hpp" if (GVAR(pfeh_running)) then { [QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler); diff --git a/addons/explosives/functions/fnc_removeFromSpeedDial.sqf b/addons/explosives/functions/fnc_removeFromSpeedDial.sqf new file mode 100644 index 0000000000..c0a467e6f1 --- /dev/null +++ b/addons/explosives/functions/fnc_removeFromSpeedDial.sqf @@ -0,0 +1,26 @@ +/* + * Author: Garth 'L-H' de Wet + * Removes the specified speed dial from unit's speed dial. + * + * Arguments: + * 0: Speed dial name + * + * Return Value: + * None + * + * Example: + * ["IED 1"] call ACE_explosives_fnc_removeFromSpeedDial; + * + * Public: Yes + */ +#include "script_component.hpp" +private "_speedDial"; +_speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; +if (count _speedDial == 0) exitWith {}; +{ + if ((_x select 0) == (_this select 0)) exitWith { + _speedDial set [_foreachIndex, "x"]; + _speedDial = _speedDial - ["x"]; + ace_player setVariable [QGVAR(SpeedDial),_speedDial]; + }; +} foreach _speedDial; diff --git a/addons/explosives/functions/fnc_selectTrigger.sqf b/addons/explosives/functions/fnc_selectTrigger.sqf index 0700fb5ad3..8c51fd2c9c 100644 --- a/addons/explosives/functions/fnc_selectTrigger.sqf +++ b/addons/explosives/functions/fnc_selectTrigger.sqf @@ -1,21 +1,19 @@ /* - Name: ACE_Explosives_fnc_selectTrigger - - Author: Garth de Wet (LH) - - Description: - Selects a trigger for an explosive. - - Parameters: - 0: String - Magazine - 1: String - trigger index in ACE_triggers of magazine class - - Returns: - Nothing - - Example: - ["SatchelCharge_Remote_Mag","Timer"] call ACE_Explosives_fnc_selectTrigger; -*/ + * Author: Garth 'L-H' de Wet + * Selects a trigger for an explosive. + * + * Arguments: + * 0: Magazine + * 1: Trigger mode + * + * Return Value: + * None + * + * Example: + * ["SatchelCharge_Remote_Mag","Timer"] call ACE_Explosives_fnc_selectTrigger; + * + * Public: No + */ #include "script_component.hpp" private ["_magazine","_trigger"]; closeDialog 0; diff --git a/addons/explosives/functions/fnc_setPosition.sqf b/addons/explosives/functions/fnc_setPosition.sqf index b195bf0562..2f61c522aa 100644 --- a/addons/explosives/functions/fnc_setPosition.sqf +++ b/addons/explosives/functions/fnc_setPosition.sqf @@ -1,26 +1,23 @@ /* - Name: ACE_Explosives_fnc_SetPos - - Author(s): - Garth de Wet (LH) - - Description: - Sets the Dir and pitch - - Parameters: - 0: OBJECT - Object - 1: NUMBER - Direction - 2: NUMBER - Pitch - - Returns: - Nothing - - Example: - [_explosive, 150, 90] call ACE_Explosives_fnc_SetPos; -*/ + * Author: Garth 'L-H' de Wet + * Sets the Dir and pitch of passed object + * + * Arguments: + * 0: Explosive + * 1: Direction + * 2: Pitch + * + * Return Value: + * None + * + * Example: + * [_explosive, 150, 90] call ACE_Explosives_fnc_SetPos; + * + * Public: Yes + */ #include "script_component.hpp" private "_ex"; -_ex=_this select 0; +_ex = _this select 0; _ex setDir (_this select 1); if ((_this select 2) != 0) then { [_ex, _this select 2, 0] call CALLSTACK(BIS_fnc_setPitchBank); diff --git a/addons/explosives/functions/fnc_setSpeedDial.sqf b/addons/explosives/functions/fnc_setSpeedDial.sqf new file mode 100644 index 0000000000..adb2e6af03 --- /dev/null +++ b/addons/explosives/functions/fnc_setSpeedDial.sqf @@ -0,0 +1,26 @@ +/* + * Author: Garth 'L-H' de Wet + * Sets the speed dial for the UI. + * + * Arguments: + * 0: Whether to increase or decrease speed dial index + * + * Return Value: + * None + * + * Example: + * [true] call ACE_explosives_fnc_setSpeedDial; // increase + * [false] call ACE_explosives_fnc_setSpeedDial; // decrease + * + * Public: No + */ + #include "script_component.hpp" +private ["_speedDial", "_amount"]; +_speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; +if (count _speedDial == 0) exitWith {}; +_amount = if((_this select 0))then{1}else{-1}; + +GVAR(CurrentSpeedDial) = (GVAR(CurrentSpeedDial) + _amount + count _speedDial) mod (count _speedDial); + +ctrlSetText [1400,(_speedDial select GVAR(CurrentSpeedDial)) select 1]; +ctrlSetText [1401,(_speedDial select GVAR(CurrentSpeedDial)) select 0]; diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 8221109838..7f80ba7e63 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -1,24 +1,21 @@ /* - Name: ACE_Explosives_fnc_SetupExplosive - - Author(s): - Garth de Wet (LH) - - Description: - Starts the setup process for the passed explosive. - - Parameters: - 0: OBJECT - Unit placing explosive. - 1: STRING - Classname of explosive to place. (CfgMagazine class) - 2: Config - Trigger Config - 3: NUMBER - (optional) timer - - Returns: - Nothing - - Example: - [player, "SatchelCharge_Remote_Mag", "Command"] call ACE_Explosives_fnc_SetupExplosive; -*/ + * Author: Garth 'L-H' de Wet + * Starts the setup process for the passed explosive. Player only. + * + * Arguments: + * 0: Unit + * 1: Classname of explosive to place. (CfgMagazine class) + * 2: Trigger Config + * 3: Timer (optional) + * + * Return Value: + * None + * + * Example: + * [player, "SatchelCharge_Remote_Mag", "Command"] call ACE_Explosives_fnc_SetupExplosive; + * + * Public: Yes + */ #include "script_component.hpp" private ["_unit", "_class", "_config", "_timer"]; _unit = _this select 0; diff --git a/addons/explosives/functions/fnc_startDefuse.sqf b/addons/explosives/functions/fnc_startDefuse.sqf index 7213da531c..35e5e682df 100644 --- a/addons/explosives/functions/fnc_startDefuse.sqf +++ b/addons/explosives/functions/fnc_startDefuse.sqf @@ -1,21 +1,19 @@ /* - Name: ACE_Explosives_fnc_StartDefuse - - Author: Garth de Wet (LH) - - Description: - Starts defusing an explosive - - Parameters: - 0: OBJECT - Unit to defuse explosive - 1: OBJECT - Target explosive - - Returns: - Nothing - - Example: - [player, ACE_Interaction_Target] call ACE_Explosives_fnc_StartDefuse; -*/ + * Author: Garth 'L-H' de Wet + * Starts defusing an explosive + * + * Arguments: + * 0: Unit + * 1: Target explosive + * + * Return Value: + * Nothing + * + * Example: + * [player, ACE_Interaction_Target] call ACE_Explosives_fnc_StartDefuse; + * + * Public: Yes + */ #include "script_component.hpp" private ["_unit","_target"]; _unit = _this select 0; diff --git a/addons/explosives/functions/fnc_startTimer.sqf b/addons/explosives/functions/fnc_startTimer.sqf index e5c8bdee75..f4b0876866 100644 --- a/addons/explosives/functions/fnc_startTimer.sqf +++ b/addons/explosives/functions/fnc_startTimer.sqf @@ -1,20 +1,19 @@ /* - Author(s): - Garth de Wet (LH) - - Description: - Starts a timer for an explosive. - - Parameters: - 0: OBJECT - Explosive - 1: NUMBER - time till detonation - - Returns: - Nothing - - Example: - [_explosive, 10] call ACE_Explosives_fnc_startTimer; -*/ + * Author: Garth 'L-H' de Wet + * Starts a timer for an explosive. + * + * Arguments: + * 0: Explosive + * 1: Time till detonate + * + * Return Value: + * None + * + * Example: + * [_explosive, 10] call ACE_Explosives_fnc_startTimer; + * + * Public: Yes + */ #include "script_component.hpp" EXPLODE_2_PVT(_this,_explosive,_delay); @@ -24,4 +23,4 @@ EXPLODE_2_PVT(_this,_explosive,_delay); if (!isNull _explosive) then { [_explosive, -1, [_explosive, 0], true] call FUNC(detonateExplosive); }; -}, _explosive, _delay, 0] call EFUNC(common,waitAndExecute); \ No newline at end of file +}, _explosive, _delay, 0] call EFUNC(common,waitAndExecute); diff --git a/addons/explosives/functions/fnc_triggerType.sqf b/addons/explosives/functions/fnc_triggerType.sqf index dead725a7a..4dba9a8d8e 100644 --- a/addons/explosives/functions/fnc_triggerType.sqf +++ b/addons/explosives/functions/fnc_triggerType.sqf @@ -1,21 +1,18 @@ /* - Name: ACE_Explosives_fnc_TriggerType - - Author(s): - Garth de Wet (LH) - - Description: - Gets the types of triggers associated with the explosive - - Parameters: - 0: String - Explosive magazine - - Returns: - ARRAY - - Example: - _supports = ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType; -*/ + * Author: Garth 'L-H' de Wet + * Gets the types of triggers associated with the explosive + * + * Arguments: + * 0: Explosive magazine + * + * Return Value: + * Supported triggers as CfgACE_Triggers config entries + * + * Example: + * _supports = ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType + * + * Public: Yes + */ #include "script_component.hpp" private "_result"; _result = []; diff --git a/addons/fcs/CfgAmmo.hpp b/addons/fcs/CfgAmmo.hpp new file mode 100644 index 0000000000..25d02399d5 --- /dev/null +++ b/addons/fcs/CfgAmmo.hpp @@ -0,0 +1,32 @@ + +class CfgAmmo { + class B_35mm_AA; + class ACE_B_35mm_ABM: B_35mm_AA { + GVAR(Airburst) = 1; + deflecting = 0; + }; + + class B_35mm_AA_Tracer_Red; + class ACE_B_35mm_ABM_Tracer_Red: B_35mm_AA_Tracer_Red { + GVAR(Airburst) = 1; + deflecting = 0; + }; + + class B_35mm_AA_Tracer_Green; + class ACE_B_35mm_ABM_Tracer_Green: B_35mm_AA_Tracer_Green { + GVAR(Airburst) = 1; + deflecting = 0; + }; + + class B_35mm_AA_Tracer_Yellow; + class ACE_B_35mm_ABM_Tracer_Yellow: B_35mm_AA_Tracer_Yellow { + GVAR(Airburst) = 1; + deflecting = 0; + }; + + class ACE_B_35mm_ABM_Helper: B_35mm_AA { + indirectHitRange = 6; + simulation = "shotRocket"; + timeToLive = 0; + }; +}; diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index 0d507b359d..961a05b27d 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -1,19 +1,95 @@ class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit) ); + clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); }; }; class Extended_Init_EventHandlers { - class AllVehicles { + class Tank { class ADDON { - clientInit = QUOTE(_this call FUNC(vehicleInit)); + serverInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Car { + class ADDON { + serverInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Helicopter { + class ADDON { + serverInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Plane { + class ADDON { + serverInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Ship_F { + class ADDON { + serverInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; +}; + +class Extended_Respawn_EventHandlers { + class Tank { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Car { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Helicopter { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Plane { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Ship_F { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; +}; + +class Extended_FiredBIS_EventHandlers { + class Tank { + class ADDON { + firedBIS = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Car { + class ADDON { + firedBIS = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Helicopter { + class ADDON { + firedBIS = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Plane { + class ADDON { + firedBIS = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Ship_F { + class ADDON { + firedBIS = QUOTE(_this call FUNC(firedEH)); }; }; }; diff --git a/addons/fcs/CfgMagazines.hpp b/addons/fcs/CfgMagazines.hpp new file mode 100644 index 0000000000..dc48e21411 --- /dev/null +++ b/addons/fcs/CfgMagazines.hpp @@ -0,0 +1,34 @@ + +class CfgMagazines { + class 680Rnd_35mm_AA_shells; + class ACE_120Rnd_35mm_ABM_shells: 680Rnd_35mm_AA_shells { + ammo = "ACE_B_35mm_ABM"; + count = 120; + displayName = "35mm ABM Shells"; + displayNameShort = "35mm ABM"; + }; + + class 680Rnd_35mm_AA_shells_Tracer_Red; + class ACE_120Rnd_35mm_ABM_shells_Tracer_Red: 680Rnd_35mm_AA_shells_Tracer_Red { + ammo = "ACE_B_35mm_ABM_Tracer_Red"; + count = 120; + displayName = "35mm ABM Shells"; + displayNameShort = "35mm ABM-T"; + }; + + class 680Rnd_35mm_AA_shells_Tracer_Green; + class ACE_120Rnd_35mm_ABM_shells_Tracer_Green: 680Rnd_35mm_AA_shells_Tracer_Green { + ammo = "ACE_B_35mm_ABM_Tracer_Green"; + count = 120; + displayName = "35mm ABM Shells"; + displayNameShort = "35mm ABM-T"; + }; + + class 680Rnd_35mm_AA_shells_Tracer_Yellow; + class ACE_120Rnd_35mm_ABM_shells_Tracer_Yellow: 680Rnd_35mm_AA_shells_Tracer_Yellow { + ammo = "ACE_B_35mm_ABM_Tracer_Yellow"; + count = 120; + displayName = "35mm ABM Shells"; + displayNameShort = "35mm ABM-T"; + }; +}; diff --git a/addons/fcs/CfgOptics.hpp b/addons/fcs/CfgOptics.hpp index 01b997b0ee..3c17e760f0 100644 --- a/addons/fcs/CfgOptics.hpp +++ b/addons/fcs/CfgOptics.hpp @@ -1,3 +1,4 @@ + #define MACRO_RANGEFINDER \ class CA_Distance; \ class ACE_CA_Distance: CA_Distance { \ @@ -17,12 +18,12 @@ class RscInGameUI { class RscUnitInfo; class RscUnitInfo_AH64D_gunner { onLoad = ""; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinder { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; @@ -56,17 +57,17 @@ class RscInGameUI { }; class RscWeaponRangeFinderAbramsCom { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinderAbramsGun { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinderStrykerMGSGun { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscOptics_crows: RscUnitInfo { @@ -88,7 +89,7 @@ class RscInGameUI { class RscWeaponRangeZeroing: RscUnitInfo { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; - controls[] = {"CA_Zeroing", "CA_DistanceText", "CA_Distance", "ACE_CA_Distance", "ACE_Rangehelper"}; + controls[] = {"CA_Zeroing", "CA_DistanceText", "CA_Distance","ACE_CA_Distance", "ACE_Rangehelper"}; MACRO_RANGEFINDER }; class RscOptics_sos: RscUnitInfo { diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp new file mode 100644 index 0000000000..4cc010f917 --- /dev/null +++ b/addons/fcs/CfgVehicles.hpp @@ -0,0 +1,518 @@ + +class CfgVehicles { + class All { + class Turrets; + }; + + class AllVehicles: All { + class NewTurret { + GVAR(Enabled) = 0; + GVAR(MinDistance) = 200; + GVAR(MaxDistance) = 9990; + GVAR(DistanceInterval) = 5; + class Turrets; + }; + class CargoTurret; + }; + + // LAND VEHICLES + class Land: AllVehicles {}; + + class LandVehicle: Land { + class CommanderOptics; + }; + + class Car: LandVehicle { + class ACE_SelfActions { + class ResetFCS { + displayName = $STR_ACE_FCS_ResetFCS; + enableInside = 1; + condition = QUOTE(call FUNC(canResetFCS)); + statement = QUOTE([ARR_2(_vehicle,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset);); + showDisabled = 0; + priority = 1; + icon = ""; + }; + }; + }; + + class Tank: LandVehicle { + class ACE_SelfActions { + class ResetFCS { + displayName = $STR_ACE_FCS_ResetFCS; + enableInside = 1; + condition = QUOTE(call FUNC(canResetFCS)); + statement = QUOTE([ARR_2(_vehicle,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset);); + showDisabled = 0; + priority = 1; + icon = ""; + }; + }; + class Turrets { + class MainTurret: NewTurret { + GVAR(Enabled) = 1; // all tracked vehicles get one by default + class Turrets { + class CommanderOptics; + }; + }; + }; + }; + + class Tank_F: Tank { + class Turrets { + class MainTurret: NewTurret { + GVAR(Enabled) = 1; // all tracked vehicles get one by default + class Turrets { + class CommanderOptics;//: CommanderOptics {}; + }; + }; + }; + }; + + class Car_F: Car { + class Turrets { + class MainTurret; + }; + }; + + class Wheeled_APC_F: Car_F { + class Turrets { + class MainTurret: NewTurret { + class Turrets { + class CommanderOptics;//: CommanderOptics {}; + }; + }; + }; + }; + + class MRAP_01_base_F: Car_F {}; + + class MRAP_01_gmg_base_F: MRAP_01_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class B_MRAP_01_F: MRAP_01_base_F { + class Turrets; + }; + + class MRAP_02_base_F: Car_F {}; + + class MRAP_02_hmg_base_F: MRAP_02_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class MRAP_02_gmg_base_F: MRAP_02_hmg_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class O_MRAP_02_F: MRAP_02_base_F { + class Turrets; + }; + + class MRAP_03_base_F: Car_F { + /*class Turrets: Turrets { + class CommanderTurret: MainTurret {}; + };*/ + }; + + class MRAP_03_hmg_base_F: MRAP_03_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + class CommanderTurret: CommanderTurret {}; + };*/ + }; + + class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + class CommanderTurret: CommanderTurret {}; + };*/ + }; + + class Offroad_01_base_F: Car_F {}; + + class Offroad_01_armed_base_F: Offroad_01_base_F { + /*class Turrets: Turrets { + class M2_Turret: MainTurret {}; + };*/ + }; + + class APC_Wheeled_01_base_F: Wheeled_APC_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + }; + }; + };*/ + }; + + class B_APC_Wheeled_01_base_F: APC_Wheeled_01_base_F {}; + + class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + + class APC_Wheeled_02_base_F: Wheeled_APC_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets; + }; + + class CommanderOptics: CommanderOptics {}; + };*/ + }; + + class APC_Wheeled_03_base_F: Wheeled_APC_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class I_APC_Wheeled_03_base_F: APC_Wheeled_03_base_F {}; + + class I_APC_Wheeled_03_cannon_F: I_APC_Wheeled_03_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class APC_Tracked_01_base_F: Tank_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets; + }; + };*/ + }; + + class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 0; + }; + class CommanderOptics: CommanderOptics {}; + }; + }; + + class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { + //GVAR(Enabled) = 0; @todo + }; + + class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + magazines[] += {"ACE_120Rnd_35mm_ABM_shells_Tracer_Red"}; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class APC_Tracked_02_base_F: Tank_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + }; + }; + };*/ + }; + + class O_APC_Tracked_02_base_F: APC_Tracked_02_base_F {}; + + class O_APC_Tracked_02_cannon_F: O_APC_Tracked_02_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class O_APC_Tracked_02_AA_F: O_APC_Tracked_02_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] += {"ACE_120Rnd_35mm_ABM_shells_Tracer_Green"}; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class APC_Tracked_03_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class MBT_01_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class B_MBT_01_base_F: MBT_01_base_F {}; + + class B_MBT_01_cannon_F: B_MBT_01_base_F {}; + + class MBT_01_arty_base_F: MBT_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class MBT_01_mlrs_base_F: MBT_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 0; + //class Turrets; + }; + }; + }; + + class MBT_02_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class MBT_02_arty_base_F: MBT_02_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class MBT_03_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class B_MBT_01_TUSK_F: B_MBT_01_cannon_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + }; + }; + }; + }; + }; + + // SHIPS + /*class Ship: AllVehicles { + class Turrets { + class MainTurret; + }; + }; + + class Ship_F: Ship {}; + + class Boat_F: Ship_F {}; + + class Boat_Armed_01_base_F: Boat_F { + class Turrets: Turrets { + class FrontTurret; + class RearTurret: FrontTurret {}; + }; + };*/ + + /*class Boat_Armed_01_minigun_base_F: Boat_Armed_01_base_F { + class Turrets: Turrets { + class FrontTurret: FrontTurret {}; + class RearTurret: RearTurret {}; + }; + };*/ + + // AIR VEHICLES + class Air: AllVehicles {}; + + class Helicopter: Air { + class Turrets { + class MainTurret; + }; + }; + + class Plane: Air {}; + + class Helicopter_Base_F: Helicopter { + class Turrets: Turrets { + class CopilotTurret; + }; + }; + + class Helicopter_Base_H: Helicopter_Base_F { + class Turrets: Turrets { + class CopilotTurret; + }; + }; + + class Heli_Light_01_base_F: Helicopter_Base_H { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class Heli_Light_01_unarmed_base_F: Heli_Light_01_base_F {}; + + class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class Heli_Light_01_armed_base_F: Heli_Light_01_base_F { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class Heli_Light_02_base_F: Helicopter_Base_H { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class Plane_Base_F: Plane { + class Turrets { + class CopilotTurret; + }; + }; + + class Heli_Attack_01_base_F: Helicopter_Base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + + class Heli_Attack_02_base_F: Helicopter_Base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + + class Heli_Transport_01_base_F: Helicopter_Base_H { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + class MainTurret: MainTurret {}; + class RightDoorGun: MainTurret {}; + };*/ + }; + + class Heli_Transport_02_base_F: Helicopter_Base_H { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class I_Heli_light_03_base_F: Helicopter_Base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class I_Heli_light_03_F: I_Heli_light_03_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class Plane_CAS_01_base_F: Plane_Base_F { + class Turrets; + }; + + class Plane_CAS_02_base_F: Plane_Base_F { + class Turrets; + }; + + class Plane_Fighter_03_base_F: Plane_Base_F { + class Turrets; + }; +}; diff --git a/addons/fcs/CfgWeapons.hpp b/addons/fcs/CfgWeapons.hpp new file mode 100644 index 0000000000..ec72bc6f44 --- /dev/null +++ b/addons/fcs/CfgWeapons.hpp @@ -0,0 +1,24 @@ + +class CfgWeapons { + // disable locking, so it doesn't interfere with our system + class CannonCore; + class cannon_120mm: CannonCore { + canLock = 0; + ballisticsComputer = 0; + }; + class autocannon_Base_F: CannonCore { + canLock = 0; + ballisticsComputer = 0; + }; + class autocannon_35mm: CannonCore { + canLock = 0; + ballisticsComputer = 0; + magazines[] += {"ACE_120Rnd_35mm_ABM_shells","ACE_120Rnd_35mm_ABM_shells_Tracer_Red","ACE_120Rnd_35mm_ABM_shells_Tracer_Green","ACE_120Rnd_35mm_ABM_shells_Tracer_Yellow"}; + }; + + // fix mrco having an invisible rangefinder + class ItemCore; + class optic_MRCO: ItemCore { + weaponInfoType = "RscWeaponZeroing"; + }; +}; diff --git a/addons/fcs/XEH_clientInit.sqf b/addons/fcs/XEH_clientInit.sqf index 66720ae44a..17faa70f17 100644 --- a/addons/fcs/XEH_clientInit.sqf +++ b/addons/fcs/XEH_clientInit.sqf @@ -1,79 +1,7 @@ #include "script_component.hpp" -GVAR(enabled) = True; +GVAR(enabled) = false; GVAR(time) = 0; GVAR(position) = [0,0,0]; -// Add keybinds -["ACE3", - localize "STR_ACE_FCS_LaseTarget", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(!GVAR(enabled) && {call FUNC(canUseRangefinder) || FUNC(canUseFCS)}) exitWith {false}; - - // Statement - [vehicle ACE_player] call FUNC(keyDown); - // Return false so it doesn't block the rest weapon action - false - }, - [15, [false, false, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_FCS_LaseTarget", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false}; - - // Statement - [vehicle ACE_player] call FUNC(keyUp); - false - }, - [15, [false, false, false]], - false, - "keyup" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_FCS_AdjustRangeUp", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; - - // Statement - [vehicle ACE_player, 50] call FUNC(adjustRange); - true - }, - [201, [false, false, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_FCS_AdjustRangeDown", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; - - // Statement - [vehicle ACE_player, -50] call FUNC(adjustRange); - true - }, - [209, [false, false, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; +#include "initKeybinds.sqf" diff --git a/addons/fcs/XEH_preInit.sqf b/addons/fcs/XEH_preInit.sqf index 18729ca54f..78a2fd091c 100644 --- a/addons/fcs/XEH_preInit.sqf +++ b/addons/fcs/XEH_preInit.sqf @@ -9,6 +9,7 @@ PREP(canUseRangefinder); PREP(firedEH); PREP(getAngle); PREP(getRange); +PREP(handleAirBurstAmmunitionPFH); PREP(keyDown); PREP(keyUp); PREP(reset); diff --git a/addons/fcs/config.cpp b/addons/fcs/config.cpp index e1e8ac8901..20ae063c70 100644 --- a/addons/fcs/config.cpp +++ b/addons/fcs/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {ace_common, ace_interaction}; - author[] = {"KoffeinFlummi","BadGuy (simon84)"}; + author[] = {"KoffeinFlummi","BadGuy (simon84)","commy2"}; authorUrl = "https://github.com/KoffeinFlummi/"; VERSION_CONFIG; }; @@ -14,329 +14,9 @@ class CfgPatches { #include "CfgEventHandlers.hpp" -class CfgVehicles { - class All { - class Turrets; - }; +#include "CfgAmmo.hpp" +#include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" - class AllVehicles: All { - GVAR(Enabled) = 0; - GVAR(MinDistance) = 200; - GVAR(MaxDistance) = 9990; - GVAR(DistanceInterval) = 5; - class NewTurret { - class Turrets; - }; - class CargoTurret; - }; - - class Land: AllVehicles {}; - - class LandVehicle: Land { - class CommanderOptics; - }; - - // WHEELED - class Car: LandVehicle { - class ACE_SelfActions { - class ResetFCS { - displayName = $STR_ACE_FCS_ResetFCS; - enableInside = 1; - condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([vehicle _player] call FUNC(reset);); - showDisabled = 0; - priority = 1; - icon = ""; - }; - }; - }; - - class Car_F: Car { - class Turrets { - class MainTurret; - }; - }; - - class Wheeled_APC_F: Car_F { - class Turrets { - class MainTurret: NewTurret { - class Turrets { - class CommanderOptics; - }; - }; - }; - }; - - class APC_Wheeled_01_base_F: Wheeled_APC_F {}; - class B_APC_Wheeled_01_base_F: APC_Wheeled_01_base_F {}; - class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F { - GVAR(Enabled) = 1; - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - class APC_Wheeled_03_base_F: Wheeled_APC_F { - GVAR(Enabled) = 1; - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - // TRACKED - class Tank: LandVehicle { - GVAR(Enabled) = 1; // all tracked vehicles get one by default - class ACE_SelfActions { - class ResetFCS { - displayName = $STR_ACE_FCS_ResetFCS; - enableInside = 1; - condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([vehicle _player] call FUNC(reset);); - showDisabled = 0; - priority = 1; - icon = ""; - }; - }; - class Turrets { - class MainTurret: NewTurret { - class Turrets { - class CommanderOptics; - }; - }; - }; - }; - - class Tank_F: Tank { - class Turrets { - class MainTurret: NewTurret { - class Turrets { - class CommanderOptics; - }; - }; - }; - }; - - class MBT_01_base_F: Tank_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - class B_MBT_01_base_F: MBT_01_base_F {}; - class B_MBT_01_cannon_F: B_MBT_01_base_F {}; - class B_MBT_01_TUSK_F: B_MBT_01_cannon_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - class MBT_01_arty_base_F: MBT_01_base_F { - GVAR(Enabled) = 0; - }; - class MBT_01_mlrs_base_F: MBT_01_base_F { - GVAR(Enabled) = 0; - }; - - class MBT_02_base_F: Tank_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - class MBT_02_arty_base_F: MBT_02_base_F { - GVAR(Enabled) = 0; - }; - - class MBT_03_base_F: Tank_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - class APC_Tracked_01_base_F: Tank_F {}; - class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {}; - class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F { - GVAR(Enabled) = 0; - }; - class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { - GVAR(Enabled) = 0; - }; - class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - magazines[] += {"ACE_120Rnd_35mm_ABM_shells_Tracer_Red"}; - }; - }; - }; - - class APC_Tracked_02_base_F: Tank_F {}; - class O_APC_Tracked_02_base_F: APC_Tracked_02_base_F {}; - class O_APC_Tracked_02_AA_F: O_APC_Tracked_02_base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - magazines[] += {"ACE_120Rnd_35mm_ABM_shells_Tracer_Green"}; - }; - }; - }; - - class APC_Tracked_03_base_F: Tank_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - // HELICOPTERS - class Air: AllVehicles {}; - - class Helicopter: Air { - class ACE_SelfActions { - class ResetFCS { - displayName = $STR_ACE_FCS_ResetFCS; - enableInside = 1; - condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([vehicle _player] call FUNC(reset);); - showDisabled = 0; - priority = 1; - icon = ""; - }; - }; - class Turrets { - class MainTurret; - }; - }; - - class Helicopter_Base_F: Helicopter { - class Turrets: Turrets { - class CopilotTurret; - }; - }; - - class Heli_Attack_01_base_F: Helicopter_Base_F { - GVAR(Enabled) = 1; - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - class Heli_Attack_02_base_F: Helicopter_Base_F { - GVAR(Enabled) = 1; - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; -}; - -class CfgWeapons { - // disable locking, so it doesn't interfere with our system - class CannonCore; - class cannon_120mm: CannonCore { - canLock = 0; - ballisticsComputer = 0; - }; - class autocannon_Base_F: CannonCore { - canLock = 0; - ballisticsComputer = 0; - }; - class autocannon_35mm: CannonCore { - canLock = 0; - ballisticsComputer = 0; - magazines[] += {"ACE_120Rnd_35mm_ABM_shells","ACE_120Rnd_35mm_ABM_shells_Tracer_Red","ACE_120Rnd_35mm_ABM_shells_Tracer_Green","ACE_120Rnd_35mm_ABM_shells_Tracer_Yellow"}; - }; - - // fix mrco having an invisible rangefinder - class ItemCore; - class optic_MRCO: ItemCore { - weaponInfoType = "RscWeaponZeroing"; - }; -}; - -class CfgMagazines { - class 680Rnd_35mm_AA_shells; - class 680Rnd_35mm_AA_shells_Tracer_Red; - class 680Rnd_35mm_AA_shells_Tracer_Green; - class 680Rnd_35mm_AA_shells_Tracer_Yellow; - - class ACE_120Rnd_35mm_ABM_shells: 680Rnd_35mm_AA_shells { - ammo = "ACE_B_35mm_ABM"; - count = 120; - displayName = "35mm ABM Shells"; - displayNameShort = "35mm ABM"; - }; - class ACE_120Rnd_35mm_ABM_shells_Tracer_Red: 680Rnd_35mm_AA_shells_Tracer_Red { - ammo = "ACE_B_35mm_ABM_Tracer_Red"; - count = 120; - displayName = "35mm ABM Shells"; - displayNameShort = "35mm ABM-T"; - }; - class ACE_120Rnd_35mm_ABM_shells_Tracer_Green: 680Rnd_35mm_AA_shells_Tracer_Green { - ammo = "ACE_B_35mm_ABM_Tracer_Green"; - count = 120; - displayName = "35mm ABM Shells"; - displayNameShort = "35mm ABM-T"; - }; - class ACE_120Rnd_35mm_ABM_shells_Tracer_Yellow: 680Rnd_35mm_AA_shells_Tracer_Yellow { - ammo = "ACE_B_35mm_ABM_Tracer_Yellow"; - count = 120; - displayName = "35mm ABM Shells"; - displayNameShort = "35mm ABM-T"; - }; -}; - -class CfgAmmo { - class B_35mm_AA; - class B_35mm_AA_Tracer_Red; - class B_35mm_AA_Tracer_Green; - class B_35mm_AA_Tracer_Yellow; - - class ACE_B_35mm_ABM: B_35mm_AA { - GVAR(Airburst) = 1; - deflecting = 0; - }; - class ACE_B_35mm_ABM_Tracer_Red: B_35mm_AA_Tracer_Red { - GVAR(Airburst) = 1; - deflecting = 0; - }; - class ACE_B_35mm_ABM_Tracer_Green: B_35mm_AA_Tracer_Green { - GVAR(Airburst) = 1; - deflecting = 0; - }; - class ACE_B_35mm_ABM_Tracer_Yellow: B_35mm_AA_Tracer_Yellow { - GVAR(Airburst) = 1; - deflecting = 0; - }; - - class ACE_B_35mm_ABM_Helper: B_35mm_AA { - indirectHitRange = 6; - simulation = "shotRocket"; - timeToLive = 0; - }; -}; - -#include +#include "CfgOptics.hpp" diff --git a/addons/fcs/functions/fnc_adjustRange.sqf b/addons/fcs/functions/fnc_adjustRange.sqf index 1620c53375..4b7f4b6b88 100644 --- a/addons/fcs/functions/fnc_adjustRange.sqf +++ b/addons/fcs/functions/fnc_adjustRange.sqf @@ -13,17 +13,20 @@ #include "script_component.hpp" -private ["_vehicle", "_delta", "_min", "_max", "_distance"]; +private ["_vehicle", "_turret", "_delta", "_turretConfig", "_min", "_max", "_distance"]; _vehicle = _this select 0; -_delta = _this select 1; +_turret = _this select 1; +_delta = _this select 2; -_min = getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> QGVAR(MinDistance)); -_max = getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> QGVAR(MaxDistance)); -_distance = _vehicle getVariable [QGVAR(Distance), _min]; +_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); + +_min = getNumber (_turretConfig >> QGVAR(MinDistance)); +_max = getNumber (_turretConfig >> QGVAR(MaxDistance)); +_distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min]; _distance = _distance + _delta; _distance = _distance min _max; _distance = _distance max _min; -[_vehicle, 0, _distance] call FUNC(keyUp); +[_vehicle, _turret, _distance] call FUNC(keyUp); diff --git a/addons/fcs/functions/fnc_canResetFCS.sqf b/addons/fcs/functions/fnc_canResetFCS.sqf index 8760503cdb..488f1eebf4 100644 --- a/addons/fcs/functions/fnc_canResetFCS.sqf +++ b/addons/fcs/functions/fnc_canResetFCS.sqf @@ -12,5 +12,4 @@ #include "script_component.hpp" -ACE_player == gunner vehicle ACE_player -&& (count ((vehicle ACE_player) getVariable [QGVAR(Magazines), []]) > 1) +count ((vehicle ACE_player) getVariable [format ["%1_%2", QGVAR(Magazines), [ACE_player] call EFUNC(common,getTurretIndex)], []]) > 1 diff --git a/addons/fcs/functions/fnc_canUseFCS.sqf b/addons/fcs/functions/fnc_canUseFCS.sqf index ef4a3f2814..cb4a1b608d 100644 --- a/addons/fcs/functions/fnc_canUseFCS.sqf +++ b/addons/fcs/functions/fnc_canUseFCS.sqf @@ -12,6 +12,5 @@ #include "script_component.hpp" -ACE_player == gunner vehicle ACE_player -&& {getNumber (configFile >> "CfgVehicles" >> typeOf (vehicle ACE_player) >> QGVAR(Enabled)) == 1} +getNumber ([configFile >> "CfgVehicles" >> typeOf vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1 && {cameraView == "GUNNER"} diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index e6fff694ca..f17693d33e 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -12,51 +12,50 @@ #include "script_component.hpp" -private ["_unit", "_weaponType", "_ammoType", "_magazineType", "_round", "_FCSMagazines", "_FCSElevation", "_offset"]; +private ["_vehicle", "_weapon", "_ammo", "_magazine", "_projectile"]; -_unit = _this select 0; -_weaponType = _this select 1; -_ammoType = _this select 4; -_magazineType = _this select 5; -_round = _this select 6; +_vehicle = _this select 0; +_weapon = _this select 1; +_ammo = _this select 4; +_magazine = _this select 5; +_projectile = _this select 6; -_FCSMagazines = _unit getVariable QGVAR(Magazines); -_FCSElevation = _unit getVariable QGVAR(Elevation); +private ["_gunner", "_turret"]; -if (ACE_player != gunner _unit) exitWith {}; -if !(_magazineType in _FCSMagazines) exitWith {}; +_gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); +_turret = [_gunner] call EFUNC(common,getTurretIndex); + +// Exit if the unit isn't a player +if !([_gunner] call EFUNC(common,isPlayer)) exitWith {}; + +private ["_FCSMagazines", "_FCSElevation", "_offset"]; + +_FCSMagazines = _vehicle getVariable format ["%1_%2", QGVAR(Magazines), _turret]; +_FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret]; + +if !(_magazine in _FCSMagazines) exitWith {}; // GET ELEVATION OFFSET OF CURRENT MAGAZINE _offset = 0; { - if (_x == _magazineType) exitWith { + if (_x == _magazine) exitWith { _offset = _FCSElevation select _forEachIndex; }; } forEach _FCSMagazines; -[_round, (_unit getVariable QGVAR(Azimuth)), _offset, 0] call EFUNC(common,changeProjectileDirection); +[_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection); // Air burst missile -// may need to get rewritten -if (getNumber (configFile >> "CfgAmmo" >> _ammoType >> "ACE_Airburst") == 1) then { - _this spawn { - _vehicle = _this select 0; - _projectile = _this select 6; - _distance = _vehicle getVariable [QGVAR(Distance), currentZeroing _vehicle]; +// handle locally only +if (!local _gunner) exitWith {}; - if (_distance < 50) exitWith {}; - if (_distance > 1500) exitWith {}; +if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(Airburst)) == 1) then { + private "_zeroing"; + _zeroing = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle]; - waitUntil {_projectile distance _vehicle > _distance || {!alive _projectile}}; - if (!alive _projectile) exitWith {}; + if (_zeroing < 50) exitWith {}; + if (_zeroing > 1500) exitWith {}; - _position = getPosATL _projectile; - - _subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"]; - _subMunition setPosATL _position; - _subMunition setVelocity [0, 0, -10]; - - deleteVehicle _projectile; - }; + [FUNC(handleAirBurstAmmunitionPFH), 0, [_vehicle, _projectile, _zeroing]] call CBA_fnc_addPerFrameHandler; }; diff --git a/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf b/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf new file mode 100644 index 0000000000..7e8480ce18 --- /dev/null +++ b/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf @@ -0,0 +1,21 @@ +// by commy2 + +_vehicle = _this select 0 select 0; +_projectile = _this select 0 select 1; +_zeroing = _this select 0 select 2; + +if (isNull _projectile || {!alive _projectile}) exitWith { + [_this select 1] call CBA_fnc_removePerFrameHandler; +}; + +if (_projectile distance _vehicle < _zeroing) exitWith {}; + +_position = getPosATL _projectile; + +_subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"]; +_subMunition setPosATL _position; +_subMunition setVelocity [0, 0, -10]; + +deleteVehicle _projectile; + +[_this select 1] call CBA_fnc_removePerFrameHandler; diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index 086a11c03c..7699b82a20 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -12,12 +12,14 @@ #include "script_component.hpp" -private ["_vehicle", "_distance", "_weaponDirection"]; +private ["_vehicle", "_turret", "_distance", "_weaponDirection"]; _vehicle = _this select 0; +_turret = _this select 1; + _distance = call FUNC(getRange); -if !(call FUNC(canUseFCS)) exitWith {}; +if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {}; GVAR(Enabled) = true; GVAR(Time) = time; @@ -26,7 +28,15 @@ if (_distance == 0) then { _distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision }; -_weaponDirection = _vehicle weaponDirection currentWeapon _vehicle; +_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets + +if (_turret isEqualTo ([typeOf _vehicle] call EFUNC(common,getTurretCommander))) then { + _weaponDirection = eyeDirection _vehicle; +}; + +if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turrets + _weaponDirection = [1,0,0]; +}; GVAR(Position) = [ (getPos _vehicle select 0) + _distance * (_weaponDirection select 0), diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index c95460e65b..1e5878f0b5 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -12,22 +12,37 @@ #include "script_component.hpp" -private ["_ammoType", "_viewDiff", "_posArrival", "_airFriction", "_timeToLive", "_maxElev", "_vehicle", "_posTarget", "_distance", "_simulationStep", "_posX", "_velocityMagnitude", "_magazines", "_movingAzimuth", "_FCSElevation", "_velocityX", "_velocityY", "_weaponDirection", "_velocityTarget", "_FCSAzimuth", "_FCSMagazines", "_dirArrival", "_i", "_magazineType", "_angleTarget", "_offset", "_timeToTarget", "_initSpeed"]; +private ["_vehicle", "_turret", "_turretConfig", "_distance", "_magazines"]; _vehicle = _this select 0; +_turret = _this select 1; + +_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); + _distance = call FUNC(getRange); -_magazines = magazines _vehicle; +_magazines = _vehicle magazinesTurret _turret; if (_distance == 0) then { _distance = [ - getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(DistanceInterval)), - getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MaxDistance)), - getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MinDistance)) + getNumber (_turretConfig >> QGVAR(DistanceInterval)), + getNumber (_turretConfig >> QGVAR(MaxDistance)), + getNumber (_turretConfig >> QGVAR(MinDistance)) ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision }; -_weaponDirection = _vehicle weaponDirection currentWeapon _vehicle; +private ["_weaponDirection", "_angleTarget"]; + +_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets + +if (_turret isEqualTo ([typeOf _vehicle] call EFUNC(common,getTurretCommander))) then { + _weaponDirection = eyeDirection _vehicle; +}; + +if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turrets + _weaponDirection = [1,0,0]; +}; + _angleTarget = asin (_weaponDirection select 2); if (count _this > 2) then { @@ -38,6 +53,8 @@ if (!(isNil QGVAR(backgroundCalculation)) and {!(scriptDone GVAR(backgroundCalcu terminate GVAR(backgroundCalculation); }; +private "_movingAzimuth"; + // MOVING TARGETS _movingAzimuth = 0; if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { @@ -53,8 +70,10 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { ((_posTarget select 2) - (GVAR(position) select 2)) / (time - GVAR(time)) ]; + private ["_magazineType", "_ammoType", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep"]; + // estimate time to target - _magazineType = currentMagazine _vehicle; + _magazineType = _vehicle currentMagazineTurret _turret; _ammoType = getText (configFile >> "CfgMagazines" >> _magazineType >> "ammo"); _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazineType >> "initSpeed"); _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); @@ -62,10 +81,13 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { _simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "simulationStep"); if (_simulationStep != 0) then { + private ["_posX", "_velocityX", "_velocityY", "_timeToTarget"]; + _posX = 0; _velocityX = _initSpeed; _velocityY = 0; _timeToTarget = 0; + for "_i" from 1 to ((floor (_timeToLive / _simulationStep)) + 1) do { _posX = _posX + _velocityX * _simulationStep; if (_posX >= _distance) exitWith { // bullet passed the target @@ -76,12 +98,15 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { _velocityY = _velocityY + _velocityY * _velocityMagnitude * _airFriction * _simulationStep - 9.81 * _simulationStep; }; + private ["_posArrival", "_dirArrival"]; + // calculate offsets _posArrival = [ (_posTarget select 0) + (_velocityTarget select 0) * _timeToTarget, (_posTarget select 1) + (_velocityTarget select 1) * _timeToTarget, (_posTarget select 2) + (_velocityTarget select 2) * _timeToTarget ]; + _dirArrival = [ ((_posArrival select 0) - (getPos _vehicle select 0)) / (_posArrival distance (getPos _vehicle)), ((_posArrival select 1) - (getPos _vehicle select 1)) / (_posArrival distance (getPos _vehicle)), @@ -96,9 +121,12 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { GVAR(enabled) = false; GVAR(time) = -1; +private ["_viewDiff", "_FCSAzimuth", "_FCSMagazines", "_FCSElevation"]; + // CALCULATE AZIMUTH CORRECTION -_viewDiff = _vehicle getVariable QGVAR(ViewDiff); +_viewDiff = _vehicle getVariable format ["%1_%2", QGVAR(ViewDiff), _turret]; _FCSAzimuth = _movingAzimuth; + if (_viewDiff != 0) then { _FCSAzimuth = (atan (_distance / _viewDiff) - (abs _viewDiff / _viewDiff) * 90) + _movingAzimuth; }; @@ -108,11 +136,16 @@ _FCSMagazines = []; _FCSElevation = []; { - _ammoType = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); + private "_ammoType"; + + _ammoType = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); + if !(getText (configFile >> "CfgAmmo" >> _ammoType >> "simulation") == "shotMissile") then { - _maxElev = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret" >> "maxElev"); - _initSpeed = getNumber (configFile >> "CfgMagazines" >> _x >> "initSpeed"); - _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); + private ["_maxElev", "_initSpeed", "_airFriction", "_offset"]; + + _maxElev = getNumber (_turretConfig >> "maxElev"); + _initSpeed = getNumber (configFile >> "CfgMagazines" >> _x >> "initSpeed"); + _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance]; _offset = parseNumber _offset; @@ -122,9 +155,9 @@ _FCSElevation = []; }; } forEach _magazines; -_vehicle setVariable [QGVAR(Distance), _distance, true]; -_vehicle setVariable [QGVAR(Magazines), _FCSMagazines, true]; -_vehicle setVariable [QGVAR(Elevation), _FCSElevation, true]; -_vehicle setVariable [QGVAR(Azimuth), _FCSAzimuth, true]; +[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth] call EFUNC(common,setVariablePublic); [format ["%1: %2", localize "STR_ACE_FCS_ZeroedTo", _distance]] call EFUNC(common,displayTextStructured); diff --git a/addons/fcs/functions/fnc_reset.sqf b/addons/fcs/functions/fnc_reset.sqf index f49c4c9589..a23a759fa3 100644 --- a/addons/fcs/functions/fnc_reset.sqf +++ b/addons/fcs/functions/fnc_reset.sqf @@ -12,13 +12,14 @@ #include "script_component.hpp" -private ["_vehicle"]; +private ["_vehicle", "_turret"]; _vehicle = _this select 0; +_turret = _this select 1; -_vehicle setVariable [QGVAR(Distance), 0, true]; -_vehicle setVariable [QGVAR(Magazines), [], true]; -_vehicle setVariable [QGVAR(Elevation), 0, true]; -_vehicle setVariable [QGVAR(Azimuth), 0, true]; +[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], 0] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], []] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], 0] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], 0] call EFUNC(common,setVariablePublic); [localize "STR_ACE_FCS_HasBeenReset"] call EFUNC(common,displayTextStructured); diff --git a/addons/fcs/functions/fnc_vehicleInit.sqf b/addons/fcs/functions/fnc_vehicleInit.sqf index 5872b1757f..8ac23073f6 100644 --- a/addons/fcs/functions/fnc_vehicleInit.sqf +++ b/addons/fcs/functions/fnc_vehicleInit.sqf @@ -1,7 +1,7 @@ /* - * Author: KoffeinFlummi + * Author: KoffeinFlummi, commy2 * - * Checks if a vehicle is equipped with an FCS and if so, adds the fired event handler + * Checks if a vehicle is equipped with an FCS and if so, adds the fired event handler. Execute on server. * * Arguments: * 0: Vehicle @@ -12,25 +12,34 @@ #include "script_component.hpp" -private ["_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; +private "_vehicle"; -if (getNumber (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> QGVAR(Enabled)) == 1) then { - (_this select 0) addEventHandler ["Fired", {_this call FUNC(firedEH)}]; +_vehicle = _this select 0; - (_this select 0) setVariable [QGVAR(Distance), 0, true]; - (_this select 0) setVariable [QGVAR(Magazines), [], true]; - (_this select 0) setVariable [QGVAR(Elevation), [], true]; - (_this select 0) setVariable [QGVAR(Azimuth), 0, true]; +{ + private "_turretConfig"; + _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath); - // calculate offset between gunner camera and muzzle position - if !((_this select 0) isKindOf "Air") then { - _gunBeg = getText (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> "Turrets" >> "MainTurret" >> "gunBeg"); - _gunnerView = getText (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> "Turrets" >> "MainTurret" >> "memoryPointGunnerOptics"); - _gunBegPos = ((_this select 0) selectionPosition _gunBeg) select 0; - _gunnerViewPos = ((_this select 0) selectionPosition _gunnerView) select 0; - _viewDiff = _gunBegPos - _gunnerViewPos; - (_this select 0) setVariable [QGVAR(ViewDiff), _viewDiff, true]; - } else { - (_this select 0) setVariable [QGVAR(ViewDiff), 0, true]; + if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) then { + _vehicle setVariable [format ["%1_%2", QGVAR(Distance), _x], 0, true]; + _vehicle setVariable [format ["%1_%2", QGVAR(Magazines), _x], [], true]; + _vehicle setVariable [format ["%1_%2", QGVAR(Elevation), _x], [], true]; + _vehicle setVariable [format ["%1_%2", QGVAR(Azimuth), _x], 0, true]; + + // calculate offset between gunner camera and muzzle position + if !(_vehicle isKindOf "Air") then { + private ["_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; + + _gunBeg = getText (_turretConfig >> "gunBeg"); + _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); + + _gunBegPos = (_vehicle selectionPosition _gunBeg) select 0; + _gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0; + _viewDiff = _gunBegPos - _gunnerViewPos; + + _vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], _viewDiff, true]; + } else { + _vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], 0, true]; + }; }; -}; +} forEach allTurrets _vehicle; diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf new file mode 100644 index 0000000000..dd1a94b78e --- /dev/null +++ b/addons/fcs/initKeybinds.sqf @@ -0,0 +1,81 @@ +// by commy2 + +["ACE3", + localize "STR_ACE_FCS_LaseTarget", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; + + // prevent holding down + if (GETGVAR(isDownStateKey1,false)) exitWith {false}; + GVAR(isDownStateKey1) = true; + + // Statement + [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyDown); + // Return false so it doesn't block the rest weapon action + false + }, + [15, [false, false, false]], + false, + "keydown" +] call cba_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_FCS_LaseTarget", + { + // prevent holding down + GVAR(isDownStateKey1) = false; + + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false}; + + // Statement + [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyUp); + false + }, + [15, [false, false, false]], + false, + "keyup" +] call cba_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_FCS_AdjustRangeUp", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; + + // Statement + [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), 50] call FUNC(adjustRange); + true + }, + [201, [false, false, false]], + false, + "keydown" +] call cba_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_FCS_AdjustRangeDown", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; + + // Statement + [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -50] call FUNC(adjustRange); + true + }, + [209, [false, false, false]], + false, + "keydown" +] call cba_fnc_registerKeybind; diff --git a/addons/flashsuppressors/CfgVehicles.hpp b/addons/flashsuppressors/CfgVehicles.hpp index 40dc505d64..a973518b91 100644 --- a/addons/flashsuppressors/CfgVehicles.hpp +++ b/addons/flashsuppressors/CfgVehicles.hpp @@ -1,9 +1,4 @@ -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -} - class CfgVehicles { class NATO_Box_Base; class Box_NATO_Support_F: NATO_Box_Base { diff --git a/addons/gforces/XEH_preInit.sqf b/addons/gforces/XEH_preInit.sqf index ce10f592bb..1d249ff6a0 100644 --- a/addons/gforces/XEH_preInit.sqf +++ b/addons/gforces/XEH_preInit.sqf @@ -1,6 +1,10 @@ #include "script_component.hpp" +ADDON = false; + PREP(pfhUpdateGForces); GVAR(GForces) = []; GVAR(GForces_Index) = 0; + +ADDON = true; diff --git a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf index afee7579cd..839110fd2b 100644 --- a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf +++ b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf @@ -1,5 +1,17 @@ -// by KoffeinFlummi and CAA-Picard -#include "script_component.hpp" +/* + * Author: KoffeinFlummi and CAA-Picard + * Calculates average g-forces and triggers g-effects + * + * Argument: + * 0: Arguments + * 1: pfh_id + * + * Return value: + * None + * + * Public: No + */ + #include "script_component.hpp" EXPLODE_2_PVT(_this,_params,_pfhId); @@ -60,7 +72,15 @@ if (count GVAR(GForces) > 0) then { _classCoef = ACE_player getVariable ["ACE_GForceCoef", getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "ACE_GForceCoef")]; -_suitCoef = getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef"); +_suitCoef = if ((uniform ACE_player) != "") then { + getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef") +} else { + 1 +}; + +//Fix "Error Zero divisor" +if (_classCoef == 0) then {_classCoef = 0.001}; +if (_suitCoef == 0) then {_suitCoef = 0.001}; _gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG; _gRedOut = MINVIRTUALG / _classCoef; diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index 941b2d85ea..4c7160bdb3 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -1,18 +1,19 @@ /* - Name: XEH_postInit.sqf - - Author: Garth de Wet (LH) - - Description: - Sets up the glasses mod for usage. Initialises variables and event handlers. - Shouldn't be called by a user/modder ever. Done by the engine. - - Parameters: - Nothing - - Returns: - Nothing -*/ + * Author: Garth 'L-H' de Wet + * Sets up the glasses mod for usage. Initialises variables and event handlers. + * Shouldn't be called by a user/modder ever. Done by the engine. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ #include "script_component.hpp" if (!hasInterface) exitWith {}; @@ -57,7 +58,7 @@ player addEventHandler ["Explosion", { call FUNC(ApplyDirtEffect); if (GETBROKEN) exitWith {}; if (((_this select 1) call FUNC(GetExplosionIndex)) < getNumber(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Resistance")) exitWith {}; - if !(ace_player call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);}; + if !([ace_player] call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);}; _effects = GETGLASSES(ace_player); _effects set [BROKEN, true]; SETGLASSES(ace_player,_effects); @@ -94,8 +95,8 @@ player AddEventHandler ["Put", {call FUNC(checkGlasses);}]; if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)}; - if (ace_player call FUNC(isGogglesVisible)) then { - (_this select 0) call FUNC(applyGlassesEffect); + if ([ace_player] call FUNC(isGogglesVisible)) then { + [_this select 0] call FUNC(applyGlassesEffect); } else { call FUNC(removeGlassesEffect); }; diff --git a/addons/goggles/XEH_preInit.sqf b/addons/goggles/XEH_preInit.sqf index c2878f3721..4eb7df91d1 100644 --- a/addons/goggles/XEH_preInit.sqf +++ b/addons/goggles/XEH_preInit.sqf @@ -1,5 +1,22 @@ +/* + * Author: Garth 'L-H' de Wet + * Initialises Goggles. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ #include "script_component.hpp" +ADDON = false; + PREP(applyDirtEffect); PREP(applyDust); PREP(applyGlassesEffect); @@ -21,3 +38,5 @@ PREP(removeDirtEffect); PREP(removeDustEffect); PREP(removeGlassesEffect); PREP(removeRainEffect); + +ADDON = true; diff --git a/addons/goggles/config.cpp b/addons/goggles/config.cpp index f804be003e..dcc9c6ed0e 100644 --- a/addons/goggles/config.cpp +++ b/addons/goggles/config.cpp @@ -3,13 +3,13 @@ #define COLOUR 8.0 class CfgPatches { class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"Garth 'L-H' de Wet"}; - authorUrl = "http://garth.snakebiteink.co.za/"; - VERSION_CONFIG; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"Garth 'L-H' de Wet"}; + authorUrl = "http://garth.snakebiteink.co.za/"; + VERSION_CONFIG; }; }; @@ -243,10 +243,12 @@ class SniperCloud { ACE_Goggles_BulletCount = 1; }; -class ACE_Options { +class ACE_Settings { class GVAR(showInThirdPerson) { - displayName = $STR_ACE_Goggles_ShowInThirdPerson; - default = 0; + value = 0; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_Goggles_ShowInThirdPerson"; }; }; diff --git a/addons/goggles/functions/fnc_applyDirtEffect.sqf b/addons/goggles/functions/fnc_applyDirtEffect.sqf index 0cf784a528..f12cf74f29 100644 --- a/addons/goggles/functions/fnc_applyDirtEffect.sqf +++ b/addons/goggles/functions/fnc_applyDirtEffect.sqf @@ -1,20 +1,18 @@ /* - ApplyDirtEffect - - Author: Garth de Wet (LH) - - Description: - Adds dirt effect to the glasses. - - Parameters: - Nothing - - Returns: - BOOLEAN - True if succeeded false if not - - Example: - call FUNC(ApplyDirtEffect); -*/ + * Author: Garth 'L-H' de Wet + * Adds dirt effect to the glasses. + * + * Arguments: + * None + * + * Return Value: + * Succeeded + * + * Example: + * _applied = call ace_goggles_fnc_ApplyDirtEffect; + * + * Public: Yes + */ #include "script_component.hpp" if (cameraOn != ace_player || {call FUNC(externalCamera)}) exitWith{false}; @@ -23,7 +21,7 @@ _effects = GETGLASSES(ace_player); _effects set [DIRT, true]; SETGLASSES(ace_player,_effects); -if (ace_player call FUNC(isGogglesVisible)) then{ +if ([ace_player] call FUNC(isGogglesVisible)) then{ _dirtImage = getText(ConfigFile >> "CfgGlasses" >> (goggles ace_player) >> "ACE_OverlayDirt"); if (_dirtImage != "") then { 100 cutRsc["RscACE_GogglesEffects", "PLAIN",0.1, false]; diff --git a/addons/goggles/functions/fnc_applyDust.sqf b/addons/goggles/functions/fnc_applyDust.sqf index 53e75ba274..311a993904 100644 --- a/addons/goggles/functions/fnc_applyDust.sqf +++ b/addons/goggles/functions/fnc_applyDust.sqf @@ -1,23 +1,21 @@ /* - Name: fnc_applyDust.sqf - - Author: Garth de Wet (LH) - - Description: - Applies dust to screen. - - Parameters: - Nothing - - Returns: - Nothing - - Example 1: - call FUNC(ApplyDust); -*/ + * Author: Garth 'L-H' de Wet + * Applies dust to screen. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_ApplyDust; + * + * Public: Yes + */ #include "script_component.hpp" if (call FUNC(ExternalCamera)) exitWith {}; -if (ace_player call FUNC(isGogglesVisible)) exitWith { +if ([ace_player] call FUNC(isGogglesVisible)) exitWith { 100 cutRsc["RscACE_GogglesEffects", "PLAIN",2,false]; (uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText format[getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_DustPath"), GETDUSTT(DAMOUNT)+1]; SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,1)); diff --git a/addons/goggles/functions/fnc_applyGlassesEffect.sqf b/addons/goggles/functions/fnc_applyGlassesEffect.sqf index 496f73d4b0..1d69041d81 100644 --- a/addons/goggles/functions/fnc_applyGlassesEffect.sqf +++ b/addons/goggles/functions/fnc_applyGlassesEffect.sqf @@ -1,26 +1,24 @@ /* - Name: fnc_ApplyGlassesEffect.sqf - - Author: Garth de Wet (LH) - - Description: - Sets screen tint for glasses. - Sets screen overlay for glasses. (broken/fixed) - Sets dirt/rain overlay for glasses. - - Parameters: - 0: STRING - Glasses class name to be applied. - - Returns: - Nothing - - Example: - (goggles ace_player) call FUNC(ApplyGlassesEffect); -*/ + * Author: Garth 'L-H' de Wet + * Sets screen tint for glasses. + * Sets screen overlay for glasses. (broken/fixed) + * Sets dirt/rain overlay for glasses. + * + * Arguments: + * 0: Glasses classname to be applied + * + * Return Value: + * None + * + * Example: + * [goggles ace_player] call ace_goggles_fnc_ApplyGlassesEffect; + * + * Public: No + */ #include "script_component.hpp" private["_postProcessColour", "_postProcessTintAmount", "_glassesClassname", "_glassImagePath"]; -_glassesClassname = _this; +_glassesClassname = _this select 0; _postProcessColour = getArray(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Color"); _postProcessTintAmount = getNumber(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_TintAmount"); diff --git a/addons/goggles/functions/fnc_checkGoggles.sqf b/addons/goggles/functions/fnc_checkGoggles.sqf index a00b7371d8..6d8f493c3e 100644 --- a/addons/goggles/functions/fnc_checkGoggles.sqf +++ b/addons/goggles/functions/fnc_checkGoggles.sqf @@ -1,10 +1,19 @@ /* - Author: Garth de Wet (LH) - - Description: - Performs rain checks and checks to see whether glasses effects have been applied or not. - Checks for external camera and removes effects. -*/ + * Author: Garth 'L-H' de Wet + * Performs rain checks and checks to see whether glasses effects have been applied or not. + * Checks for external camera and removes effects. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ #include "script_component.hpp" if (!alive ace_player) exitWith {}; if (true) then { @@ -15,7 +24,7 @@ if (true) then { }; }; call FUNC(checkGlasses); - if !(ace_player call FUNC(isGogglesVisible)) exitWith { + if !([ace_player] call FUNC(isGogglesVisible)) exitWith { if (GVAR(EffectsActive)) then { call FUNC(removeGlassesEffect); }; @@ -26,9 +35,9 @@ if (true) then { }; }; if !(GVAR(EffectsActive)) then { - (goggles ace_player) call FUNC(applyGlassesEffect); + [goggles ace_player] call FUNC(applyGlassesEffect); } else { - if ((goggles ace_player) call FUNC(isDivingGoggles) && {underwater ace_player}) then { + if ([goggles ace_player] call FUNC(isDivingGoggles) && {underwater ace_player}) then { call FUNC(removeRainEffect); call FUNC(removeDirtEffect); call FUNC(removeDustEffect); diff --git a/addons/goggles/functions/fnc_clearGlasses.sqf b/addons/goggles/functions/fnc_clearGlasses.sqf index 4072e7c68a..fb2e9bfa91 100644 --- a/addons/goggles/functions/fnc_clearGlasses.sqf +++ b/addons/goggles/functions/fnc_clearGlasses.sqf @@ -1,21 +1,19 @@ /* - Name: fnc_clearGlasses.sqf - - Author: Garth de Wet (LH) - - Description: - Clears all dirt, rain, dust from glasses. - Removes glasses effect (PP, overlay) and then puts it back. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call FUNC(ClearGlasses); -*/ + * Author: Garth 'L-H' de Wet + * Clears all dirt, rain, dust from glasses. + * Removes glasses effect (PP, overlay) and then puts it back. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_ClearGlasses; + * + * Public: Yes + */ #include "script_component.hpp" private "_broken"; diff --git a/addons/goggles/functions/fnc_dustHandler.sqf b/addons/goggles/functions/fnc_dustHandler.sqf index aae722d50f..979a4a1bf0 100644 --- a/addons/goggles/functions/fnc_dustHandler.sqf +++ b/addons/goggles/functions/fnc_dustHandler.sqf @@ -1,22 +1,19 @@ /* - fnc_DustHandler.sqf - - Author: Garth de Wet (LH) - - Description: - Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. - - Parameters: - 0: Object - unit - eventhandler was attached to. (Used) - 1: String - weapon - Weapon fired (Used) - - Returns: - Nothing - - Example: - ace_player addEventHandler ["Fired", {[_this select 0, _this select 1] call FUNC(DustHandler;}]; - See http://community.bistudio.com/wiki/ArmA_3:_Event_Handlers#Fired -*/ + * Author: Garth 'L-H' de Wet + * Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Example: + *ace_player addEventHandler ["Fired", {[_this select 0, _this select 1] call ace_goggles_fnc_dustHandler;}]; + * + * Public: No + */ #include "script_component.hpp" private ["_bullets", "_position", "_surface", "_found", "_weapon", "_cloudType", "_unit"]; EXPLODE_2_PVT(_this,_unit,_weapon); diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index 35b94171a6..9161804a56 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -1,23 +1,19 @@ /* - fnc_ExternalCamera.sqf - - Author: Garth de Wet (LH) - - Description: - Returns if the camera is external or not. - - Parameters: - Nothing - - Returns: - Boolean - whether the camera is in external view or not. - If the "showInThirdPerson" option is checked, this will always return false. - - Example: - call FUNC(ExternalCamera); -*/ - + * Author: Garth 'L-H' de Wet + * Returns if the camera is external or not. + * + * Arguments: + * None + * + * Return Value: + * Whether the camera is in external view or not. If the "showInThirdPerson" option is checked, this will always return false. + * + * Example: + * call ace_goggles_fnc_removeRainEffect; + * + * Public: Yes + */ #include "script_component.hpp" -if ((missionNameSpace getVariable [QGVAR(showInThirdPerson), 0]) == 1) exitWith { false }; +if (GVAR(showInThirdPerson)) exitWith { false }; (cameraView == "External") diff --git a/addons/goggles/functions/fnc_getExplosionIndex.sqf b/addons/goggles/functions/fnc_getExplosionIndex.sqf index 92d79f4992..5b81c63655 100644 --- a/addons/goggles/functions/fnc_getExplosionIndex.sqf +++ b/addons/goggles/functions/fnc_getExplosionIndex.sqf @@ -1,20 +1,18 @@ /* - fnc_getExplosionIndex.sqf - - Author: Garth de Wet (LH) - - Description: - Turns 0-1 damage into a rating system of 0-3 - - Parameters: - 0: NUMBER - The amount of damage - - Returns: - NUMBER (the rating) [0-3] - - Example: - _rating = 0.05 call FUNC(GetExplosionIndex); -*/ + * Author: Garth 'L-H' de Wet + * Turns 0-1 damage of explosion Event into a rating system of 0-3 + * + * Arguments: + * 0: The amount of damage + * + * Return Value: + * The rating [0-3] + * + * Example: + * _rating = 0.05 call ace_goggles_fnc_getExplosionIndex; + * + * Public: No + */ private ["_effectIndex"]; _effectIndex = switch true do { diff --git a/addons/goggles/functions/fnc_isDivingGoggles.sqf b/addons/goggles/functions/fnc_isDivingGoggles.sqf index d6b97fb80a..bcc6b0db5e 100644 --- a/addons/goggles/functions/fnc_isDivingGoggles.sqf +++ b/addons/goggles/functions/fnc_isDivingGoggles.sqf @@ -1,23 +1,21 @@ /* - fnc_isDivingGoggles.sqf - - Author: Garth de Wet (LH) - - Description: - Determines whether current goggles worn by passed unit is diving goggles or a variant of them. - - Parameters: - 0: String - Glasses classname - - Returns: - Boolean - whether diving goggles are worn - - Example: - (goggles ace_player) call FUNC(isDivingGoggles); -*/ + * Author: Garth 'L-H' de Wet + * Determines whether passed goggles is diving goggles or a variant of them. + * + * Arguments: + * 0: Glasses classname + * + * Return Value: + * Whether diving goggles are worn + * + * Example: + * [(goggles ace_player)] call ace_goggles_fnc_isDivingGoggles; + * + * Public: Yes + */ #include "script_component.hpp" private ["_result", "_glasses"]; -_glasses = _this; +_glasses = _this select 0; _result = _glasses == "G_Diving"; if (_result) exitWith {true}; _result = [configFile >> "CfgGlasses" >> _glasses, configFile >> "CfgGlasses" >> "G_Diving"] call CBA_fnc_inheritsFrom; diff --git a/addons/goggles/functions/fnc_isGogglesVisible.sqf b/addons/goggles/functions/fnc_isGogglesVisible.sqf index a663554b60..3d87499b90 100644 --- a/addons/goggles/functions/fnc_isGogglesVisible.sqf +++ b/addons/goggles/functions/fnc_isGogglesVisible.sqf @@ -1,23 +1,21 @@ /* - fnc_isGogglesVisible.sqf - - Author: Garth de Wet (LH) - - Description: - Determines if goggles are visible on passed unit (Also checks if unit is in vehicle and cameraView is set to GUNNER) - - Parameters: - 0: Object - unit to check for visible goggles - - Returns: - BOOL - Whether the goggles are visible or not. - - Example: - _visible = ace_player call FUNC(isGogglesVisible); -*/ + * Author: Garth 'L-H' de Wet + * Determines if goggles are visible on passed unit (Also checks if unit is in vehicle and cameraView is set to GUNNER) + * + * Arguments: + * 0: Unit + * + * Return Value: + * Whether goggles are visible + * + * Example: + * _visible = [ace_player] call ace_goggles_fnc_isGogglesVisible; + * + * Public: Yes + */ #include "script_component.hpp" private ["_currentGlasses", "_result", "_unit"]; -_unit = _this; +_unit = _this select 0; _currentGlasses = goggles _unit; _result = false; @@ -27,12 +25,12 @@ if ((vehicle _unit) != _unit) exitWith {(cameraView != "GUNNER")}; if (_currentGlasses != "") then { _position =(getPosASLW _unit); if (surfaceIsWater _position && {((_position select 2) < 0.25)}) exitWith { - _result = (_currentGlasses call FUNC(isDivingGoggles)); + _result = ([_currentGlasses] call FUNC(isDivingGoggles)); }; if (getNumber (ConfigFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith { _result = false; }; - _result = !(_currentGlasses call FUNC(isDivingGoggles)); + _result = !([_currentGlasses] call FUNC(isDivingGoggles)); }; _result diff --git a/addons/goggles/functions/fnc_isInRotorWash.sqf b/addons/goggles/functions/fnc_isInRotorWash.sqf index f8bad1a10f..0d9e22f7da 100644 --- a/addons/goggles/functions/fnc_isInRotorWash.sqf +++ b/addons/goggles/functions/fnc_isInRotorWash.sqf @@ -1,24 +1,22 @@ /* - fnc_isInRotorWash.sqf - - Author: Garth de Wet (LH) - - Description: - Checks for nearby helicopters (within 15m) - - Parameters: - 0: Object - Unit - 1: NUMBER - (optional) Radius to check for helicopter Default: 15 - - Returns: - Array: - 0 - boolean - If in rotorwash - 1 - number - Amount of rotor wash. - - Example: - if (([ace_player, 10] call FUNC(isInRotorWash)) select 0) then { hint "Rotor wash"; }; - if (([ace_player] call FUNC(isInRotorWash)) select 0) then { hint "Rotor wash"; }; -*/ + * Author: Garth 'L-H' de Wet + * Checks for nearby running helicopters (within 15m) + * + * Arguments: + * 0: Unit + * 1: Radius to check for helicopter Default: 15 (optional) + * + * Return Value: + * : + * 0: In rotorwash + * 1: Amount of rotor wash. + * + * Example: + * if (([ace_player, 10] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; }; + * if (([ace_player] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; }; + * + * Public: Yes + */ #include "script_component.hpp" private ["_heli", "_unit", "_result", "_radius"]; _unit = _this select 0; diff --git a/addons/goggles/functions/fnc_onEachFrame.sqf b/addons/goggles/functions/fnc_onEachFrame.sqf index cd361e38cf..a3c65cac6b 100644 --- a/addons/goggles/functions/fnc_onEachFrame.sqf +++ b/addons/goggles/functions/fnc_onEachFrame.sqf @@ -1,20 +1,18 @@ /* - fnc_onEachFrame.sqf - - Author: Garth de Wet (LH) - - Description: - Runs every frame checking for helicopters. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - ["ACE_Goggles_RotorWash", "OnEachFrame", "call FUNC(OnEachFrame);"] call BIS_fnc_addStackedEventHandler; -*/ + * Author: Garth 'L-H' de Wet + * Checks whether the player is in the downwash of a helicopter and handles applying effects of that. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * ["ACE_Goggles_RotorWash", "OnEachFrame", "call ace_goggles_fnc_OnEachFrame;"] call BIS_fnc_addStackedEventHandler; + * + * Public: No + */ #include "script_component.hpp" if (isNull(ace_player)) exitWith {}; GVAR(FrameEvent) set [0, !(GVAR(FrameEvent) select 0)]; @@ -44,7 +42,7 @@ if ((headgear ace_player) != "") then { _safe = (getNumber (ConfigFile >> "CfgWeapons" >> (headgear ace_player) >> "ACE_Protection") == 1); }; if !(_safe) then { - if !(ace_player call FUNC(isGogglesVisible)) exitWith{}; + if !([ace_player] call FUNC(isGogglesVisible)) exitWith{}; if (GETDUSTT(DAMOUNT) < 2) then { if (!GETDUSTT(DACTIVE)) then { SETDUST(DACTIVE,true); diff --git a/addons/goggles/functions/fnc_rainEffect.sqf b/addons/goggles/functions/fnc_rainEffect.sqf index 030e60c149..37ffbf64f6 100644 --- a/addons/goggles/functions/fnc_rainEffect.sqf +++ b/addons/goggles/functions/fnc_rainEffect.sqf @@ -1,20 +1,18 @@ /* - fnc_rainEffect.sqf - - Author: Garth de Wet (LH) - - Description: - - - Parameters: - Nothing - - Returns: - Nothing - - Example: - [] call FUNC(RainEffect); -*/ + * Author: Garth 'L-H' de Wet + * Handles rain effects being created on glasses. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_rainEffect; + * + * Public: No + */ #include "script_component.hpp" private ["_fnc_underCover"]; if (isNull(ace_player) || {!(alive ace_player)}) exitWith {}; diff --git a/addons/goggles/functions/fnc_removeDirtEffect.sqf b/addons/goggles/functions/fnc_removeDirtEffect.sqf index 5b58fad834..20812d6140 100644 --- a/addons/goggles/functions/fnc_removeDirtEffect.sqf +++ b/addons/goggles/functions/fnc_removeDirtEffect.sqf @@ -1,20 +1,18 @@ /* - fnc_removeDirtEffect.sqf - - Author: Garth de Wet (LH) - - Description: - Removes dirt from the glasses. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call FUNC(RemoveDirtEffect); -*/ + * Author: Garth 'L-H' de Wet + * Removes dirt from the glasses. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_removeDirtEffect; + * + * Public: Yes + */ #include "script_component.hpp" if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then { (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText ""; diff --git a/addons/goggles/functions/fnc_removeDustEffect.sqf b/addons/goggles/functions/fnc_removeDustEffect.sqf index c937fe2bd1..7bd4be7c22 100644 --- a/addons/goggles/functions/fnc_removeDustEffect.sqf +++ b/addons/goggles/functions/fnc_removeDustEffect.sqf @@ -1,20 +1,18 @@ /* - fnc_removeDustEffect.sqf - - Author: Garth de Wet (LH) - - Description: - Removes dust from the glasses. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call FUNC(RemoveDustEffect); -*/ + * Author: Garth 'L-H' de Wet + * Removes dust from the glasses. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_removeDustEffect; + * + * Public: Yes + */ #include "script_component.hpp" if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then { (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10662) ctrlSetText ""; diff --git a/addons/goggles/functions/fnc_removeGlassesEffect.sqf b/addons/goggles/functions/fnc_removeGlassesEffect.sqf index dc7bbee45e..f409f3c16e 100644 --- a/addons/goggles/functions/fnc_removeGlassesEffect.sqf +++ b/addons/goggles/functions/fnc_removeGlassesEffect.sqf @@ -1,21 +1,19 @@ /* - RemoveGlassesEffect - - Author: Garth de Wet (LH) - - Description: - Removes the glasses effect from the screen, removes dirt effect, removes rain effect, - removes dust effect. Does not reset array (glasses will still be broken, dirty, ect.) - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call FUNC(RemoveGlassesEffect); -*/ + * Author: Garth 'L-H' de Wet + * Removes the glasses effect from the screen, removes dirt effect, removes rain effect, + * removes dust effect. Does not reset array (glasses will still be broken, dirty, ect.) + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_removeGlassesEffect; + * + * Public: Yes + */ #include "script_component.hpp" GVAR(EffectsActive) = false; GVAR(PostProcess) ppEffectEnable false; diff --git a/addons/goggles/functions/fnc_removeRainEffect.sqf b/addons/goggles/functions/fnc_removeRainEffect.sqf index bcef82dc81..fbbf1b9b7b 100644 --- a/addons/goggles/functions/fnc_removeRainEffect.sqf +++ b/addons/goggles/functions/fnc_removeRainEffect.sqf @@ -1,20 +1,18 @@ /* - RemoveRainEffect - - Author: Garth de Wet (LH) - - Description: - Removes rain effects from the screen. Resets the rain array. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call FUNC(RemoveRainEffect); -*/ + * Author: Garth 'L-H' de Wet + * Removes rain effects from the screen. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_removeRainEffect; + * + * Public: Yes + */ #include "script_component.hpp" if (!isNull (GVAR(RainDrops))) then { deleteVehicle (GVAR(RainDrops)); diff --git a/addons/grenades/CfgAmmo.hpp b/addons/grenades/CfgAmmo.hpp index 7b0a24740d..0f86230784 100644 --- a/addons/grenades/CfgAmmo.hpp +++ b/addons/grenades/CfgAmmo.hpp @@ -1,89 +1,89 @@ class CfgAmmo { - class FlareCore; - class FlareBase: FlareCore { - intensity = 20000; - flareSize = 12; - }; - class F_40mm_White: FlareBase { - intensity = 40000; - flareSize = 12; - }; - class F_20mm_White: FlareBase { - intensity = 20000; - flareSize = 12; - }; - class F_Signal_Green: FlareBase { - intensity = 20000; - flareSize = 12; - }; - class Flare_82mm_AMOS_White: FlareCore { - intensity = 80000; - flareSize = 12; - }; + class FlareCore; + class FlareBase: FlareCore { + intensity = 20000; + flareSize = 12; + }; + class F_40mm_White: FlareBase { + intensity = 40000; + flareSize = 12; + }; + class F_20mm_White: FlareBase { + intensity = 20000; + flareSize = 12; + }; + class F_Signal_Green: FlareBase { + intensity = 20000; + flareSize = 12; + }; + class Flare_82mm_AMOS_White: FlareCore { + intensity = 80000; + flareSize = 12; + }; - class F_20mm_Red: F_20mm_White {}; - class F_20mm_Green: F_20mm_White {}; - class F_20mm_Yellow: F_20mm_White {}; + class F_20mm_Red: F_20mm_White {}; + class F_20mm_Green: F_20mm_White {}; + class F_20mm_Yellow: F_20mm_White {}; - class ACE_F_Hand_White: F_20mm_White { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class ACE_F_Hand_Red: F_20mm_Red { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class ACE_F_Hand_Green: F_20mm_Green { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class ACE_F_Hand_Yellow: F_20mm_Yellow { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; + class ACE_F_Hand_White: F_20mm_White { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + class ACE_F_Hand_Red: F_20mm_Red { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + class ACE_F_Hand_Green: F_20mm_Green { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + class ACE_F_Hand_Yellow: F_20mm_Yellow { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; - class ACE_G_M84: F_20mm_Yellow { - useFlare = 0; - flareSize = 0; - intensity = 0; - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - fuseDistance = 2.3; - model = PATHTOF(models\ACE_m84_thrown.p3d); - }; + class ACE_G_M84: F_20mm_Yellow { + useFlare = 0; + flareSize = 0; + intensity = 0; + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + fuseDistance = 2.3; + model = PATHTOF(models\ACE_m84_thrown.p3d); + }; }; diff --git a/addons/grenades/CfgEventHandlers.hpp b/addons/grenades/CfgEventHandlers.hpp index 02f1ac5553..2587bdf86f 100644 --- a/addons/grenades/CfgEventHandlers.hpp +++ b/addons/grenades/CfgEventHandlers.hpp @@ -1,19 +1,19 @@ class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); - }; + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; }; class Extended_PostInit_EventHandlers { - class ADDON { - clientInit = QUOTE( call COMPILE_FILE(XEH_postInitClient) ); - }; + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + }; }; class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) ); + class CAManBase { + class ADDON { + clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) ); + }; }; - }; }; diff --git a/addons/grenades/CfgMagazines.hpp b/addons/grenades/CfgMagazines.hpp index 5775302d2c..33392f41ee 100644 --- a/addons/grenades/CfgMagazines.hpp +++ b/addons/grenades/CfgMagazines.hpp @@ -1,60 +1,60 @@ class CfgMagazines { - class HandGrenade; - class ACE_HandFlare_Base: HandGrenade { - value = 2; - nameSoundWeapon = "smokeshell"; - nameSound = "smokeshell"; - mass = 4; - initSpeed = 22; - }; - class ACE_HandFlare_White: ACE_HandFlare_Base { - ammo = "ACE_F_Hand_White"; - displayname = "$STR_ACE_Grenades_M127A1_White_Name"; - descriptionshort = "$STR_ACE_Grenades_M127A1_White_Description"; - displayNameShort = "$STR_ACE_Grenades_M127A1_White_NameShort"; - model = "\A3\weapons_f\ammo\flare_white"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; - }; - class ACE_HandFlare_Red: ACE_HandFlare_Base { - ammo = "ACE_F_Hand_Red"; - displayname = "$STR_ACE_Grenades_M127A1_Red_Name"; - descriptionshort = "$STR_ACE_Grenades_M127A1_Red_Description"; - displayNameShort = "$STR_ACE_Grenades_M127A1_Red_NameShort"; - model = "\A3\weapons_f\ammo\flare_red"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; - }; - class ACE_HandFlare_Green: ACE_HandFlare_Base { - ammo = "ACE_F_Hand_Green"; - displayname = "$STR_ACE_Grenades_M127A1_Green_Name"; - descriptionshort = "$STR_ACE_Grenades_M127A1_Green_Description"; - displayNameShort = "$STR_ACE_Grenades_M127A1_Green_NameShort"; - model = "\A3\weapons_f\ammo\flare_green"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; - }; - class ACE_HandFlare_Yellow: ACE_HandFlare_Base { - ammo = "ACE_F_Hand_Yellow"; - displayname = "$STR_ACE_Grenades_M127A1_Yellow_Name"; - descriptionshort = "$STR_ACE_Grenades_M127A1_Yellow_Description"; - displayNameShort = "$STR_ACE_Grenades_M127A1_Yellow_NameShort"; - model = "\A3\weapons_f\ammo\flare_yellow"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; - }; - class ACE_M84: HandGrenade { - ammo = "ACE_G_M84"; - displayname = "$STR_ACE_Grenades_M84_Name"; - descriptionshort = "$STR_ACE_Grenades_M84_Description"; - displayNameShort = "M84"; - model = PATHTOF(models\ACE_m84.p3d); - picture = PATHTOF(UI\ACE_m84_x_ca.paa); - }; + class HandGrenade; + class ACE_HandFlare_Base: HandGrenade { + value = 2; + nameSoundWeapon = "smokeshell"; + nameSound = "smokeshell"; + mass = 4; + initSpeed = 22; + }; + class ACE_HandFlare_White: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_White"; + displayname = "$STR_ACE_Grenades_M127A1_White_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_White_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_White_NameShort"; + model = "\A3\weapons_f\ammo\flare_white"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; + }; + class ACE_HandFlare_Red: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_Red"; + displayname = "$STR_ACE_Grenades_M127A1_Red_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_Red_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_Red_NameShort"; + model = "\A3\weapons_f\ammo\flare_red"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; + }; + class ACE_HandFlare_Green: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_Green"; + displayname = "$STR_ACE_Grenades_M127A1_Green_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_Green_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_Green_NameShort"; + model = "\A3\weapons_f\ammo\flare_green"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; + }; + class ACE_HandFlare_Yellow: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_Yellow"; + displayname = "$STR_ACE_Grenades_M127A1_Yellow_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_Yellow_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_Yellow_NameShort"; + model = "\A3\weapons_f\ammo\flare_yellow"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; + }; + class ACE_M84: HandGrenade { + ammo = "ACE_G_M84"; + displayname = "$STR_ACE_Grenades_M84_Name"; + descriptionshort = "$STR_ACE_Grenades_M84_Description"; + displayNameShort = "M84"; + model = PATHTOF(models\ACE_m84.p3d); + picture = PATHTOF(UI\ACE_m84_x_ca.paa); + }; - class 3Rnd_UGL_FlareGreen_F; - class 6Rnd_GreenSignal_F: 3Rnd_UGL_FlareGreen_F { - ammo = "F_40mm_Green"; - initSpeed = 120; - }; - class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F { - ammo = "F_40mm_Red"; - initSpeed = 120; - }; + class 3Rnd_UGL_FlareGreen_F; + class 6Rnd_GreenSignal_F: 3Rnd_UGL_FlareGreen_F { + ammo = "F_40mm_Green"; + initSpeed = 120; + }; + class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F { + ammo = "F_40mm_Red"; + initSpeed = 120; + }; }; diff --git a/addons/grenades/CfgVehicles.hpp b/addons/grenades/CfgVehicles.hpp index 9a0164e24f..d4ff039bf7 100644 --- a/addons/grenades/CfgVehicles.hpp +++ b/addons/grenades/CfgVehicles.hpp @@ -1,45 +1,45 @@ #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; + name = #ITEM; \ + count = COUNT; \ + }; class CfgVehicles { - class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class Box_NATO_Support_F; + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class Box_NATO_Support_F; - class Box_NATO_Grenades_F: NATO_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_HandFlare_White,12) - MACRO_ADDITEM(ACE_HandFlare_Green,12) - MACRO_ADDITEM(ACE_M84,12) + class Box_NATO_Grenades_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_White,12) + MACRO_ADDITEM(ACE_HandFlare_Green,12) + MACRO_ADDITEM(ACE_M84,12) + }; }; - }; - class Box_East_Grenades_F: EAST_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_HandFlare_Yellow,12) - MACRO_ADDITEM(ACE_HandFlare_Red,12) - MACRO_ADDITEM(ACE_M84,12) + class Box_East_Grenades_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_Yellow,12) + MACRO_ADDITEM(ACE_HandFlare_Red,12) + MACRO_ADDITEM(ACE_M84,12) + }; }; - }; - class Box_IND_Grenades_F: IND_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_HandFlare_Yellow,12) - MACRO_ADDITEM(ACE_HandFlare_Green,12) - MACRO_ADDITEM(ACE_M84,12) + class Box_IND_Grenades_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_Yellow,12) + MACRO_ADDITEM(ACE_HandFlare_Green,12) + MACRO_ADDITEM(ACE_M84,12) + }; }; - }; - class ACE_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(ACE_HandFlare_White,12) - MACRO_ADDITEM(ACE_HandFlare_Red,12) - MACRO_ADDITEM(ACE_HandFlare_Green,12) - MACRO_ADDITEM(ACE_HandFlare_Yellow,12) - MACRO_ADDITEM(ACE_M84,12) + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_White,12) + MACRO_ADDITEM(ACE_HandFlare_Red,12) + MACRO_ADDITEM(ACE_HandFlare_Green,12) + MACRO_ADDITEM(ACE_HandFlare_Yellow,12) + MACRO_ADDITEM(ACE_M84,12) + }; }; - }; }; diff --git a/addons/grenades/CfgWeapons.hpp b/addons/grenades/CfgWeapons.hpp index fa28ca4ef0..4edc6e6d12 100644 --- a/addons/grenades/CfgWeapons.hpp +++ b/addons/grenades/CfgWeapons.hpp @@ -1,23 +1,23 @@ class CfgWeapons { - class GrenadeLauncher; + class GrenadeLauncher; - class Throw: GrenadeLauncher { - muzzles[] += {"ACE_HandFlare_WhiteMuzzle", "ACE_HandFlare_RedMuzzle", "ACE_HandFlare_GreenMuzzle", "ACE_HandFlare_YellowMuzzle", "ACE_M84Muzzle"}; - class ThrowMuzzle; - class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle { - magazines[] = {"ACE_HandFlare_White"}; + class Throw: GrenadeLauncher { + muzzles[] += {"ACE_HandFlare_WhiteMuzzle", "ACE_HandFlare_RedMuzzle", "ACE_HandFlare_GreenMuzzle", "ACE_HandFlare_YellowMuzzle", "ACE_M84Muzzle"}; + class ThrowMuzzle; + class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_White"}; + }; + class ACE_HandFlare_RedMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_Red"}; + }; + class ACE_HandFlare_GreenMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_Green"}; + }; + class ACE_HandFlare_YellowMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_Yellow"}; + }; + class ACE_M84Muzzle: ThrowMuzzle { + magazines[] = {"ACE_M84"}; + }; }; - class ACE_HandFlare_RedMuzzle: ThrowMuzzle { - magazines[] = {"ACE_HandFlare_Red"}; - }; - class ACE_HandFlare_GreenMuzzle: ThrowMuzzle { - magazines[] = {"ACE_HandFlare_Green"}; - }; - class ACE_HandFlare_YellowMuzzle: ThrowMuzzle { - magazines[] = {"ACE_HandFlare_Yellow"}; - }; - class ACE_M84Muzzle: ThrowMuzzle { - magazines[] = {"ACE_M84"}; - }; - }; }; diff --git a/addons/grenades/XEH_postInit.sqf b/addons/grenades/XEH_postInit.sqf new file mode 100644 index 0000000000..0b6bb16ffb --- /dev/null +++ b/addons/grenades/XEH_postInit.sqf @@ -0,0 +1,28 @@ +// by commy2 + +#include "script_component.hpp" + +["flashbangExplosion", {_this call FUNC(flashbangExplosionEH)}] call EFUNC(common,addEventHandler); + +if !(hasInterface) exitWith {}; + +GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265]; +GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; + +// Add keybinds +["ACE3", + localize "STR_ACE_Grenades_SwitchGrenadeMode", + { + // Conditions: canInteract + _exceptions = [QEGVAR(captives,isNotEscorting)]; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false}; + + // Statement + [] call FUNC(nextMode); + }, + [9, [false, false, false]], //8 key + false, + "keydown" +] call cba_fnc_registerKeybind; diff --git a/addons/grenades/XEH_postInitClient.sqf b/addons/grenades/XEH_postInitClient.sqf deleted file mode 100644 index 5f5b569050..0000000000 --- a/addons/grenades/XEH_postInitClient.sqf +++ /dev/null @@ -1,13 +0,0 @@ -// by commy2 - -#include "script_component.hpp" - -GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265]; -GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; - -["ACE3", -localize "STR_ACE_Grenades_SwitchGrenadeMode", -{_this call FUNC(nextMode)}, -[9, [false, false, false]], //8 key -false, -"keydown"] call cba_fnc_registerKeybind; diff --git a/addons/grenades/XEH_preInit.sqf b/addons/grenades/XEH_preInit.sqf index e83aeaae6b..0df2e235fd 100644 --- a/addons/grenades/XEH_preInit.sqf +++ b/addons/grenades/XEH_preInit.sqf @@ -1,9 +1,10 @@ #include "script_component.hpp" -PREP(flashbangEffectStages); +ADDON = false; + PREP(flashbangExplosionEH); PREP(flashbangThrownFuze); PREP(nextMode); PREP(throwGrenade); -["flashbangExplosion", { _this call DFUNC(flashbangExplosionEH) }] call EFUNC(common,addEventHandler); +ADDON = true; diff --git a/addons/grenades/config.cpp b/addons/grenades/config.cpp index 74d1038ecc..c2a899d66c 100644 --- a/addons/grenades/config.cpp +++ b/addons/grenades/config.cpp @@ -1,15 +1,15 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi"}; - authorUrl = "https://github.com/commy2/"; - VERSION_CONFIG; - }; + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"commy2", "KoffeinFlummi"}; + authorUrl = "https://github.com/commy2/"; + VERSION_CONFIG; + }; }; #include "CfgEventHandlers.hpp" diff --git a/addons/grenades/functions/fnc_flashbangEffectStages.sqf b/addons/grenades/functions/fnc_flashbangEffectStages.sqf deleted file mode 100644 index c2ee7a6841..0000000000 --- a/addons/grenades/functions/fnc_flashbangEffectStages.sqf +++ /dev/null @@ -1,57 +0,0 @@ -/* -* Author: KoffeinFlummi, Pabst Mirror -* -* Handles the different stages of the flash bang effect recovery -* -* Arguments: -* ARRAY[ -* 0-ARRAY - PARAMS: -* 0: NUMBER - Stage, controls a case statement -* 1: NUMBER - Time To Wait Until -* 2: VARIES - Stage's Variable -* 1-NUMBER perFrame handle -* Return Value: -* None -*/ - -#include "script_component.hpp" - -private ["_stage", "_waitUntilTime"]; - -_stage = (_this select 0) select 0; -_waitUntilTime = (_this select 0) select 1; - -if (_waitUntilTime > time) exitWith {}; - -//remove frameEH -[(_this select 1)] call cba_fnc_removePerFrameHandler; - -switch (_stage) do { - case(EFFECT_STAGE_RESETAI): { - private "_unit"; - _unit = (_this select 0) select 2; - _unit enableAI "MOVE"; - _unit enableAI "ANIM"; - _unit enableAI "AUTOTARGET"; - _unit enableAI "TARGET"; - _unit enableAI "FSM"; - _unit setSkill (skill _unit * 50); - }; - case(EFFECT_STAGE_DELETELIGHT): { - private "_light"; - _light = (_this select 0) select 2; - deleteVehicle _light; - }; - case(EFFECT_STAGE_PARTIALRECOVERY): { - private "_strength"; - _strength = (_this select 0) select 2; - GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; - GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength); - }; - case(EFFECT_STAGE_FULLRECOVERY): { - GVAR(flashbangPPEffectCC) ppEffectEnable false; - }; - default { - TRACE_1("EffectStage Bad Stage", _stage); - }; -}; diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index 1ef7ea1484..3868994bee 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -1,85 +1,109 @@ /* -* Author: KoffeinFlummi -* -* Creates the flashbang effect and knock out AI units. -* -* Arguments: -* 0: The grenade (Object) -* -* Return Value: -* None -*/ - + * Author: KoffeinFlummi + * Creates the flashbang effect and knock out AI units. + * + * Arguments: + * 0: The grenade + * + * Return Value: + * Nothing + * + * Example: + * [theGrenade] call ace_grenades_fnc_flashbangExplosionEH + * + * Public: No + */ #include "script_component.hpp" -private ["_grenade", "_affected", "_strength", "_posGrenade", "_posUnit", "_angleGrenade", "_angleView", "_angleDiff", "_light"]; +private ["_affected", "_strength", "_posGrenade", "_posUnit", "_angleGrenade", "_angleView", "_angleDiff", "_light"]; -_grenade = _this select 0; +PARAMS_1(_grenade); _affected = _grenade nearEntities ["CAManBase", 50]; { - if ((local _x) && {alive _x}) then { + if ((local _x) && {alive _x}) then { - _strength = 1 - ((_x distance _grenade) min 15) / 15; + _strength = 1 - ((_x distance _grenade) min 15) / 15; - if (_x != ACE_player) then { - //must be AI - _x disableAI "MOVE"; - _x disableAI "ANIM"; - _x disableAI "AUTOTARGET"; - _x disableAI "TARGET"; - _x disableAI "FSM"; - _x setSkill ((skill _x) / 50); + if (_x != ACE_player) then { + //must be AI + _x disableAI "MOVE"; + _x disableAI "ANIM"; + _x disableAI "AUTOTARGET"; + _x disableAI "TARGET"; + _x disableAI "FSM"; + _x setSkill ((skill _x) / 50); - [FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_RESETAI, (time + (7 * _strength)), _x]] call CBA_fnc_addPerFrameHandler; - } else { - //Do effects for player - // is there line of sight to the grenade? - _posGrenade = getPosASL _grenade; - _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground - if (lineIntersects [_posGrenade, getPosASL _x, _grenade, _x]) then { - _strength = _strength / 10; - }; + [{ + PARAMS_1(_unit); + _unit enableAI "MOVE"; + _unit enableAI "ANIM"; + _unit enableAI "AUTOTARGET"; + _unit enableAI "TARGET"; + _unit enableAI "FSM"; + _unit setSkill (skill _unit * 50); + }, [_x], (7 * _strength), 0.1] call EFUNC(common,waitAndExecute); //0.1 precision is fine for AI + } else { + //Do effects for player + // is there line of sight to the grenade? + _posGrenade = getPosASL _grenade; + _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground + if (lineIntersects [_posGrenade, getPosASL _x, _grenade, _x]) then { + _strength = _strength / 10; + }; - // beeeeeeeeeeeeeeeeeeeeeeeeeeeeep - if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then { - [_x, 0.5 + (_strength / 2)] call EFUNC(hearing,earRinging); - }; + // beeeeeeeeeeeeeeeeeeeeeeeeeeeeep + if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then { + [_x, 0.5 + (_strength / 2)] call EFUNC(hearing,earRinging); + }; - // account for people looking away by slightly - // reducing the effect for visual effects. - _posUnit = getPos _x; - _posGrenade = getPos _grenade; - _angleGrenade = ((_posGrenade select 0) - (_posUnit select 0)) atan2 ((_posGrenade select 1) - (_posUnit select 1)); - _angleGrenade = (_angleGrenade + 360) % 360; + // account for people looking away by slightly + // reducing the effect for visual effects. + _posUnit = getPos _x; + _posGrenade = getPos _grenade; + _angleGrenade = ((_posGrenade select 0) - (_posUnit select 0)) atan2 ((_posGrenade select 1) - (_posUnit select 1)); + _angleGrenade = (_angleGrenade + 360) % 360; - _angleView = (eyeDirection player select 0) atan2 (eyeDirection player select 1); - _angleView = (_angleView + 360) % 360; + _angleView = (eyeDirection ACE_player select 0) atan2 (eyeDirection ACE_player select 1); + _angleView = (_angleView + 360) % 360; - _angleDiff = 180 - abs (abs (_angleGrenade - _angleView) - 180); - _angleDiff = ((_angleDiff - 45) max 0); + _angleDiff = 180 - abs (abs (_angleGrenade - _angleView) - 180); + _angleDiff = ((_angleDiff - 45) max 0); - _strength = _strength - _strength * (_angleDiff / 135); + _strength = _strength - _strength * (_angleDiff / 135); - // create flash to illuminate environment - _light = "#lightpoint" createVehicleLocal getPos _grenade; - _light setLightBrightness 200; - _light setLightAmbient [1,1,1]; - _light setLightColor [1,1,1]; - _light setLightDayLight true; + // create flash to illuminate environment + _light = "#lightpoint" createVehicleLocal (getPos _grenade); + _light setLightBrightness 200; + _light setLightAmbient [1,1,1]; + _light setLightColor [1,1,1]; + _light setLightDayLight true; - [FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_DELETELIGHT, (time + (0.1)), _light]] call CBA_fnc_addPerFrameHandler; + //Delete the light after 0.1 seconds + [{ + PARAMS_1(_light); + deleteVehicle _light; + }, [_light], 0.1, 0] call EFUNC(common,waitAndExecute); - // blind player - if (_strength > 0.1) then { - GVAR(flashbangPPEffectCC) ppEffectEnable true; - GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; - GVAR(flashbangPPEffectCC) ppEffectCommit 0.01; + // blind player + if (_strength > 0.1) then { + GVAR(flashbangPPEffectCC) ppEffectEnable true; + GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; + GVAR(flashbangPPEffectCC) ppEffectCommit 0.01; - [FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_PARTIALRECOVERY, (time + (7 * _strength)), _strength]] call CBA_fnc_addPerFrameHandler; - [FUNC(flashbangEffectStages), 0, [ EFFECT_STAGE_FULLRECOVERY, (time + (17 * _strength))]] call CBA_fnc_addPerFrameHandler; - }; + //PARTIALRECOVERY - start decreasing effect over time + [{ + PARAMS_1(_strength); + GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; + GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength); + }, [_strength], (7 * _strength), 0] call EFUNC(common,waitAndExecute); + + //FULLRECOVERY - end effect + [{ + GVAR(flashbangPPEffectCC) ppEffectEnable false; + }, [], (17 * _strength), 0] call EFUNC(common,waitAndExecute); + }; + }; }; - }; } forEach _affected; diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index aec10301ab..a83c81e660 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -1,18 +1,25 @@ -//Waits for the grenade fuze to trigger and 'explode' - +/* + * Author: commy2 + * Waits for the flashbang grenade fuze to trigger and 'explode' + * + * Arguments: + * 0: projectile - Flashbang Grenade + * + * Return Value: + * Nothing + * + * Example: + * [theFlashbang] call ace_grenades_fnc_flashbangThrownFuze + * + * Public: No + */ #include "script_component.hpp" -_projectile = (_this select 0) select 0; -_waitUntilTime = (_this select 0) select 1; - -if (_waitUntilTime > time) exitWith {}; - -//remove frameEH -[(_this select 1)] call cba_fnc_removePerFrameHandler; +PARAMS_1(_projectile); if (alive _projectile) then { - playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; - - _affected = _projectile nearEntities ["CAManBase", 50]; - ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); + playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; + + _affected = _projectile nearEntities ["CAManBase", 50]; + ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); }; diff --git a/addons/grenades/functions/fnc_nextMode.sqf b/addons/grenades/functions/fnc_nextMode.sqf index da8392b6ab..7663e790f6 100644 --- a/addons/grenades/functions/fnc_nextMode.sqf +++ b/addons/grenades/functions/fnc_nextMode.sqf @@ -1,40 +1,41 @@ /* * Author: commy2 - * * Select the next throwing mode and display message. - * - * Argument: - * Nothing - * - * Return value: + * + * Arguments: * Nothing + * + * Return Value: + * Handeled + * + * Example: + * [] call ace_grenades_fnc_nextMode + * + * Public: No */ - #include "script_component.hpp" - -private ["_mode", "_hint"]; -if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false}; +private ["_mode", "_hint"]; _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode == 4) then { - _mode = 0; + _mode = 0; } else { - _mode = _mode + 1; + _mode = _mode + 1; }; // ROLL GRENADE DOESN'T WORK RIGHT NOW if (_mode == 3) then { - _mode = 4; + _mode = 4; }; _hint = [ - localize "STR_ACE_Grenades_NormalThrow", - localize "STR_ACE_Grenades_HighThrow", - localize "STR_ACE_Grenades_PreciseThrow", - localize "STR_ACE_Grenades_RollGrenade", - localize "STR_ACE_Grenades_DropGrenade" +localize "STR_ACE_Grenades_NormalThrow", +localize "STR_ACE_Grenades_HighThrow", +localize "STR_ACE_Grenades_PreciseThrow", +localize "STR_ACE_Grenades_RollGrenade", +localize "STR_ACE_Grenades_DropGrenade" ] select _mode; [_hint] call EFUNC(common,displayTextStructured); diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index e725ebd426..c7bc09a261 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -1,15 +1,24 @@ /* -* Author: commy2 -* -* Adjust the grenades throwing direction and speed to the selected throwing mode. -* -* Argument: -* input from "Fired" eventhandler -* -* Return value: -* Nothing -*/ - + * Author: commy2 + * Adjust the grenades throwing direction and speed to the selected throwing mode. + * + * Arguments: + * 0: unit - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot + * + * Return Value: + * Nothing + * + * Example: + * [clientFiredBIS-XEH] call ace_grenades_fnc_throwGrenade + * + * Public: No + */ #include "script_component.hpp" private ["_unit", "_weapon", "_projectile", "_mode", "_fuzeTime"]; @@ -24,38 +33,38 @@ if (_weapon != "Throw") exitWith {}; _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode != 0) then { - private "_velocity"; + private "_velocity"; - _velocity = velocity _projectile; + _velocity = velocity _projectile; - switch (_mode) do { - //high throw - case 1 : { - _velocity = [ - 0.5 * (_velocity select 0), - 0.5 * (_velocity select 1), - [0, 0, 0] distance (_velocity vectorMultiply 0.5) - ]; + switch (_mode) do { + //high throw + case 1 : { + _velocity = [ + 0.5 * (_velocity select 0), + 0.5 * (_velocity select 1), + [0, 0, 0] distance (_velocity vectorMultiply 0.5) + ]; + }; + //precise throw + case 2 : { + _velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity); + }; + //roll grande + case 3 : { + //@todo + }; + //drop grenade + case 4 : { + _velocity = [0, 0, 0]; + }; }; - //precise throw - case 2 : { - _velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity); - }; - //roll grande - case 3 : { - //@todo - }; - //drop grenade - case 4 : { - _velocity = [0, 0, 0]; - }; - }; - _projectile setVelocity _velocity; + _projectile setVelocity _velocity; }; if (typeOf _projectile == "ACE_G_M84") then { - _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance"); - // _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance - [FUNC(flashbangThrownFuze), 0, [_projectile, (time + _fuzeTime)]] call CBA_fnc_addPerFrameHandler; + _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance"); + // _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance + [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute); }; diff --git a/addons/gui/CfgEventHandlers.hpp b/addons/gui/CfgEventHandlers.hpp deleted file mode 100644 index c9142e676b..0000000000 --- a/addons/gui/CfgEventHandlers.hpp +++ /dev/null @@ -1,11 +0,0 @@ -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE( call compile preprocessFileLineNumbers QUOTE(QUOTE(PATHTOF(XEH_preInit.sqf))) ); - }; -}; - -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE( call compile preprocessFileLineNumbers QUOTE(QUOTE(PATHTOF(XEH_postInit.sqf))) ); - }; -}; \ No newline at end of file diff --git a/addons/gui/GUI.hpp b/addons/gui/GUI.hpp deleted file mode 100644 index 71e8dc0090..0000000000 --- a/addons/gui/GUI.hpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "UI\define.hpp" -#include "UI\RscTitles.hpp" diff --git a/addons/gui/UI/RscTitles.hpp b/addons/gui/UI/RscTitles.hpp deleted file mode 100644 index 02e68e8d32..0000000000 --- a/addons/gui/UI/RscTitles.hpp +++ /dev/null @@ -1,179 +0,0 @@ - -#define RIGHT_SIDE (safezoneW + safezoneX) -#define LEFT_SIDE safezoneX -#define TOP_SIDE safeZoneY -#define BOTTOM_SIDE (safeZoneH + safezoneY) - -#define ICON_WIDTH (1.75 * (((safezoneW / safezoneH) min 1.2) / 40)) -#define X_POS_ICONS RIGHT_SIDE - (1.1 * ICON_WIDTH) -#define Y_POS_ICONS TOP_SIDE + (2.2 * ICON_WIDTH) -#define DIFFERENCE_ICONS (1.1 * ICON_WIDTH) - -class RscTitles { - class GVAR(iconsDisplay) { - duration = 1e+011; - idd = 1111; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(iconsDisplay)), _this select 0)]); - class controlsBackground { - class icon_1: ACE_gui_backgroundBase { - text = ""; - colorText[] = {0.0,1.0,0.0,0.4}; - idc = 10501; - x = X_POS_ICONS; - y = Y_POS_ICONS + (0 * DIFFERENCE_ICONS); - w = ICON_WIDTH; - h = ICON_WIDTH; - }; - class icon_2: icon_1 { - idc = 10502; - y = Y_POS_ICONS + (1 * DIFFERENCE_ICONS); - }; - class icon_3: icon_1 { - idc = 10503; - y = Y_POS_ICONS + (2 * DIFFERENCE_ICONS); - }; - class icon_4: icon_1 { - idc = 10504; - y = Y_POS_ICONS + (3 * DIFFERENCE_ICONS); - }; - class icon_5: icon_1 { - idc = 10505; - y = Y_POS_ICONS + (4 * DIFFERENCE_ICONS); - }; - class icon_6: icon_1 { - idc = 10506; - y = Y_POS_ICONS + (5 * DIFFERENCE_ICONS); - }; - }; - }; - - class GVAR(RSC_PROGRESSBAR_LOADING) { - idd = -1; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RSC_PROGRESSBAR_LOADING)), _this select 0)]); - fadein = 0; - fadeout = 0; - duration = 10e10; - class Controls { - class background: ACE_gui_backgroundBase { - idc = -1; - colorBackground[] = {0,0,0,1}; - colorText[] = {1, 1, 1, 1}; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "0.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - text = "#(argb,8,8,3)color(0,0,0,0.4)"; - }; - - class Progress: ACE_gui_RscProgress { - idc = 6; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "0.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorFrame[] = {0,0,0,0}; - colorBar[] = {0.27,0.5,0.31,0.6}; - texture = "#(argb,8,8,3)color(1,1,1,0.7)"; - }; - }; - }; - - - class GVAR(RSC_DISPLAY_MESSAGE) { - duration = 7; - idd = 86411; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RSC_DISPLAY_MESSAGE)), _this select 0)]); - fadein = 0; - class controlsBackground { - class header: ACE_gui_staticBase { - idc = 1; - type = CT_STATIC; - x = "safezoneX + (safezoneW / 10)"; - y = "safezoneY + (30 * (safeZoneH / 40))"; - w = "(safeZoneW / 10)"; - h = "(safeZoneH / 40)"; - style = ST_LEFT; - font = FontCSE; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - colorText[] = {0.85, 0.85, 0.85, 1.0}; - colorBackground[] = {0, 0, 0, 0.9}; - text = ""; - }; - class text: header { - idc = 2; - y = "safezoneY + (31 * (safeZoneH / 40))"; - w = "(safeZoneW / 10) * 1.3"; - colorText[] = {0.0, 0.0, 0.0, 1.0}; - colorBackground[] = {1, 1, 1, 0.9}; - text = ""; - }; - }; - }; - - class GVAR(RSC_DISPLAY_INFORMATION) { - duration = 15; - idd = 86412; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RSC_DISPLAY_INFORMATION)), _this select 0)]); - fadein = 0; - class controlsBackground { - class header: ACE_gui_staticBase { - idc = 1; - type = CT_STATIC; - x = "safezoneX + (safezoneW / 10)"; - y = "safezoneY + (6 * (safeZoneH / 40))"; - w = "(safeZoneW / 10)"; - h = "(safeZoneH / 40)"; - style = ST_LEFT; - font = FontCSE; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - colorText[] = {0.85, 0.85, 0.85, 1.0}; - colorBackground[] = {0, 0, 0, 0.9}; - text = ""; - }; - class text: header { - idc = 2; - y = "safezoneY + (7.1 * (safeZoneH / 40))"; - w = "(safeZoneW / 10) * 1.3"; - colorText[] = {0.0, 0.0, 0.0, 1.0}; - colorBackground[] = {1, 1, 1, 0.9}; - text = ""; - }; - class text2: text { - idc = 3; - y = "safezoneY + (8.2 * (safeZoneH / 40))"; - }; - class text3: text { - idc = 4; - y = "safezoneY + (9.3 * (safeZoneH / 40))"; - }; - class text4: text { - idc = 5; - y = "safezoneY + (10.4 * (safeZoneH / 40))"; - }; - class text5: text { - idc = 6; - y = "safezoneY + (11.5 * (safeZoneH / 40))"; - }; - - - class icon: ACE_gui_backgroundBase { - type = CT_STATIC; - idc = 10; - style = ST_PICTURE; - colorBackground[] = {0,0,0,1}; - colorText[] = {1, 1, 1, 1}; - font = FontCSE; - text = ""; - sizeEx = 0.032; - x = "safezoneX + (safezoneW / 10)"; - y = "safezoneY + (4 * (safeZoneH / 40))"; - w = "(safeZoneH / 40)*2"; - h = "(safeZoneH / 40)*2"; - }; - }; - }; - -}; \ No newline at end of file diff --git a/addons/gui/XEH_preInit.sqf b/addons/gui/XEH_preInit.sqf deleted file mode 100644 index 9c2bcf0909..0000000000 --- a/addons/gui/XEH_preInit.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/** - * XEH_preInit.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -ADDON = false; - -PREP(loadingBar); -PREP(displayInformation); -PREP(displayMessage); -PREP(blurScreen); -PREP(displayIcon); -PREP(sendHintTo); -PREP(sendMessageTo); -PREP(sendDisplayInformationTo); -PREP(sendDisplayMessageTo); - -ADDON = true; \ No newline at end of file diff --git a/addons/gui/config.cpp b/addons/gui/config.cpp deleted file mode 100644 index 2f7666be13..0000000000 --- a/addons/gui/config.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ACE_main"}; - version = VERSION; - author[] = {$STR_ACE_Common_ACETeam}; - authorUrl = "http://csemod.com"; // TODO website link? - }; -}; -class CfgAddons { - class PreloadAddons { - class ADDON { - list[] = {QUOTE(ADDON)}; - }; - }; -}; - -#include "CfgEventHandlers.hpp" - -// TODO Port over the UI defines -#include "GUI.hpp" -#include "empty.hpp" diff --git a/addons/gui/data/buttonDisabled.paa b/addons/gui/data/buttonDisabled.paa deleted file mode 100644 index 2c2a10856b..0000000000 Binary files a/addons/gui/data/buttonDisabled.paa and /dev/null differ diff --git a/addons/gui/data/buttonDisabled_gradient.paa b/addons/gui/data/buttonDisabled_gradient.paa deleted file mode 100644 index 43b1b8d100..0000000000 Binary files a/addons/gui/data/buttonDisabled_gradient.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal.paa b/addons/gui/data/buttonNormal.paa deleted file mode 100644 index 84936d8356..0000000000 Binary files a/addons/gui/data/buttonNormal.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient.paa b/addons/gui/data/buttonNormal_gradient.paa deleted file mode 100644 index 2210f98741..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient2.paa b/addons/gui/data/buttonNormal_gradient2.paa deleted file mode 100644 index cabe6c7fed..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient2.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient3.paa b/addons/gui/data/buttonNormal_gradient3.paa deleted file mode 100644 index 7da9fbcf8a..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient3.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient_top.paa b/addons/gui/data/buttonNormal_gradient_top.paa deleted file mode 100644 index 904e1a62f7..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient_top.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient_top_w.paa b/addons/gui/data/buttonNormal_gradient_top_w.paa deleted file mode 100644 index 23dd190afc..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient_top_w.paa and /dev/null differ diff --git a/addons/gui/empty.hpp b/addons/gui/empty.hpp deleted file mode 100644 index 698784e2c6..0000000000 --- a/addons/gui/empty.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "\z\ace\addons\gui\UI\define.hpp" - -class ACE_common_empty_screen { - idd = 679123; - onLoad = "uiNamespace setVariable [""ACE_common_empty_screen"", _this select 0]"; - onUnload = "if (missionNamespace getvariable [""ACE_common_DISABLE_USER_INPUT_SCREEN"", false)]) then { createDialog ""ACE_common_empty_screen""; }"; - class controlsBackground { - class background : ACE_gui_backgroundBase { - idc = 1; - x = safezoneX; - y = safezoneY; - w = safezoneW; - h = safezoneH; - text = ""; - moving = 0; - }; - }; - - class controls { - }; -}; diff --git a/addons/gui/functions/fnc_displayIcon.sqf b/addons/gui/functions/fnc_displayIcon.sqf deleted file mode 100644 index 98895c6346..0000000000 --- a/addons/gui/functions/fnc_displayIcon.sqf +++ /dev/null @@ -1,79 +0,0 @@ -/** - * fn_gui_displayIcon.sqf - * @Descr: - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: true - * - * @Example ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1]] call ace_gui_fnc_displayIcon; - */ - -#include "script_component.hpp" - -#define MAX_N_ICONS 6 - -private ["_iconId", "_show", "_icon", "_spot", "_idc", "_display","_next_IDC", "_nextText"]; -_iconId = _this select 0; -_show = _this select 1; -_icon = _this select 2; -_color = _this select 3; - -disableSerialization; -_list = missionNamespace getvariable [QGVAR(displayIconList),[]]; -_display = uiNamespace getvariable QGVAR(iconsDisplay); - -if (isNil "_display") then { - // Display the icons - 11401 cutRsc [QGVAR(iconsDisplay),"PLAIN"]; - _display = uiNamespace getvariable QGVAR(iconsDisplay); -}; - -if (_show) then { - if ({(_x select 0 == _iconId)} count _list == 0) then { - _list pushback [_iconId, _icon, _color]; - } else { - { - if (_x select 0 == _iconId) exitwith { - _list set [_foreachIndex, [_iconId, _icon, _color]]; - }; - }foreach _list; - }; - - missionNamespace setvariable [QGVAR(displayIconList), _list]; - - { - if (_x select 0 == _iconId) exitwith { - _idc = 10501 + _foreachIndex; - _ctrl = _display displayCtrl _idc; - _ctrl ctrlsetText _icon; - _ctrl ctrlSetTextColor _color; - }; - }foreach _list; -} else { - if ({(_x select 0 == _iconId)} count _list == 1) then { - _newList = []; - { - if (_x select 0 != _iconId) then { - _newList pushback _x; - }; - }foreach _list; - - missionNamespace setvariable [QGVAR(displayIconList), _newList]; - - for "_i" from 0 to (MAX_N_ICONS - 1) /* step +1 */ do { - _idc = 10501 + _i; - _ctrl = _display displayCtrl _idc; - _ctrl ctrlsetText ""; - _ctrl ctrlSetTextColor [1,1,1,1]; - }; - - { - _idc = 10501 + _foreachIndex; - _ctrl = _display displayCtrl _idc; - _ctrl ctrlsetText (_x select 1); - _ctrl ctrlSetTextColor (_x select 2); - }foreach _newList; - }; -}; diff --git a/addons/gui/functions/fnc_displayInformation.sqf b/addons/gui/functions/fnc_displayInformation.sqf deleted file mode 100644 index c4eb96984b..0000000000 --- a/addons/gui/functions/fnc_displayInformation.sqf +++ /dev/null @@ -1,67 +0,0 @@ -/** - * fn_gui_displayInformation.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -#define DISPLAY_LAYER 32547 - -private["_title", "_content","_type","_display","_headerCtrl","_contentCtrl","_contentAmountOfChars","_pos","_icon","_iconCtrl"]; -_title = [_this, 0, "",[""]] call BIS_fnc_Param; -_content = [_this, 1, [""],[[""]]] call BIS_fnc_Param; -_type = [_this, 2, 0, [0]] call BIS_fnc_Param; -_icon = [_this, 3, "",[""]] call BIS_fnc_Param; - -if (_title != "") then { - DISPLAY_LAYER cutRsc [QGVAR(RSC_DISPLAY_INFORMATION),"PLAIN"]; - - disableSerialization; - _display = uiNamespace getvariable QGVAR(RSC_DISPLAY_INFORMATION); - if (!isnil "_display") then { - _headerCtrl = _display displayCtrl 1; - _headerCtrl ctrlSetText _title; - _iconCtrl = _display displayCtrl 10; - _iconCtrl ctrlSetText _icon; - - _idc = 2; - { - _text = _x; - if (_text != "") then { - _contentCtrl = _display displayCtrl _idc; - _contentCtrl ctrlSetText _text; - - _contentAmountOfChars = count (toArray _text); - _pos = ctrlPosition _contentCtrl; - _pos set [2, _contentAmountOfChars * ((((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)/ 3.3) max (safeZoneW / 11)]; - _contentCtrl ctrlSetPosition _pos; - _contentCtrl ctrlCommit 0; - - - if (_type >0) then { - if (_type == 1) then { - _contentCtrl ctrlSetBackgroundColor [0.7,0.2,0.2,0.8]; - _contentCtrl ctrlSetTextColor [1,1,1,0.9]; - }; - }; - _idc = _idc + 1; - }; - }foreach _content; - - while {(_idc < 7)} do { - _contentCtrl = _display displayCtrl _idc; - _contentCtrl ctrlSetPosition [0,0,0,0]; - _contentCtrl ctrlCommit 0; - - _idc = _idc + 1; - }; - }; -} else { - - DISPLAY_LAYER cutText ["","PLAIN"]; -}; \ No newline at end of file diff --git a/addons/gui/functions/fnc_displayMessage.sqf b/addons/gui/functions/fnc_displayMessage.sqf deleted file mode 100644 index 3dceab2638..0000000000 --- a/addons/gui/functions/fnc_displayMessage.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/** - * fn_gui_displayMessage.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -#define DISPLAY_LAYER 546 - -private["_title", "_content","_type","_display","_headerCtrl","_contentCtrl","_contentAmountOfChars","_pos"]; -_title = [_this, 0, "",[""]] call BIS_fnc_Param; -_content = [_this, 1, "",[""]] call BIS_fnc_Param; -_type = [_this, 2, 0, [0]] call BIS_fnc_Param; - -if (_title != "" && _content != "") then { - DISPLAY_LAYER cutRsc [QGVAR(RSC_DISPLAY_MESSAGE),"PLAIN"]; - - disableSerialization; - _display = uiNamespace getvariable QGVAR(RSC_DISPLAY_MESSAGE); - if (!isnil "_display") then { - _headerCtrl = _display displayCtrl 1; - _contentCtrl = _display displayCtrl 2; - - _headerCtrl ctrlSetText _title; - _contentCtrl ctrlSetText _content; - - _contentAmountOfChars = count (toArray _content); - _pos = ctrlPosition _contentCtrl; - _pos set [2, _contentAmountOfChars * ((((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)/ 3.3) max (safeZoneW / 11)]; - _contentCtrl ctrlSetPosition _pos; - _contentCtrl ctrlCommit 0; - - if (_type >0) then { - if (_type == 1) then { - _contentCtrl ctrlSetBackgroundColor [0.7,0.2,0.2,0.8]; - _contentCtrl ctrlSetTextColor [1,1,1,0.9]; - }; - }; - }; -}; \ No newline at end of file diff --git a/addons/gui/functions/fnc_loadingbar.sqf b/addons/gui/functions/fnc_loadingbar.sqf deleted file mode 100644 index 4aba751235..0000000000 --- a/addons/gui/functions/fnc_loadingbar.sqf +++ /dev/null @@ -1,64 +0,0 @@ -/** - * fn_gui_loadingbar.sqf - * @Descr: Displays a loading bar and halts script until loading bar has finished - * @Author: Glowbal - * - * @Arguments: [timeToWait NUMBER, condition CODE (Optional), onSuccess CODE (Optional), onFailure CODE (Optional), arguments ARRAY (Optional)] - * @Return: BOOl Returns true if loading bar has fully finished. Otherwise false - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_timeToWait","_cond","_onfailure","_onSuccess","_args"]; -_timeToWait = _this select 0; -_cond = [_this, 1, {true}, [{true}]] call BIS_fnc_Param; -_onSuccess = [_this, 2, {}, [{}]] call BIS_fnc_Param; -_onfailure = [_this, 3, {}, [{}]] call BIS_fnc_Param; -_args = [_this, 4, [], [[]]] call BIS_fnc_Param; - - -if (_timeToWait > 0) exitwith { - GVAR(LOADING_BAR_STATUS) = 0; - disableSerialization; - 1534 cutRsc [QGVAR(RSC_PROGRESSBAR_LOADING),"plain"]; - [{ - private ["_args","_timeToWait","_start","_cond","_onSuccess","_onfailure","_params"]; - _args = _this select 0; - - _start = _args select 0; - _timeToWait = _args select 1; - _cond = _args select 2; - _onSuccess = _args select 3; - _onfailure = _args select 4; - _params = _args select 5; - - if !(_params call _cond) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - 1534 cutText ["","plain"]; - _params call _onfailure; - }; - - if (GVAR(LOADING_BAR_STATUS) >= 1) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - 1534 cutText ["","plain"]; - _params call _onSuccess; - }; - private "_dialog"; - disableSerialization; - _dialog = uiNamespace getvariable QGVAR(RSC_PROGRESSBAR_LOADING); - - GVAR(LOADING_BAR_STATUS) = (diag_tickTime - _start) / _timeToWait; - (_dialog displayCtrl 6) progressSetPosition GVAR(LOADING_BAR_STATUS); - - }, 0, [diag_tickTime, _timeToWait, _cond, _onSuccess, _onfailure, _args]] call CBA_fnc_addPerFrameHandler; - true; -}; - -if (_args call _cond) exitwith { - _args call _onSuccess; - true; -}; - -_args call _onfailure; -false; \ No newline at end of file diff --git a/addons/gui/functions/fnc_sendHintTo.sqf b/addons/gui/functions/fnc_sendHintTo.sqf deleted file mode 100644 index 0454cc5691..0000000000 --- a/addons/gui/functions/fnc_sendHintTo.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/** - * fn_sendHintTo.sqf - * @Descr: Sends a hint to player unit across network - * @Author: Glowbal - * - * @Arguments: [reciever OBJECT, message STRING] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_reciever","_message"]; -_reciever = _this select 0; -_message = _this select 1; - -if (isPlayer _reciever) then { - if (!local _reciever) then { - [_this, QUOTE(FUNC(sendHintTo)), _reciever, false] call EFUNC(common,execRemoteFnc); - } else { - if (isLocalized _message) then { - _message = localize _message; - }; - hintsilent format ["%1",_message]; - }; -}; \ No newline at end of file diff --git a/addons/gui/functions/fnc_sendMessageTo.sqf b/addons/gui/functions/fnc_sendMessageTo.sqf deleted file mode 100644 index a4e0e4ccd5..0000000000 --- a/addons/gui/functions/fnc_sendMessageTo.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/** - * fn_sendMessageTo.sqf - * @Descr: Sends a chat message to player unit across the network - * @Author: Glowbal - * - * @Arguments: [reciever OBJECT, message STRING] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_reciever","_message"]; -_reciever = _this select 0; -_message = _this select 1; - - -if (isPlayer _reciever) then { - if (!local _reciever) then { - [_this, QUOTE(FUNC(sendMessageTo)), _reciever, false] call EFUNC(common,execRemoteFnc); - } else { - if (isnil QGVAR(LOGIC_OBJECT)) exitwith { - // need to create an object instead - }; - - if (isLocalized _message) then { - _message = localize _message; - }; - GVAR(LOGIC_OBJECT) globalChat format ["%1",_message]; - }; -}; diff --git a/addons/gui/functions/script_component.hpp b/addons/gui/functions/script_component.hpp deleted file mode 100644 index e9276928ad..0000000000 --- a/addons/gui/functions/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT GUI -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_GUI - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_GUI - #define DEBUG_SETTINGS DEBUG_SETTINGS_GUI -#endif - -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/gui/script_component.hpp b/addons/gui/script_component.hpp deleted file mode 100644 index e9276928ad..0000000000 --- a/addons/gui/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT GUI -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_GUI - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_GUI - #define DEBUG_SETTINGS DEBUG_SETTINGS_GUI -#endif - -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/gui/stringtable.xml b/addons/gui/stringtable.xml deleted file mode 100644 index 6a7807c925..0000000000 --- a/addons/gui/stringtable.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/addons/hearing/XEH_preInit.sqf b/addons/hearing/XEH_preInit.sqf index d160232c05..95d317b4b1 100644 --- a/addons/hearing/XEH_preInit.sqf +++ b/addons/hearing/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(addEarPlugs); PREP(earRinging); PREP(explosionNear); @@ -8,3 +10,5 @@ PREP(hasEarPlugsIn); PREP(putInEarPlugs); PREP(removeEarPlugs); PREP(updateVolume); + +ADDON = true; diff --git a/addons/hearing/config.cpp b/addons/hearing/config.cpp index 708146a89b..4499e647f6 100644 --- a/addons/hearing/config.cpp +++ b/addons/hearing/config.cpp @@ -22,9 +22,11 @@ class CfgPatches { #include "CfgAmmo.hpp" -class ACE_Options { - class GVAR(Hearing_DisableEarRinging) { - displayName = "$STR_ACE_Hearing_DisableEarRinging"; - default = 0; - }; +class ACE_Settings { + class GVAR(DisableEarRinging) { + default = 1; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_Hearing_DisableEarRinging"; + }; }; \ No newline at end of file diff --git a/addons/hearing/functions/fnc_earRinging.sqf b/addons/hearing/functions/fnc_earRinging.sqf index 9279b6b954..4581a6fdd9 100644 --- a/addons/hearing/functions/fnc_earRinging.sqf +++ b/addons/hearing/functions/fnc_earRinging.sqf @@ -25,7 +25,7 @@ GVAR(newStrength) = GVAR(newStrength) max _strength; if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {}; -if (profileNamespace getVariable [QGVAR(DisableEarRinging), false]) exitWith {}; +if (GVAR(DisableEarRinging)) exitWith {}; if (_strength > 0.75) exitWith { playSound "ACE_EarRinging_Heavy"; diff --git a/addons/interact_menu/CfgEventHandlers.hpp b/addons/interact_menu/CfgEventHandlers.hpp index ae9c93b32e..1301f022d3 100644 --- a/addons/interact_menu/CfgEventHandlers.hpp +++ b/addons/interact_menu/CfgEventHandlers.hpp @@ -13,7 +13,7 @@ class Extended_PostInit_EventHandlers { class Extended_InitPost_EventHandlers { class All { class GVAR(compileMenu) { - init = QUOTE(_this call FUNC(compileMenu)); + init = QUOTE(_this call FUNC(compileMenu);_this call FUNC(compileMenuSelfAction)); }; }; }; \ No newline at end of file diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index a02bf4d558..a2ce5ef8a6 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -15,13 +15,27 @@ _fnc = { ["ACE3", "Interact Key", {_this call FUNC(keyDown)}, -[15, [false, false, false]], +[219, [false, false, false]], false, "keydown"] call cba_fnc_registerKeybind; ["ACE3", "Interact Key", {_this call FUNC(keyUp)}, -[15, [false, false, false]], +[219, [false, false, false]], +false, +"keyUp"] call cba_fnc_registerKeybind; + +["ACE3", +"Self Actions Key", +{_this call FUNC(keyDownSelfAction)}, +[219, [false, true, false]], +false, +"keydown"] call cba_fnc_registerKeybind; + +["ACE3", +"Self Actions Key", +{_this call FUNC(keyUpSelfAction)}, +[219, [false, true, false]], false, "keyUp"] call cba_fnc_registerKeybind; \ No newline at end of file diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 2c6d32d4de..d3766cf765 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -2,22 +2,25 @@ ADDON = false; -PREP(setToRender); +PREP(addAction); +PREP(compileMenu); +PREP(compileMenuSelfAction); +PREP(keyDown); +PREP(keyDownSelfAction); +PREP(keyUp); +PREP(keyUpSelfAction); +PREP(probe); +PREP(removeAction); PREP(render); PREP(renderIcon); PREP(renderMenu); -PREP(probe); -PREP(rotateVectLineGetMap); PREP(rotateVectLine); -PREP(keyDown); -PREP(keyUp); -PREP(compileMenu); -PREP(addAction); -PREP(removeAction); +PREP(rotateVectLineGetMap); GVAR(toRender) = []; GVAR(keyDown) = false; +GVAR(keyDownSelfAction) = false; GVAR(keyDownTime) = 0; GVAR(lastTime) = diag_tickTime; @@ -50,4 +53,4 @@ GVAR(objectActionsHash) = HASH_CREATE; GVAR(uidCounter) = 0; -ADDON = true; \ No newline at end of file +ADDON = true; diff --git a/addons/interact_menu/config.cpp b/addons/interact_menu/config.cpp index a7b7bae6df..784c6529d6 100644 --- a/addons/interact_menu/config.cpp +++ b/addons/interact_menu/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {""}; + author[] = {"NouberNou", "CAA-Picard"}; authorUrl = ""; VERSION_CONFIG; }; diff --git a/addons/interact_menu/functions/fnc_addAction.sqf b/addons/interact_menu/functions/fnc_addAction.sqf index 4b9243cfac..3d445a4b13 100644 --- a/addons/interact_menu/functions/fnc_addAction.sqf +++ b/addons/interact_menu/functions/fnc_addAction.sqf @@ -1,31 +1,27 @@ /* - * Author: commy2 - * - * Add an ACE action to an object. Note: This function is NOT global. + * Author: commy2 and NouberNou + * Add an ACE action to an object or inside a parent action. Note: This function is NOT global. * * Argument: - * 0: Object the action should be assigned to (Object) - * 1: Name of the action shown in the menu (String) - * 2: Icon (String) - * 3: Position (Position or Selection Name) - * 4: Statement (Code) - * 5: Condition (Code) - * 6: Distance (Number) + * 0: Object the action should be assigned to or parent action or + * 1: Name of the action shown in the menu + * 2: Icon + * 3: Position (Position or Selection Name) or + * 4: Statement + * 5: Condition + * 6: Distance * * Return value: - * The entry array, which can be used to remove the entry, or add children entries. + * The entry array, which can be used to remove the entry, or add children entries . + * + * Public: No */ #include "script_component.hpp" -private ["_object", "_displayName", "_icon", "_position", "_statement", "_condition", "_distance", "_actions", "_entry"]; -_object = _this select 0; -_displayName = _this select 1; -_icon = _this select 2; -_position = _this select 3; -_statement = _this select 4; -_condition = _this select 5; -_distance = _this select 6; +EXPLODE_7_PVT(_this,_object,_displayName,_icon,_position,_statement,_condition,_distance); + +private ["_actions","_entry"]; _actions = []; if(IS_OBJECT(_object)) then { _actions = _object getVariable [QUOTE(GVAR(actionData)), []]; @@ -50,4 +46,4 @@ _entry = [ ]; GVAR(uidCounter) = GVAR(uidCounter) + 1; _actions pushBack _entry; -_entry; \ No newline at end of file +_entry; diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index 1b5e803ad6..0bcecf0732 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -1,23 +1,18 @@ -//fnc_compileMenu.sqf -#include "script_component.hpp"; -// diag_log text format["COMPILE ACTIONS: %1", _this]; - -_object = _this select 0; -_objectType = typeOf _object; - - /* -displayName = "$STR_ACE_Interaction_TeamManagement"; -distance = 4; -condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)}); -statement = ""; -showDisabled = 0; -priority = 3.2; -icon = PATHTOF(UI\team\team_management_ca.paa); -subMenu[] = {"ACE_TeamManagement", 0}; -hotkey = "M"; -enableInside = 1; -*/ + * Author: NouberNou + * Compile the action menu from config for a given object. + * + * Argument: + * 0: Object + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp"; + +EXPLODE_1_PVT(_this,_object); /* [ @@ -33,11 +28,13 @@ enableInside = 1; ] */ +private ["_objectType","_recurseFnc","_actions"]; +_objectType = typeOf _object; _actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions"; _recurseFnc = { - private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_condition", "_showDisabled", + private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled", "_enableInside", "_children", "_entry", "_actionsCfg"]; _actions = []; _actionsCfg = _this select 0; @@ -48,7 +45,10 @@ _recurseFnc = { _distance = getNumber (_entryCfg >> "distance"); _icon = getText (_entryCfg >> "icon"); _statement = compile (getText (_entryCfg >> "statement")); - + _selection = getText (_entryCfg >> "selection"); + if (_selection == "") then { + _selection = [0,0,0]; + }; _condition = getText (_entryCfg >> "condition"); if (_condition == "") then {_condition = "true"}; @@ -59,25 +59,18 @@ _recurseFnc = { _enableInside = getNumber (_entryCfg >> "enableInside"); _condition = compile _condition; - // diag_log text format["_condition: %1", _condition]; - _children = []; - if(isArray (_entryCfg >> "subMenu")) then { - _subMenuDef = getArray (_entryCfg >> "subMenu"); - _childMenuName = _subMenuDef select 0; - _childMenuCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions" >> _childMenuName; - _children = [_childMenuCfg] call _recurseFnc; - }; + _children = [_entryCfg] call _recurseFnc; _entry = [ _displayName, _icon, - [0,0,0], + _selection, _statement, _condition, _distance, _children, GVAR(uidCounter) ]; - GVAR(uidCounter) = GVAR(uidCounter) + 1; + GVAR(uidCounter) = GVAR(uidCounter) + 1; _actions pushBack _entry; }; }; @@ -86,17 +79,4 @@ _recurseFnc = { _actions = [_actionsCfg] call _recurseFnc; -_actions = [[ - "TEST!", - "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", - "Spine3", - { true }, - { true }, - 5, - _actions, - GVAR(uidCounter) -] -]; -GVAR(uidCounter) = GVAR(uidCounter) + 1; - -_object setVariable [QUOTE(GVAR(actionData)), _actions]; \ No newline at end of file +_object setVariable [QUOTE(GVAR(actionData)), _actions]; diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf new file mode 100644 index 0000000000..0135d64eb8 --- /dev/null +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -0,0 +1,92 @@ +/* + * Author: NouberNou and CAA-Picard + * Compile the self action menu from config for a given object. + * + * Argument: + * 0: Object + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp"; + +EXPLODE_1_PVT(_this,_object); + +/* +[ + [ + "Launch", + "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", + [0,0,0], + { (_this select 0) setVelocity [0,0,10]; }, + { true }, + 1, + [] + ] +] +*/ + +private ["_objectType","_recurseFnc","_actions"]; +_objectType = typeOf _object; +_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions"; + + +_recurseFnc = { + private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_condition", "_showDisabled", + "_enableInside", "_children", "_entry", "_actionsCfg"]; + _actions = []; + _actionsCfg = _this select 0; + for "_i" from 0 to (count _actionsCfg)-1 do { + _entryCfg = _actionsCfg select _i; + if(isClass _entryCfg) then { + _displayName = getText (_entryCfg >> "displayName"); + _icon = getText (_entryCfg >> "icon"); + _statement = compile (getText (_entryCfg >> "statement")); + + _condition = getText (_entryCfg >> "condition"); + if (_condition == "") then {_condition = "true"}; + + // Add canInteract (including exceptions) and canInteractWith to condition + _condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, _target)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; + + _showDisabled = getNumber (_entryCfg >> "showDisabled"); + _enableInside = getNumber (_entryCfg >> "enableInside"); + + _condition = compile _condition; + _children = [_entryCfg] call _recurseFnc; + _entry = [ + _displayName, + _icon, + [0,0,0], + _statement, + _condition, + 10, //distace + _children, + GVAR(uidCounter) + ]; + GVAR(uidCounter) = GVAR(uidCounter) + 1; + _actions pushBack _entry; + }; + }; + _actions +}; + +_actions = [_actionsCfg] call _recurseFnc; + +// Create a master action to base on self action +_actions = [[ + "Self Actions", + "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", + "Spine3", + { true }, + { true }, + 10, + _actions, + GVAR(uidCounter) +] +]; +GVAR(uidCounter) = GVAR(uidCounter) + 1; + +_object setVariable [QUOTE(GVAR(selfActionData)), _actions]; diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index e18ec69ae8..5d37019858 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -1,8 +1,19 @@ -//fnc_keyDown.sqf +/* + * Author: NouberNou + * Handle interaction key down + * + * Argument: + * None + * + * Return value: + * true + * + * Public: No + */ #include "script_component.hpp" if(!GVAR(keyDown)) then { - GVAR(keyDown) = true; - GVAR(keyDownTime) = diag_tickTime; + GVAR(keyDown) = true; + GVAR(keyDownTime) = diag_tickTime; }; true diff --git a/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf b/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf new file mode 100644 index 0000000000..be46dd132c --- /dev/null +++ b/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf @@ -0,0 +1,22 @@ +/* + * Author: NouberNou + * Handle self action key down + * + * Argument: + * None + * + * Return value: + * true + * + * Public: No + */ +#include "script_component.hpp" + +if(!GVAR(keyDownSelfAction)) then { + GVAR(keyDownSelfAction) = true; + GVAR(keyDown) = false; + GVAR(keyDownTime) = diag_tickTime; + + GVAR(selfMenuOffset) = [sin getDir ACE_player, cos getDir ACE_player, 0] vectorMultiply 2; +}; +true diff --git a/addons/interact_menu/functions/fnc_keyUp.sqf b/addons/interact_menu/functions/fnc_keyUp.sqf index 8f91b1322d..6a39f40f95 100644 --- a/addons/interact_menu/functions/fnc_keyUp.sqf +++ b/addons/interact_menu/functions/fnc_keyUp.sqf @@ -1,12 +1,23 @@ -//fnc_keyUp.sqf +/* + * Author: NouberNou + * Handle interaction key up + * + * Argument: + * None + * + * Return value: + * true + * + * Public: No + */ #include "script_component.hpp" GVAR(keyDown) = false; if(GVAR(actionSelected)) then { - this = GVAR(selectedTarget); + this = GVAR(selectedTarget); _player = ACE_Player; _target = GVAR(selectedTarget); - [GVAR(selectedTarget), player] call GVAR(selectedAction); + [GVAR(selectedTarget), player] call GVAR(selectedAction); }; GVAR(expanded) = false; GVAR(lastPath) = []; diff --git a/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf b/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf new file mode 100644 index 0000000000..82130c9993 --- /dev/null +++ b/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf @@ -0,0 +1,26 @@ +/* + * Author: NouberNou + * Handle self action key up + * + * Argument: + * None + * + * Return value: + * true + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(keyDownSelfAction) = false; +if(GVAR(actionSelected)) then { + this = GVAR(selectedTarget); + _player = ACE_Player; + _target = GVAR(selectedTarget); + [GVAR(selectedTarget), player] call GVAR(selectedAction); +}; +GVAR(expanded) = false; +GVAR(lastPath) = []; +GVAR(menuDepthPath) = []; +GVAR(vecLineMap) = []; +true diff --git a/addons/interact_menu/functions/fnc_probe.sqf b/addons/interact_menu/functions/fnc_probe.sqf index 1f178180be..dc1b7e6c87 100644 --- a/addons/interact_menu/functions/fnc_probe.sqf +++ b/addons/interact_menu/functions/fnc_probe.sqf @@ -1,15 +1,27 @@ -//fnc_probe.sqf +/* + * Author: NouberNou + * Scan de vicinity of the player and collect every interaction available around it on + * the GVAR(toRender) array. + * + * Argument: + * None + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp" private ["_nearestObjects", "_actionObject", "_x", "_actionData", "_renderData", "_actionItem", "_active", "_renderItem", "_object", "_forEachIndex"]; if(!GVAR(keyDown)) then { - _nearestObjects = nearestObjects [(getPos player), ["All"], 100]; + _nearestObjects = nearestObjects [(getPos ACE_player), ["All"], 100]; GVAR(toRender) = []; { _actionObject = _x; _actionData = _actionObject getVariable [QUOTE(GVAR(actionData)), []]; - + if((count _actionData) > 0) then { _renderData = []; { @@ -18,6 +30,7 @@ if(!GVAR(keyDown)) then { _target = _actionObject; _player = ACE_player; _active = [_target, ACE_player] call (_actionItem select 4); + systemChat format ["%1 %2 is active %3", _actionObject, _actionItem select 0, _active]; // player sideChat format["_active: %1 %2", _actionItem select 0, _active]; if(_active) then { _renderItem = +_actionItem; @@ -35,7 +48,7 @@ if(!GVAR(keyDown)) then { GVAR(filter) = []; { _object = _x select 0; - if(_object distance player > 100) then { + if(_object distance ACE_player > 100) then { GVAR(filter) set[(count GVAR(filter)), _forEachIndex]; }; } forEach GVAR(toRender); diff --git a/addons/interact_menu/functions/fnc_removeAction.sqf b/addons/interact_menu/functions/fnc_removeAction.sqf index 3b32f4d012..3ab4379768 100644 --- a/addons/interact_menu/functions/fnc_removeAction.sqf +++ b/addons/interact_menu/functions/fnc_removeAction.sqf @@ -1,24 +1,21 @@ /* - * Author: commy2 - * - * Add an ACE action to an object. Note: This function is global. + * Author: commy2 and NouberNou + * Remove an action from an object * * Argument: - * 0: Object the action should be assigned to (Object) - * 1: Entry to remove (Array or Number) + * 0: Object the action should be assigned to + * 1: Entry to remove or * * Return value: - * ID of the action (used to remove it later). + * None + * + * Public: No */ - #include "script_component.hpp" -private ["_object", "_entry", "_found", "_actions", "_searchFnc"]; - -_object = _this select 0; -_entry = _this select 1; - +EXPLODE_2_PVT(_this,_object,_entry); +private ["_found", "_actions", "_searchFnc"]; if(!IS_OBJECT(_object)) exitWith {false}; @@ -50,4 +47,4 @@ _searchFnc = { _actions = [_actions, _entry] call _searchFnc; _object setVariable [QUOTE(GVAR(actionData)), _actions]; -_found; \ No newline at end of file +_found; diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 29033e3407..79d300019a 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -1,4 +1,15 @@ -//fnc_render.sqf +/* + * Author: NouberNou and CAA-Picard + * Render all available nearby interactions + * + * Argument: + * None + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp" private ["_cursorPos1", "_cursorPos2", "_cursorVec", "_p1", "_p2", "_p", "_v", "_cp", "_forEachIndex", "_renderTargets", "_x", "_cursorScreenPos", "_closestDistance", "_closestSelection", "_pos", "_sPos", "_disSq", "_closest", "_cTime", "_delta", "_foundTarget", "_misMatch", "_hoverPath", "_i"]; @@ -6,99 +17,108 @@ _foundTarget = false; _cursorPos1 = positionCameraToWorld [0, 0, 0]; _cursorPos2 = positionCameraToWorld [0, 0, 2]; GVAR(currentOptions) = []; -if((count GVAR(toRender)) > 0 && GVAR(keyDown)) then { - if((count GVAR(vecLineMap)) == 0 || ((count GVAR(menuDepthPath)) > 0 && (getPosASL player) distance GVAR(lastPos) > 0.01)) then { - GVAR(lastPos) = getPosASL player; - _cursorVec = [_cursorPos2, _cursorPos1] call BIS_fnc_vectorFromXtoY; - _p1 = [0,0,0]; - _p2 = +_cursorVec; - _p = (_cursorVec call CBA_fnc_vect2polar); - _v = [(_p select 0), (_p select 1), (_p select 2)+90] call CBA_fnc_polar2vect; - _cp = [_cursorVec, _v] call BIS_fnc_crossProduct; - - GVAR(vecLineMap) = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap); - }; - { - if(!(_forEachIndex in GVAR(filter))) then { - GVAR(renderDepth) = 0; - _renderTargets = _x; - { - [_renderTargets select 0, _x, 0] call FUNC(renderMenu); - } forEach (_renderTargets select 1); - }; - } forEach GVAR(toRender); - // player sideChat format["c: %1", count GVAR(toRender)]; +if((count GVAR(toRender)) > 0 && (GVAR(keyDown) || GVAR(keyDownSelfAction))) then { + if((count GVAR(vecLineMap)) == 0 || ((count GVAR(menuDepthPath)) > 0 && (getPosASL player) distance GVAR(lastPos) > 0.01)) then { + GVAR(lastPos) = getPosASL player; + _cursorVec = [_cursorPos2, _cursorPos1] call BIS_fnc_vectorFromXtoY; + _p1 = [0,0,0]; + _p2 = +_cursorVec; + _p = (_cursorVec call CBA_fnc_vect2polar); + _v = [(_p select 0), (_p select 1), (_p select 2)+90] call CBA_fnc_polar2vect; + _cp = [_cursorVec, _v] call BIS_fnc_crossProduct; + + GVAR(vecLineMap) = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap); + }; + if (GVAR(keyDown)) then { + // Render all nearby interaction menus + { + if(!(_forEachIndex in GVAR(filter))) then { + GVAR(renderDepth) = 0; + _renderTargets = _x; + { + [_renderTargets select 0, _x, 0, [180, 360]] call FUNC(renderMenu); + } forEach (_renderTargets select 1); + }; + } forEach GVAR(toRender); + } else { + // Render only the self action menu + _actions = (ACE_player getVariable QGVAR(selfActionData)) select 0; + _pos = (ACE_player modelToWorld (ACE_player selectionPosition "spine3")) vectorAdd GVAR(selfMenuOffset) vectorAdd [0,0,0.25]; + [ACE_player, _actions, 0, [180, 360], _pos] call FUNC(renderMenu); + }; + + // player sideChat format["c: %1", count GVAR(toRender)]; }; -if(GVAR(keyDown)) then { - - _cursorScreenPos = worldToScreen _cursorPos2; - _closestDistance = 1000000; - _closestSelection = -1; - { - _pos = _x select 1; - _sPos = worldToScreen _pos; - if(count _sPos > 0) then { - _disSq = (((_cursorScreenPos select 0) - (_sPos select 0))^2 + ((_cursorScreenPos select 1) - (_sPos select 1))^2); - if(_disSq < 0.0125 && _disSq < _closestDistance) then { - _closestDistance = _disSq; - _closestSelection = _forEachIndex; - }; - }; - } forEach GVAR(currentOptions); - - if(_closestSelection != -1) then { - - _closest = GVAR(currentOptions) select _closestSelection; - - _pos = _closest select 1; - _cTime = diag_tickTime; - _delta = _cTime - GVAR(lastTime); - GVAR(lastTime) = _cTime; - GVAR(rotationAngle) = GVAR(rotationAngle) + (180*_delta); - if(GVAR(rotationAngle) > 360) then { - GVAR(rotationAngle) = GVAR(rotationAngle) - 360; - }; - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,.75], _pos, 0.6*SafeZoneW, 0.6*SafeZoneW, GVAR(rotationAngle), "", 0.5, 0.025, "TahomaB"]; - _foundTarget = true; - GVAR(actionSelected) = true; - GVAR(selectedTarget) = (_closest select 0) select 0; - GVAR(selectedAction) = ((_closest select 0) select 1) select 3; - _misMatch = false; - _hoverPath = (_closest select 2); - if((count GVAR(lastPath)) != (count _hoverPath)) then { - _misMatch = true; - } else { - { - if(_x != (_hoverPath select _forEachIndex)) exitWith { - _misMatch = true; - }; - } forEach GVAR(lastPath); - }; - - if(_misMatch) then { - GVAR(lastPath) = _hoverPath; - GVAR(startHoverTime) = diag_tickTime; - GVAR(expanded) = false; - } else { - if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then { - GVAR(expanded) = true; - GVAR(menuDepthPath) = +GVAR(lastPath); - }; - }; - }; - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa", [1,0,0,1], _cursorPos2, 1, 1, 0, "", 0.5, 0.025, "TahomaB"]; +if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then { + + _cursorScreenPos = worldToScreen _cursorPos2; + _closestDistance = 1000000; + _closestSelection = -1; + { + _pos = _x select 1; + _sPos = worldToScreen _pos; + if(count _sPos > 0) then { + _disSq = (((_cursorScreenPos select 0) - (_sPos select 0))^2 + ((_cursorScreenPos select 1) - (_sPos select 1))^2); + if(_disSq < 0.0125 && _disSq < _closestDistance) then { + _closestDistance = _disSq; + _closestSelection = _forEachIndex; + }; + }; + } forEach GVAR(currentOptions); + + if(_closestSelection != -1) then { + + _closest = GVAR(currentOptions) select _closestSelection; + + _pos = _closest select 1; + _cTime = diag_tickTime; + _delta = _cTime - GVAR(lastTime); + GVAR(lastTime) = _cTime; + GVAR(rotationAngle) = GVAR(rotationAngle) + (180*_delta); + if(GVAR(rotationAngle) > 360) then { + GVAR(rotationAngle) = GVAR(rotationAngle) - 360; + }; + drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,.75], _pos, 0.6*SafeZoneW, 0.6*SafeZoneW, GVAR(rotationAngle), "", 0.5, 0.025, "TahomaB"]; + _foundTarget = true; + GVAR(actionSelected) = true; + GVAR(selectedTarget) = (_closest select 0) select 0; + GVAR(selectedAction) = ((_closest select 0) select 1) select 3; + _misMatch = false; + _hoverPath = (_closest select 2); + if((count GVAR(lastPath)) != (count _hoverPath)) then { + _misMatch = true; + } else { + { + if(_x != (_hoverPath select _forEachIndex)) exitWith { + _misMatch = true; + }; + } forEach GVAR(lastPath); + }; + + if(_misMatch) then { + GVAR(lastPath) = _hoverPath; + GVAR(startHoverTime) = diag_tickTime; + GVAR(expanded) = false; + } else { + if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then { + GVAR(expanded) = true; + GVAR(menuDepthPath) = +GVAR(lastPath); + }; + }; + }; + drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa", [1,0,0,1], _cursorPos2, 1, 1, 0, "", 0.5, 0.025, "TahomaB"]; }; if(!_foundTarget && GVAR(actionSelected)) then { - GVAR(actionSelected) = false; - GVAR(expanded) = false; - GVAR(lastPath) = []; - if(!GVAR(keyDown)) then { - GVAR(vecLineMap) = []; - }; + GVAR(actionSelected) = false; + GVAR(expanded) = false; + GVAR(lastPath) = []; + if(!GVAR(keyDown)) then { + GVAR(vecLineMap) = []; + }; }; for "_i" from GVAR(iconCount) to (count GVAR(iconCtrls))-1 do { - ctrlDelete (GVAR(iconCtrls) select _i); + ctrlDelete (GVAR(iconCtrls) select _i); }; GVAR(iconCtrls) resize GVAR(iconCount); GVAR(iconCount) = 0; diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index 39b4b120b9..4b04ff6909 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -1,4 +1,21 @@ -//fnc_renderIcon.sqf +/* + * Author: NouberNou and CAA-Picard + * Render a single interaction icon + * + * Argument: + * 0: Text + * 1: Color + * 2: 3d position ASL + * 3: ? + * 4: ? + * 5: ? + * 6: Icon + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp" #define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa) private ["_color", "_pos", "_sPos", "_ctrl", "_icon"]; @@ -6,24 +23,23 @@ _text = _this select 0; _color = _this select 1; _pos = _this select 2; _icon = _this select 6; + _sPos = worldToScreen _pos; // _sPos = _pos; if(count _sPos > 0) then { - // player sideChat format["render!"]; - if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { - GVAR(iconCtrls) pushBack ((findDisplay 46) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); - }; - _ctrl = GVAR(iconCtrls) select GVAR(iconCount); - GVAR(iconCount) = GVAR(iconCount) + 1; + + if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { + GVAR(iconCtrls) pushBack ((findDisplay 46) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); + }; + _ctrl = GVAR(iconCtrls) select GVAR(iconCount); + GVAR(iconCount) = GVAR(iconCount) + 1; if(_icon == "") then { _icon = DEFAULT_ICON; }; - _text = "" + _text; - _ctrl ctrlSetStructuredText (parseText _text); - _ctrl ctrlSetPosition [(_sPos select 0)-(0.011*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.4*SafeZoneW, 0.025*SafeZoneW]; - _ctrl ctrlSetForegroundColor _color; - _opacity = _color select 3; - _control ctrlSetTextColor _color; - // _ctrl ctrlSetBackgroundColor [1,0,0,1]; - _ctrl ctrlCommit 0; + _text = format ["
%4", _icon, _color, _color, _text]; + _ctrl ctrlSetStructuredText (parseText _text); + _ctrl ctrlSetPosition [(_sPos select 0)-(0.2*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.4*SafeZoneW, 0.035*SafeZoneW]; + //_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1]; + // _ctrl ctrlSetBackgroundColor [1,0,0,1]; + _ctrl ctrlCommit 0; }; diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index 0337d4e8c9..4c437aa6f3 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -1,64 +1,105 @@ -//fnc_renderMenu.sqf +/* + * Author: NouberNou and CAA-Picard + * Render a interaction menu + * + * Argument: + * 0: Object + * 1: Action data + * 2: ? + * 3: Angle range available for rendering + * 4: 3D position (Optional) + * 5: Path of UIDs (Optional) + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp" -private ["_object", "_actionData", "_distance", "_index", "_pos", "_cursorScreenPos", "_path", "_menuDepth", "_opacity", "_currentRenderDepth", "_radialOffset", "_active", "_x", "_offset", "_newPos", "_forEachIndex"]; +private ["_object", "_actionData", "_distance", "_uid", "_pos", "_cursorScreenPos", "_path", "_menuDepth", "_opacity", "_currentRenderDepth", "_radialOffset", "_active", "_x", "_offset", "_newPos", "_forEachIndex"]; _object = _this select 0; _actionData = _this select 1; -_distance = _actionData select 5; -_index = _this select 2; +_uid = _actionData select 7;//_this select 2; +_angles = _this select 3; -if((count _this) > 3) then { - _pos = _this select 3; +_distance = _actionData select 5; +EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan); + +if((count _this) > 4) then { + _pos = _this select 4; } else { - if(typeName (_actionData select 2) == "ARRAY") then { - _pos = _object modelToWorld (_actionData select 2); - } else { - _pos = _object modelToWorld (_object selectionPosition (_actionData select 2)); - }; + if(typeName (_actionData select 2) == "ARRAY") then { + _pos = _object modelToWorld (_actionData select 2); + } else { + _pos = _object modelToWorld (_object selectionPosition (_actionData select 2)); + }; }; _cursorScreenPos = (positionCameraToWorld [0, 0, 0]); if(_cursorScreenPos distance _pos <= _distance) then { - _path = []; - if((count _this) > 4) then { - _path = +(_this select 4); - }; - _menuDepth = (count GVAR(menuDepthPath)); + _path = []; + if((count _this) > 5) then { + _path = +(_this select 5); + }; + _menuDepth = (count GVAR(menuDepthPath)); - _opacity = 1; - if(_menuDepth > 0 && _index != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then { - _opacity = ((GVAR(renderDepth)/_menuDepth)) max 0.25; - }; - _path set[(count _path), _index]; - // player sideChat format["r: %1", _actionData select 2]; - [_actionData select 0, [1,1,1,_opacity], _pos, 1, 1, 0, _actionData select 1, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon); - GVAR(currentOptions) set[(count GVAR(currentOptions)), [_this, _pos, _path]]; - _currentRenderDepth = -1; - _currentRenderDepth = GVAR(renderDepth); - GVAR(renderDepth) = GVAR(renderDepth) + 1; - if(_index == (GVAR(menuDepthPath) select (GVAR(renderDepth)-1))) then { - _radialOffset = 0; - { - // if(_index != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then { - this = _object; - _target = _object; - _player = ACE_player; - _active = [_object, ACE_player] call (_x select 4); - // diag_log text format["_active: %1: %2", (_x select 0), _active]; - if(_active) then { - _offset = [GVAR(vecLineMap), (270*(GVAR(renderDepth)%2))-(_radialOffset*45)] call FUNC(rotateVectLine); - _mod = 0.1*_distance; - _newPos = [ - (_pos select 0) + ((_offset select 0)*_mod), - (_pos select 1) + ((_offset select 1)*_mod), - (_pos select 2) + ((_offset select 2)*_mod) - ]; - // drawLine3D [_pos, _newPos, [1,0,0,1]]; - [_object, _x, _forEachIndex, _newPos, _path] call FUNC(renderMenu); - _radialOffset = _radialOffset + 1; + // ARGB Color (First Hex Pair is transparancy) + _color = "#FFFFFFFF"; + if(_menuDepth > 0 && _uid != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then { + _color = format ["#%1FFFFFF", [255 * (((GVAR(renderDepth)/_menuDepth)) max 0.25)] call EFUNC(common,toHex)]; + }; + _path set[(count _path), _uid]; + [_actionData select 0, _color, _pos, 1, 1, 0, _actionData select 1, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon); + GVAR(currentOptions) set[(count GVAR(currentOptions)), [_this, _pos, _path]]; + _currentRenderDepth = -1; + _currentRenderDepth = GVAR(renderDepth); + GVAR(renderDepth) = GVAR(renderDepth) + 1; + if(_uid == (GVAR(menuDepthPath) select (GVAR(renderDepth)-1))) then { + // Count how many actions are active + private "_numActions"; + _numActions = 0; + { + this = _object; + _target = _object; + _player = ACE_player; + _active = [_object, ACE_player] call (_x select 4); + if(_active) then { + _numActions = _numActions + 1; + }; + } forEach (_actionData select 6); + systemChat format ["Menu %1, _numActions: %2", _actionData select 0, _numActions]; + + private "_angleSpan"; + _angleSpan = _maxAngleSpan min (55 * (_numActions - 1)); + + private "_angle"; + _angle = _centerAngle - _angleSpan / 2; + { + this = _object; + _target = _object; + _player = ACE_player; + _active = [_object, ACE_player] call (_x select 4); + // diag_log text format["_active: %1: %2", (_x select 0), _active]; + if(_active) then { + //systemChat format ["_angle: %1", _angle]; + _offset = [GVAR(vecLineMap), _angle] call FUNC(rotateVectLine); + _mod = 0.15 max (0.15 * (_cursorScreenPos distance _pos)); //0.5;//0.1*_distance; + _newPos = [ + (_pos select 0) + ((_offset select 0)*_mod), + (_pos select 1) + ((_offset select 1)*_mod), + (_pos select 2) + ((_offset select 2)*_mod) + ]; + // drawLine3D [_pos, _newPos, [1,0,0,0.5]]; + [_object, _x, _forEachIndex, [_angle, 150], _newPos, _path] call FUNC(renderMenu); + + if (_angle == 360) then { + _angle = _angle + _angleSpan / _numActions; + } else { + _angle = _angle + _angleSpan / ((_numActions-1) max 1); }; - // }; - } forEach (_actionData select 6); - }; - GVAR(renderDepth) = GVAR(renderDepth) - 1; + }; + } forEach (_actionData select 6); + }; + GVAR(renderDepth) = GVAR(renderDepth) - 1; }; diff --git a/addons/interact_menu/functions/fnc_rotateVectLine.sqf b/addons/interact_menu/functions/fnc_rotateVectLine.sqf index d411ffbf84..4639a50903 100644 --- a/addons/interact_menu/functions/fnc_rotateVectLine.sqf +++ b/addons/interact_menu/functions/fnc_rotateVectLine.sqf @@ -1,4 +1,16 @@ -//fnc_rotateVectLine.sqf +/* + * Author: NouberNou + * Rotate a vector line (?) + * + * Argument: + * 0: Map + * 1: Theta + * + * Return value: + * 0: ?? + * + * Public: No + */ #include "script_component.hpp" private ["_theta", "_p", "_map", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; diff --git a/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf b/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf index 40a1d0ca0c..e695f3fa8e 100644 --- a/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf +++ b/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf @@ -1,4 +1,17 @@ -//fnc_rotateVectLineGetMap.sqf +/* + * Author: NouberNou + * ? + * + * Argument: + * 0: p0 + * 1: p1 + * 2: p2 + * + * Return value: + * Map + * + * Public: No + */ #include "script_component.hpp" private ["_p", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; diff --git a/addons/interact_menu/functions/fnc_setToRender.sqf b/addons/interact_menu/functions/fnc_setToRender.sqf deleted file mode 100644 index 4cc7cfd68f..0000000000 --- a/addons/interact_menu/functions/fnc_setToRender.sqf +++ /dev/null @@ -1,6 +0,0 @@ -//fnc_setToRender.sqf -#include "script_component.hpp" -// No idea what this function was for, it was autogenerated out of my WIP file... -private ["_options"]; -_object = _this select 0; -_options = _this select 1; diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index ce1a98abc5..801e564384 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -30,121 +30,142 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_Actions { - class ACE_TeamManagement { - displayName = "$STR_ACE_Interaction_TeamManagement"; + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)}); + condition = QUOTE(true); statement = ""; - showDisabled = 0; - priority = 3.2; - icon = PATHTOF(UI\team\team_management_ca.paa); - subMenu[] = {"ACE_TeamManagement", 0}; - hotkey = "M"; - enableInside = 1; + icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; + selection = "spine3"; - class ACE_JoinTeamRed { - displayName = "$STR_ACE_Interaction_JoinTeamRed"; + class ACE_TeamManagement { + displayName = "$STR_ACE_Interaction_TeamManagement"; distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); - statement = QUOTE([ARR_2(_target,'RED')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_red_ca.paa); - priority = 2.4; - hotkey = "R"; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)}); + statement = ""; + showDisabled = 0; + priority = 3.2; + icon = PATHTOF(UI\team\team_management_ca.paa); + hotkey = "M"; + enableInside = 1; + + class ACE_JoinTeamRed { + displayName = "$STR_ACE_Interaction_JoinTeamRed"; + distance = 4; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); + statement = QUOTE([ARR_2(_target,'RED')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_red_ca.paa); + priority = 2.4; + hotkey = "R"; + enableInside = 1; + }; + class ACE_JoinTeamGreen { + displayName = "$STR_ACE_Interaction_JoinTeamGreen"; + distance = 4; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); + statement = QUOTE([ARR_2(_target,'GREEN')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_green_ca.paa); + priority = 2.3; + hotkey = "G"; + enableInside = 1; + }; + class ACE_JoinTeamBlue { + displayName = "$STR_ACE_Interaction_JoinTeamBlue"; + distance = 4; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); + statement = QUOTE([ARR_2(_target,'BLUE')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_blue_ca.paa); + priority = 2.2; + hotkey = "B"; + enableInside = 1; + }; + class ACE_JoinTeamYellow { + displayName = "$STR_ACE_Interaction_JoinTeamYellow"; + distance = 4; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); + statement = QUOTE([ARR_2(_target,'YELLOW')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_yellow_ca.paa); + priority = 2.1; + hotkey = "Y"; + enableInside = 1; + }; + + class ACE_LeaveTeam { + displayName = "$STR_ACE_Interaction_LeaveTeam"; + distance = 4; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {assignedTeam _player != 'MAIN'}); + statement = QUOTE([ARR_2(_target,'MAIN')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_white_ca.paa); + priority = 2.5; + hotkey = "N"; + enableInside = 1; + }; + }; + + class ACE_JoinGroup { + displayName = "$STR_ACE_Interaction_JoinGroup"; + distance = 4; + condition = QUOTE(side group _player == side group _target && {group _player != group _target}); + statement = QUOTE([_player] joinSilent group _target;); + showDisabled = 0; + priority = 2.6; + icon = PATHTOF(UI\team\team_management_ca.paa); + hotkey = "J"; enableInside = 1; }; - class ACE_JoinTeamGreen { - displayName = "$STR_ACE_Interaction_JoinTeamGreen"; + + class ACE_GetDown { + displayName = "$STR_ACE_Interaction_GetDown"; distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); - statement = QUOTE([ARR_2(_target,'GREEN')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_green_ca.paa); - priority = 2.3; - hotkey = "G"; - enableInside = 1; - }; - class ACE_JoinTeamBlue { - displayName = "$STR_ACE_Interaction_JoinTeamBlue"; - distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); - statement = QUOTE([ARR_2(_target,'BLUE')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_blue_ca.paa); + condition = QUOTE([_target] call DFUNC(canInteractWith)); + statement = QUOTE([_target] call DFUNC(getDown)); + showDisabled = 0; priority = 2.2; - hotkey = "B"; - enableInside = 1; }; - class ACE_JoinTeamYellow { - displayName = "$STR_ACE_Interaction_JoinTeamYellow"; + class ACE_SendAway { + displayName = "$STR_ACE_Interaction_SendAway"; distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); - statement = QUOTE([ARR_2(_target,'YELLOW')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_yellow_ca.paa); - priority = 2.1; - hotkey = "Y"; - enableInside = 1; + condition = QUOTE([_target] call DFUNC(canInteractWith)); + statement = QUOTE([_target] call DFUNC(sendAway)); + showDisabled = 0; + priority = 2.0; }; - - class ACE_LeaveTeam { - displayName = "$STR_ACE_Interaction_LeaveTeam"; + class ACE_Pardon { + displayName = "$STR_ACE_Interaction_Pardon"; distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {assignedTeam _player != 'MAIN'}); - statement = QUOTE([ARR_2(_target,'MAIN')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_white_ca.paa); + condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target}); + statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc)); + showDisabled = 0; priority = 2.5; - hotkey = "N"; enableInside = 1; }; }; - class ACE_TapShoulder { + class ACE_TapShoulderRight { displayName = "$STR_ACE_Interaction_TapShoulder"; - distance = 4; + selection = "rightshoulder"; + distance = 2.0; condition = QUOTE([ARR_2(_player, _target)] call DFUNC(canTapShoulder)); - statement = QUOTE([ARR_2(_player, _target)] call DFUNC(tapShoulder)); - showDisabled = 1; + statement = QUOTE([ARR_3(_player, _target, 0)] call DFUNC(tapShoulder)); + showDisabled = 0; priority = 2.8; hotkey = "Q"; enableInside = 1; }; - class ACE_JoinGroup { - displayName = "$STR_ACE_Interaction_JoinGroup"; - distance = 4; - condition = QUOTE(side group _player == side group _target && {group _player != group _target}); - statement = QUOTE([_player] joinSilent group _target;); + class ACE_TapShoulderLeft { + displayName = "$STR_ACE_Interaction_TapShoulder"; + selection = "leftshoulder"; + distance = 2.0; + condition = QUOTE([ARR_2(_player, _target)] call DFUNC(canTapShoulder)); + statement = QUOTE([ARR_3(_player, _target, 1)] call DFUNC(tapShoulder)); showDisabled = 0; - priority = 2.6; - icon = PATHTOF(UI\team\team_management_ca.paa); - hotkey = "J"; - enableInside = 1; - }; - - class ACE_GetDown { - displayName = "$STR_ACE_Interaction_GetDown"; - distance = 4; - condition = QUOTE([_target] call DFUNC(canInteractWith)); - statement = QUOTE([_target] call DFUNC(getDown)); - showDisabled = 0; - priority = 2.2; - }; - class ACE_SendAway { - displayName = "$STR_ACE_Interaction_SendAway"; - distance = 4; - condition = QUOTE([_target] call DFUNC(canInteractWith)); - statement = QUOTE([_target] call DFUNC(sendAway)); - showDisabled = 0; - priority = 2.0; - }; - class ACE_Pardon { - displayName = "$STR_ACE_Interaction_Pardon"; - distance = 4; - condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target}); - statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc)); - showDisabled = 0; - priority = 2.5; + priority = 2.8; + hotkey = "Q"; enableInside = 1; }; }; diff --git a/addons/interaction/XEH_clientInit.sqf b/addons/interaction/XEH_clientInit.sqf index bcc3f47def..85232d1fcd 100644 --- a/addons/interaction/XEH_clientInit.sqf +++ b/addons/interaction/XEH_clientInit.sqf @@ -16,78 +16,6 @@ GVAR(isOpeningDoor) = false; // Add keybinds -["ACE3", - localize "STR_ACE_Interaction_InteractionMenu", - { - // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(isNull (findDisplay 1713999)) exitWith {false}; - - // Statement - call FUNC(onButtonDown); - true - }, - [219, [false, false, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Interaction_InteractionMenu", - { - // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; - - // Statement - if (GVAR(MenuType) mod 2 == 0) then {call FUNC(onButtonUp)}; - true - }, - [219, [false, false, false]], - false, - "keyup" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Interaction_InteractionMenuSelf", - { - // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(isNull (findDisplay 1713999)) exitWith {false}; - - // Statement - call FUNC(onButtonDownSelf); - true - }, - [219, [false, true, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Interaction_InteractionMenuSelf", - { - // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; - - // Statement - if (GVAR(MenuType) mod 2 == 1) then {call FUNC(onButtonUp)}; - true - }, - [219, [false, true, false]], - false, - "keyup" -] call cba_fnc_registerKeybind; - ["ACE3", localize "STR_ACE_Interaction_OpenDoor", { diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index b09bcee71c..bcb8103ea2 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(addInteraction); PREP(addInteractionSelf); PREP(addSelectableItem); @@ -45,6 +47,4 @@ PREP(sortOptionsByPriority); PREP(tapShoulder); PREP(updateTooltipPosition); - - - +ADDON = true; diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index acb41d362f..90db08e9e2 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -18,35 +18,32 @@ class CfgPatches { #include -class ACE_Options { - class Interaction_FlowMenu { +class ACE_Settings { + class GVAR(FlowMenu) { + value = 0; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_Interaction_FlowMenu"; - default = 0; }; - class Interaction_AutoCloseMenu { + class GVAR(AutoCloseMenu) { + value = 0; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_Interaction_AutoCloseMenu"; - default = 0; }; - class Interaction_AutoCenterCursor { + class GVAR(AutoCenterCursor) { + value = 1; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_Interaction_AutoCenterCursor"; - default = 1; }; -}; - -class ACE_Parameters_Boolean { - ACE_Interaction_EnableTeamManagement = 1; + class GVAR(EnableTeamManagement) { + value = 1; + typeName = "BOOL"; + }; }; class ACE_canInteractConditions { - class GVAR(isNotEscorting) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isEscorting', false)]) ); - }; - class GVAR(isNotCaptive) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isCaptive', false)]) ); - }; - class GVAR(isNotSurrendering) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isSurrender', false)]) ); - }; class GVAR(isNotSwimming) { condition = QUOTE( !underwater ACE_player ); }; diff --git a/addons/interaction/functions/fnc_addToTooltip.sqf b/addons/interaction/functions/fnc_addToTooltip.sqf index 894223b68e..9f5595a9bc 100644 --- a/addons/interaction/functions/fnc_addToTooltip.sqf +++ b/addons/interaction/functions/fnc_addToTooltip.sqf @@ -2,4 +2,4 @@ #include "script_component.hpp" -QGVAR(CurrentTooltip) pushBack (_this select 0); +GVAR(CurrentTooltip) pushBack (_this select 0); diff --git a/addons/interaction/functions/fnc_getActions2.sqf b/addons/interaction/functions/fnc_getActions2.sqf index ab64d8d390..0de4f7a534 100644 --- a/addons/interaction/functions/fnc_getActions2.sqf +++ b/addons/interaction/functions/fnc_getActions2.sqf @@ -66,7 +66,7 @@ _cacheIndices = _cache select 2; _statement = getText (_action >> "statement"); _statement = compile _statement; - if (profileNamespace getVariable ["ACE_Interaction_FlowMenu", false]) then { + if (GVAR(FlowMenu)) then { _statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then { compile format [QUOTE( call FUNC(hideMenu);if(%2 == 1)then{['%1'] call FUNC(openSubMenuSelf);}else{['%1'] call FUNC(openSubMenu);}; ), _subMenu select 0, _subMenu select 1]; } else { diff --git a/addons/interaction/functions/fnc_initialiseInteraction.sqf b/addons/interaction/functions/fnc_initialiseInteraction.sqf index 2637d28bf9..4d88eb4ea1 100644 --- a/addons/interaction/functions/fnc_initialiseInteraction.sqf +++ b/addons/interaction/functions/fnc_initialiseInteraction.sqf @@ -67,7 +67,7 @@ if (_this select 2) then { disableSerialization; _dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog); _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3; - if (profileNamespace getVariable [QGVAR(AutoCenterCursor), true]) then {setMousePosition [0.5, 0.5]}; + if (GVAR(AutoCenterCursor)) then {setMousePosition [0.5, 0.5]}; if !(_subMenu) then { _ctrlInteractionDialog ctrlSetText ([_target] call EFUNC(common,getName)); } else { diff --git a/addons/interaction/functions/fnc_moduleInteraction.sqf b/addons/interaction/functions/fnc_moduleInteraction.sqf index 78fd6e2acc..37b7bacba5 100644 --- a/addons/interaction/functions/fnc_moduleInteraction.sqf +++ b/addons/interaction/functions/fnc_moduleInteraction.sqf @@ -16,6 +16,6 @@ _activated = _this select 2; if !(_activated) exitWith {}; -[_logic, QGVAR(EnableTeamManagement), "EnableTeamManagement"] call EFUNC(common,readBooleanParameterFromModule); +[_logic, QGVAR(EnableTeamManagement), "EnableTeamManagement"] call EFUNC(common,readSettingFromModule); diag_log text "[ACE]: Interaction Module Initialized."; diff --git a/addons/interaction/functions/fnc_tapShoulder.sqf b/addons/interaction/functions/fnc_tapShoulder.sqf index 02eed88542..262012dbb9 100644 --- a/addons/interaction/functions/fnc_tapShoulder.sqf +++ b/addons/interaction/functions/fnc_tapShoulder.sqf @@ -1,21 +1,22 @@ // by commy2 #include "script_component.hpp" -private ["_unit", "_message"]; - -_tapper = _this select 0; -_target = _this select 1; +EXPLODE_3_PVT(_this,_tapper,_target,_shoulderNum); if (_target != ACE_player) exitWith { - addCamShake [4, 0.5, 5]; - if !(local _target) then { - [[_tapper, _target], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc); - }; + addCamShake [4, 0.5, 5]; + ACE_player playActionNow 'gestureAdvance'; + if !(local _target) then { + [[_tapper, _target, _shoulderNum], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc); + }; }; addCamShake [4, 0.5, 5]; -//_message = format ["%1 tapped you on your shoulder.", [_unit] call EFUNC(common,getName)]; -_message = localize "STR_ACE_Interaction_YouWereTapped"; +if (_shoulderNum == 0) then { + _message = localize "STR_ACE_Interaction_YouWereTappedRight"; +} else { + _message = localize "STR_ACE_Interaction_YouWereTappedLeft"; +}; [_message] call EFUNC(common,displayTextStructured); diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index e58e808687..960d136c0f 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -2,6 +2,9 @@ + + Interactions >> + Interaction Menu Interaktionsmenü @@ -338,17 +341,29 @@ Tocar ombro Dai un colpetto - - You were tapped on the shoulder. - Dir wurde auf die Schulter geklopft - Te tocaron el hombro. - On te tape sur l'épaule. - Zostałeś klepnięty po ramieniu - Vállonveregettek - Někdo tě poklepal na rameno. - Вас похлопали по плечу - Você foi tocado no ombro. - Ti è stato dato un colpetto sulla spalla + + You were tapped on the RIGHT shoulder > + Te tocaron el hombro DERECHO > + Dir wurde auf die Schulter geklopft > + On te tape sur l'épaule > + Zostałeś klepnięty po ramieniu > + Vállonveregettek > + Někdo tě poklepal na rameno > + Вас похлопали по плечу > + Você foi tocado no ombro > + Ti è stato dato un colpetto sulla spalla > + + + < You were tapped on the LEFT shoulder. + < Te tocaron el hombro IZQUIERDO. + < Dir wurde auf die Schulter geklopft + < On te tape sur l'épaule. + < Zostałeś klepnięty po ramieniu + < Vállonveregettek + < Někdo tě poklepal na rameno. + < Вас похлопали по плечу + < Você foi tocado no ombro. + < Ti è stato dato un colpetto sulla spalla Cancel diff --git a/addons/laser_selfdesignate/CfgEventhandlers.hpp b/addons/laser_selfdesignate/CfgEventhandlers.hpp index 27cc988813..ea33d05bcb 100644 --- a/addons/laser_selfdesignate/CfgEventhandlers.hpp +++ b/addons/laser_selfdesignate/CfgEventhandlers.hpp @@ -1,27 +1,27 @@ class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_pre_init)); - }; + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_pre_init)); + }; }; class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_post_init)); - }; + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_post_init)); + }; }; class Extended_GetIn_EventHandlers { - class B_Heli_Attack_01_F { - class ADDON { - getIn = QUOTE(call FUNC(onGetin)); - }; - } + class B_Heli_Attack_01_F { + class ADDON { + getIn = QUOTE(call FUNC(onGetin)); + }; + }; }; class Extended_GetOut_EventHandlers { - class B_Heli_Attack_01_F { - class ADDON { - getOut = QUOTE(call FUNC(onGetout)); - }; - }; + class B_Heli_Attack_01_F { + class ADDON { + getOut = QUOTE(call FUNC(onGetout)); + }; + }; }; diff --git a/addons/laser_selfdesignate/CfgUI.hpp b/addons/laser_selfdesignate/CfgUI.hpp index 11fab908d7..e8823e04f8 100644 --- a/addons/laser_selfdesignate/CfgUI.hpp +++ b/addons/laser_selfdesignate/CfgUI.hpp @@ -4,29 +4,29 @@ class RscControlsGroupNoScrollbars; /* This disables air radar. We need to make this a seperate HUD addon class RscInGameUI { - class RscUnitInfo - { - class CA_Radar: RscControlsGroupNoScrollbars - { - class controls - { - class CA_RadarBackground: RscPicture { - colorText[] = {0,0,0,0}; - text = ""; - }; - class CA_RadarIcon: RscPicture { - colorText[] = {0,0,0,0}; - }; - class CA_Heading: RscText { - colorText[] = {0,0,0,0}; - }; - }; - }; - }; + class RscUnitInfo + { + class CA_Radar: RscControlsGroupNoScrollbars + { + class controls + { + class CA_RadarBackground: RscPicture { + colorText[] = {0,0,0,0}; + text = ""; + }; + class CA_RadarIcon: RscPicture { + colorText[] = {0,0,0,0}; + }; + class CA_Heading: RscText { + colorText[] = {0,0,0,0}; + }; + }; + }; + }; }; class CfgInGameUI { - + }; */ \ No newline at end of file diff --git a/addons/laser_selfdesignate/CfgVehicles.hpp b/addons/laser_selfdesignate/CfgVehicles.hpp index eed000544c..5b2fdd7d28 100644 --- a/addons/laser_selfdesignate/CfgVehicles.hpp +++ b/addons/laser_selfdesignate/CfgVehicles.hpp @@ -1,35 +1,30 @@ class CfgVehicles { - class AllVehicles; - - class Air: AllVehicles { - class Turrets; - }; - class Helicopter: Air - { - class Turrets: Turrets { - class MainTurret; - }; - // TODO: move these to a different HUD addon - // commanderCanSee = 2+32; - // gunnerCanSee = 2+32; - // driverCanSee = 2+32; + class AllVehicles; + class Air: AllVehicles { + class Turrets; + }; - }; - class Helicopter_Base_F: Helicopter { - class Turrets: Turrets { - class MainTurret: MainTurret {}; - }; - }; - class Heli_Attack_01_base_F: Helicopter_Base_F { - class Turrets: Turrets { - class MainTurret: MainTurret {}; - }; - }; - class B_Heli_Attack_01_F: Heli_Attack_01_base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - stabilizedInAxes = 4; // This stablizes the turret a bit more for laser designation - }; - }; - }; -}; \ No newline at end of file + class Helicopter: Air { + class Turrets { + class MainTurret; + }; + + // TODO: move these to a different HUD addon + // commanderCanSee = 2+32; + // gunnerCanSee = 2+32; + // driverCanSee = 2+32; + + }; + + class Helicopter_Base_F: Helicopter {}; + + class Heli_Attack_01_base_F: Helicopter_Base_F {}; + + class B_Heli_Attack_01_F: Heli_Attack_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + stabilizedInAxes = 4; // This stablizes the turret a bit more for laser designation + }; + }; + }; +}; diff --git a/addons/laser_selfdesignate/CfgWeapons.hpp b/addons/laser_selfdesignate/CfgWeapons.hpp index a966144b10..a62974ce40 100644 --- a/addons/laser_selfdesignate/CfgWeapons.hpp +++ b/addons/laser_selfdesignate/CfgWeapons.hpp @@ -1,10 +1,11 @@ class CfgWeapons { - class LauncherCore; - - class RocketPods: LauncherCore { - canLock = 1; // Disable locking unless newb mode - }; - class missiles_DAGR: RocketPods { - canLock = 1; // Disable locking unless newb mode - }; -}; \ No newline at end of file + // Disable locking unless newb mode + class LauncherCore; + class RocketPods: LauncherCore { + canLock = 1; + }; + + class missiles_DAGR: RocketPods { + canLock = 1; + }; +}; diff --git a/addons/laser_selfdesignate/config.cpp b/addons/laser_selfdesignate/config.cpp index 5452ee4e22..e19e438da0 100644 --- a/addons/laser_selfdesignate/config.cpp +++ b/addons/laser_selfdesignate/config.cpp @@ -1,17 +1,17 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { "ace_main", "ace_laser" }; - version = VERSION; - }; + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_main", "ace_laser"}; + version = VERSION; + }; }; #include "CfgUI.hpp" #include "CfgEventhandlers.hpp" #include "CfgWeapons.hpp" -#include "CfgVehicles.hpp" \ No newline at end of file +#include "CfgVehicles.hpp" diff --git a/addons/laserpointer/XEH_preInit.sqf b/addons/laserpointer/XEH_preInit.sqf index 3a89535f2e..e7c74d3445 100644 --- a/addons/laserpointer/XEH_preInit.sqf +++ b/addons/laserpointer/XEH_preInit.sqf @@ -1,4 +1,8 @@ #include "script_component.hpp" +ADDON = false; + PREP(drawLaserpoint); PREP(onDraw); + +ADDON = true; diff --git a/addons/lockbackpacks/XEH_preInit.sqf b/addons/lockbackpacks/XEH_preInit.sqf index 77b8885da4..c474ff625a 100644 --- a/addons/lockbackpacks/XEH_preInit.sqf +++ b/addons/lockbackpacks/XEH_preInit.sqf @@ -1,5 +1,9 @@ #include "script_component.hpp" +ADDON = false; + PREP(getBackpackAssignedUnit); PREP(isBackpack); PREP(onOpenInventory); + +ADDON = true; diff --git a/addons/logistics_uavbattery/$PBOPREFIX$ b/addons/logistics_uavbattery/$PBOPREFIX$ new file mode 100644 index 0000000000..f1db4e78f0 --- /dev/null +++ b/addons/logistics_uavbattery/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\logistics_uavbattery \ No newline at end of file diff --git a/addons/logistics_uavbattery/CfgEventHandlers.hpp b/addons/logistics_uavbattery/CfgEventHandlers.hpp new file mode 100644 index 0000000000..b928bc2de6 --- /dev/null +++ b/addons/logistics_uavbattery/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/logistics_uavbattery/CfgSounds.hpp b/addons/logistics_uavbattery/CfgSounds.hpp new file mode 100644 index 0000000000..530c5b86a9 --- /dev/null +++ b/addons/logistics_uavbattery/CfgSounds.hpp @@ -0,0 +1,7 @@ +class CfgSounds { + class ACE_replaceUAVBattery { + name = "ACE_replaceUAVBattery"; + sound[]={QUOTE(PATHTOF(sounds\exchange_battery.ogg)),1,1}; + titles[]={}; + }; +}; diff --git a/addons/logistics_uavbattery/CfgVehicles.hpp b/addons/logistics_uavbattery/CfgVehicles.hpp new file mode 100644 index 0000000000..a3a3fc763d --- /dev/null +++ b/addons/logistics_uavbattery/CfgVehicles.hpp @@ -0,0 +1,29 @@ +class CfgVehicles { + class Helicopter_Base_F; + class UAV_01_base_F: Helicopter_Base_F { + class ACE_Actions { + class ACE_MainActions { + class GVAR(RefuelUAV) { + displayName = "$STR_ACE_logistics_uavbattery_Recharge"; + distance = 4; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRefuelUAV)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(refuelUAV)); + showDisabled = 0; \ + priority = 1.245; \ + icon = QUOTE(PATHTOF(ui\UAV_battery.paa)); + }; + }; + }; + }; + + // Misc box content + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + class _xx_ACE_UAVBattery { + count = 6; + name = "ACE_UAVBattery"; + }; + }; + }; +}; diff --git a/addons/logistics_uavbattery/CfgWeapons.hpp b/addons/logistics_uavbattery/CfgWeapons.hpp new file mode 100644 index 0000000000..e84e053347 --- /dev/null +++ b/addons/logistics_uavbattery/CfgWeapons.hpp @@ -0,0 +1,15 @@ +class CfgWeapons { + class InventoryItem_Base_F; + class ACE_ItemCore; + + class ACE_UAVBattery: ACE_ItemCore { + scope = 2; + displayName = "$STR_ACE_logistics_uavbattery_Battery_Name"; + descriptionShort = "$STR_ACE_logistics_uavbattery_Battery_Description"; + model = QUOTE(PATHTOF(models\ace_battery.p3d)); + picture = QUOTE(PATHTOF(ui\UAV_battery.paa)); + class ItemInfo: InventoryItem_Base_F { + mass = 20; + }; + }; +}; diff --git a/addons/logistics_uavbattery/README.md b/addons/logistics_uavbattery/README.md new file mode 100644 index 0000000000..8c89913459 --- /dev/null +++ b/addons/logistics_uavbattery/README.md @@ -0,0 +1,11 @@ +ace_logistics_uavbattery +=========== + +Adds an item `ACE_UAVBattery` that allows refueling/recharging of the "Dartar" quadcopter UAVs. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [PabstMirror](https://github.com/PabstMirror) diff --git a/addons/logistics_uavbattery/XEH_preInit.sqf b/addons/logistics_uavbattery/XEH_preInit.sqf new file mode 100644 index 0000000000..f41b2c4ce8 --- /dev/null +++ b/addons/logistics_uavbattery/XEH_preInit.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(canRefuelUAV); +PREP(refuelUAV); + +ADDON = true; diff --git a/addons/logistics_uavbattery/config.cpp b/addons/logistics_uavbattery/config.cpp new file mode 100644 index 0000000000..32d8c49978 --- /dev/null +++ b/addons/logistics_uavbattery/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {"ACE_UAVBattery"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common", "ace_interaction"}; + author[] = {"marc_book"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" +#include "CfgSounds.hpp" diff --git a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf new file mode 100644 index 0000000000..aaaac3077d --- /dev/null +++ b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf @@ -0,0 +1,21 @@ +/* + * Author: marc_book + * Tests if unit can refuel the target UAV + * + * Arguments: + * 0: Player + * 1: UAV + * + * Return Value: + * Can the player rechange the UAV + * + * Example: + * [player, theUAV] call ace_logistics_uavbattery_fnc_canRefuelUAV + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_caller,_target); + +("ACE_UAVBattery" in (items _caller)) && {(fuel _target) < 1} && {(speed _target) < 1} && {!(isEngineOn _target)} && {(_target distance _caller) <= 4} diff --git a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf new file mode 100644 index 0000000000..a23969aa9f --- /dev/null +++ b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf @@ -0,0 +1,37 @@ +/* + * Author: marc_book + * Starts refueling/recharging the 'Dartar' UAVs + * + * Arguments: + * 0: Player + * 1: UAV + * + * Return Value: + * Nothing + * + * Example: + * [player, theUAV] call ace_logistics_uavbattery_fnc_refuelUAV + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_caller,_target); + +if (!(_this call FUNC(canRefuelUAV))) exitWith {}; + +_onFinish = { + EXPLODE_2_PVT((_this select 0),_caller,_target); + _caller removeItem "ACE_UAVBattery"; + playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10]; + ["VehicleSetFuel", [_target], [_target, 1]] call EFUNC(common,targetEvent); //setFuel is local +}; + +_onFailure = { + EXPLODE_2_PVT((_this select 0),_caller,_target); + [_caller, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); +}; + +[_caller, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); + +[10, [_caller, _target], _onFinish, _onFailure, (localize "STR_ACE_logistics_uavbattery_Battery_Recharge"), {(_this select 0) call FUNC(canRefuelUAV)}] call EFUNC(common,progressBar); diff --git a/addons/logistics_uavbattery/functions/script_component.hpp b/addons/logistics_uavbattery/functions/script_component.hpp new file mode 100644 index 0000000000..56cb8114f5 --- /dev/null +++ b/addons/logistics_uavbattery/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\logistics_uavbattery\script_component.hpp" \ No newline at end of file diff --git a/addons/logistics_uavbattery/models/ace_battery.p3d b/addons/logistics_uavbattery/models/ace_battery.p3d new file mode 100644 index 0000000000..bf756d62cb Binary files /dev/null and b/addons/logistics_uavbattery/models/ace_battery.p3d differ diff --git a/addons/logistics_uavbattery/models/battery.rvmat b/addons/logistics_uavbattery/models/battery.rvmat new file mode 100644 index 0000000000..36329ac896 --- /dev/null +++ b/addons/logistics_uavbattery/models/battery.rvmat @@ -0,0 +1,79 @@ +ambient[]={1,1,1,1}; +diffuse[]={1,1,1,1}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.01,0.01,0.01,1}; //amount of glossiness - the higher the number, the higher the glossiness +specularPower=500; //area of glossiness - the higher the number, the smaller the area +PixelShaderID="Super"; +VertexShaderID="Super"; + +class Stage1 { + texture="z\ace\addons\logistics_uavbattery\models\battery_nohq.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,mc)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 { + texture="z\ace\addons\logistics_uavbattery\models\default_as.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,1}; + }; +}; +class Stage5 { + texture="z\ace\addons\logistics_uavbattery\models\battery_smdi.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 { + texture="#(ai,64,64,1)fresnel(4.7,1.2)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; +class Stage7 { + texture="a3\data_f\env_land_ca.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/logistics_uavbattery/models/battery_co.paa b/addons/logistics_uavbattery/models/battery_co.paa new file mode 100644 index 0000000000..14abfa75b0 Binary files /dev/null and b/addons/logistics_uavbattery/models/battery_co.paa differ diff --git a/addons/logistics_uavbattery/models/battery_nohq.paa b/addons/logistics_uavbattery/models/battery_nohq.paa new file mode 100644 index 0000000000..11b7e6e14d Binary files /dev/null and b/addons/logistics_uavbattery/models/battery_nohq.paa differ diff --git a/addons/logistics_uavbattery/models/battery_smdi.paa b/addons/logistics_uavbattery/models/battery_smdi.paa new file mode 100644 index 0000000000..85ea45371f Binary files /dev/null and b/addons/logistics_uavbattery/models/battery_smdi.paa differ diff --git a/addons/logistics_uavbattery/models/default_as.paa b/addons/logistics_uavbattery/models/default_as.paa new file mode 100644 index 0000000000..b7efce459b Binary files /dev/null and b/addons/logistics_uavbattery/models/default_as.paa differ diff --git a/addons/logistics_uavbattery/script_component.hpp b/addons/logistics_uavbattery/script_component.hpp new file mode 100644 index 0000000000..01ea3608e7 --- /dev/null +++ b/addons/logistics_uavbattery/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT logistics_uavbattery +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_LOGISTICS_UAVBATTERY + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_LOGISTICS_UAVBATTERY + #define DEBUG_SETTINGS DEBUG_SETTINGS_LOGISTICS_UAVBATTERY +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/logistics_uavbattery/sounds/exchange_battery.ogg b/addons/logistics_uavbattery/sounds/exchange_battery.ogg new file mode 100644 index 0000000000..5a40ddb47a Binary files /dev/null and b/addons/logistics_uavbattery/sounds/exchange_battery.ogg differ diff --git a/addons/logistics_uavbattery/stringtable.xml b/addons/logistics_uavbattery/stringtable.xml new file mode 100644 index 0000000000..fbd9004290 --- /dev/null +++ b/addons/logistics_uavbattery/stringtable.xml @@ -0,0 +1,78 @@ + + + + + + Drone is full + Drohne ist voll + El VANT está lleno + L'UAV est chargé + Dron jest naładowany + A drón fel van töltve + Dron je nabitý + O VANT está cheio + Il drone è pieno + БПЛА заполнен + + + You need a UAV Battery + Du brauchst eine UAV-Batterie + Necesitas una batería para VANT + Pas de batterie UAV + Potrzebujesz baterii UAV + Szükséged van egy UAV akkumulátorra + Potřebuješ UAV-Baterii + Você precisa de uma Bateria para VANT + Hai bisogno di una Batteria UAV + Требуется аккумулятор БПЛА + + + Recharge + Aufladen + Recargar + Recharger + Naładuj + Feltöltés + Dobít + Recarregar + Ricarica + Подзарядить + + + UAV Battery + UAV-Batterie + Batería para VANT + Batterie UAV + Bateria UAV + UAV akkumulátor + UAV-Baterie + Bateria para VANT + Batteria UAV + Аккумулятор БПЛА + + + Used to refuel Carried UAV's + Verwendet zum Aufladen von tragbaren UAV's + Usada para reabastecer el VANT + Utilisée pour recharger l'UAV + Używana do naładowania UAV + Hordozható UAV-ok működéséhez való akkumulátor + Používané k dobíjení UAV + Usada para reabastecer VANT + Usata per ricaricare la Batteria dell'UAV + Используется для подзарядки БПЛА + + + Recharging ... + Aufladen ... + Recargando ... + Rechargement ... + Ładowanie ... + Akku feltöltése ... + Dobíjení ... + Recarregando ... + In ricarica ... + Подзаряжаем ... + + + \ No newline at end of file diff --git a/addons/logistics_uavbattery/ui/UAV_battery.paa b/addons/logistics_uavbattery/ui/UAV_battery.paa new file mode 100644 index 0000000000..5e6c0e1bf7 Binary files /dev/null and b/addons/logistics_uavbattery/ui/UAV_battery.paa differ diff --git a/addons/logistics_wirecutter/$PBOPREFIX$ b/addons/logistics_wirecutter/$PBOPREFIX$ new file mode 100644 index 0000000000..91d50071d3 --- /dev/null +++ b/addons/logistics_wirecutter/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\logistics_wirecutter \ No newline at end of file diff --git a/addons/logistics_wirecutter/CfgEventHandlers.hpp b/addons/logistics_wirecutter/CfgEventHandlers.hpp new file mode 100644 index 0000000000..f0a9f14d91 --- /dev/null +++ b/addons/logistics_wirecutter/CfgEventHandlers.hpp @@ -0,0 +1,6 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/logistics_wirecutter/CfgSounds.hpp b/addons/logistics_wirecutter/CfgSounds.hpp new file mode 100644 index 0000000000..9958190ec1 --- /dev/null +++ b/addons/logistics_wirecutter/CfgSounds.hpp @@ -0,0 +1,12 @@ +class CfgSounds { + class ACE_Wirecutter_sound { + name = "ACE_wirecutter_sound"; + sound[] = {QUOTE(PATHTOF(sound\wire_cut.ogg)), "db-0", 1}; + titles[] = {}; + }; + class ACE_Wirecutter_sound_long { + name = "ACE_wirecutter_sound_long"; + sound[] = {QUOTE(PATHTOF(sound\wire_cut_long.ogg)), "db-0", 1}; + titles[] = {}; + }; +}; diff --git a/addons/logistics_wirecutter/CfgVehicles.hpp b/addons/logistics_wirecutter/CfgVehicles.hpp new file mode 100644 index 0000000000..8a16d1b828 --- /dev/null +++ b/addons/logistics_wirecutter/CfgVehicles.hpp @@ -0,0 +1,19 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(CutFence) { + displayName = "$STR_ACE_logistics_wirecutter_CutFence"; + condition = QUOTE([_player] call FUNC(canCutFence)); + statement = QUOTE([_player] call FUNC(cutDownFence)); + exceptions[] = {}; + showDisabled = 1; + priority = 0; + icon = PATHTOF(UI\wirecutter_ca.paa); + hotkey = "C"; + }; + }; + }; + }; +}; \ No newline at end of file diff --git a/addons/logistics_wirecutter/CfgWeapons.hpp b/addons/logistics_wirecutter/CfgWeapons.hpp new file mode 100644 index 0000000000..76b1003f34 --- /dev/null +++ b/addons/logistics_wirecutter/CfgWeapons.hpp @@ -0,0 +1,16 @@ +class CfgWeapons { + class InventoryItem_Base_F; + class ACE_ItemCore; + + class ACE_wirecutter: ACE_ItemCore { + author = "$STR_ACE_Common_ACETeam"; + displayName = "$STR_ACE_logistics_wirecutter_wirecutterName"; + descriptionShort = "$STR_ACE_logistics_wirecutter_wirecutterDescription"; + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 100; + }; + }; +}; diff --git a/addons/logistics_wirecutter/README.md b/addons/logistics_wirecutter/README.md new file mode 100644 index 0000000000..e0bef0bed6 --- /dev/null +++ b/addons/logistics_wirecutter/README.md @@ -0,0 +1,11 @@ +ace_logistics_wirecutter +=========== + +Adds an item `ACE_wirecutter` that allows cutting of fences in A3 and AiA maps. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [PabstMirror](https://github.com/PabstMirror) diff --git a/addons/logistics_wirecutter/XEH_preInit.sqf b/addons/logistics_wirecutter/XEH_preInit.sqf new file mode 100644 index 0000000000..7588a109e6 --- /dev/null +++ b/addons/logistics_wirecutter/XEH_preInit.sqf @@ -0,0 +1,12 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(canCutFence); +PREP(cutDownFence); +PREP(cutDownFenceAbort); +PREP(cutDownFenceCallback); +PREP(getNearestFence); +PREP(isFence); + +ADDON = true; diff --git a/addons/logistics_wirecutter/config.cpp b/addons/logistics_wirecutter/config.cpp new file mode 100644 index 0000000000..7f292132fa --- /dev/null +++ b/addons/logistics_wirecutter/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common", "ace_interaction"}; + author[] = {"gpgpgpgp", "PabstMirror"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgSounds.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/logistics_wirecutter/functions/fnc_canCutFence.sqf b/addons/logistics_wirecutter/functions/fnc_canCutFence.sqf new file mode 100644 index 0000000000..f57a970d58 --- /dev/null +++ b/addons/logistics_wirecutter/functions/fnc_canCutFence.sqf @@ -0,0 +1,18 @@ +/* fnc_canCutFence.sqf +* +* Author: PabstMirror +* +* Condition check if player is able to cut a fence. +* Checks for "ACE_wirecutter" item and if there is a nearby fence. +* +* Argument: +* 0: OBJECT - Unit to check condition for (player) +* +* Return value: +* BOOL +*/ + +#include "script_component.hpp" +PARAMS_1(_unit); + +("ACE_wirecutter" in (items _unit)) && {!(isNull ([_unit] call FUNC(getNearestFence)))} diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf new file mode 100644 index 0000000000..0a42d5d56b --- /dev/null +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf @@ -0,0 +1,23 @@ +// by gpgpgpgp, edited by commy2 +#include "script_component.hpp" + +PARAMS_1(_unit); +if (_unit != ACE_player) exitWith {}; + +_fenceObject = [ACE_player] call FUNC(getNearestFence); +if (isNull _fenceObject) exitWith {}; + +_timeToCut = 5; +if !([ACE_player] call EFUNC(common,isEngineer)) then { + _timeToCut = _timeToCut + 5; +}; + +[ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); + +if (_timeToCut > 4.5) then { + playSound "ACE_wirecutter_sound_long"; +} else { + playSound "ACE_wirecutter_sound"; +}; + +[_timeToCut, [_fenceObject], {(_this select 0) call FUNC(cutDownFenceCallback)}, {(_this select 0) call FUNC(cutDownFenceAbort)}, localize "STR_ACE_logistics_wirecutter_CuttingFence"] call EFUNC(common,progressBar); diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFenceAbort.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFenceAbort.sqf new file mode 100644 index 0000000000..d17038af7c --- /dev/null +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFenceAbort.sqf @@ -0,0 +1,4 @@ +// by commy2 +#include "script_component.hpp" + +[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFenceCallback.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFenceCallback.sqf new file mode 100644 index 0000000000..57c0289461 --- /dev/null +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFenceCallback.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +PARAMS_1(_fenceObject); + +_fenceObject setdamage 1; +[localize "STR_ACE_logistics_wirecutter_FenceCut"] call EFUNC(common,displayTextStructured); +[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); diff --git a/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf b/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf new file mode 100644 index 0000000000..5004315fcd --- /dev/null +++ b/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf @@ -0,0 +1,25 @@ +/* fnc_getNearestFence.sqf +* +* Author: PabstMirror +* +* Gets nearest fence within 5 meters to the unit. +* +* Argument: +* 0: OBJECT - Unit to search for fence objects arround +* +* Return value: +* OBJECT - Nearest object that is a fence, objNull if none found. +*/ +#include "script_component.hpp" + +private "_nearestFence"; +PARAMS_1(_unit); + +_nearestFence = objNull; +{ + if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then { + _nearestFence = _x; + }; +} forEach nearestObjects [_unit, [], 5]; + +_nearestFence diff --git a/addons/logistics_wirecutter/functions/fnc_isFence.sqf b/addons/logistics_wirecutter/functions/fnc_isFence.sqf new file mode 100644 index 0000000000..2c00cec92b --- /dev/null +++ b/addons/logistics_wirecutter/functions/fnc_isFence.sqf @@ -0,0 +1,40 @@ +/* fnc_isFence.sqf +* +* Author: PabstMirror +* +* Checks if object is a fence. Should work on any fence type, even (typeof == ""). +* Call is fairly expensive because of all of the string checking. +* +* Argument: +* 0: OBJECT - Ojbect to test +* +* Return value: +* BOOL +*/ +#include "script_component.hpp" + +//find is case sensitive, so keep everything lowercase +#define FENCE_A3_TYPENAMES ["land_net_fence_4m_f", "land_net_fence_8m_f", "land_net_fenced_8m_f", "land_new_wiredfence_5m_f", "land_new_wiredfence_10m_dam_f", "land_new_wiredfence_10m_f", "land_pipe_fence_4m_f", "land_pipe_fence_4mnolc_f", "land_sportground_fence_f", "land_wired_fence_4m_f", "land_wired_fence_4md_f", "land_wired_fence_8m_f", "land_wired_fence_8md_f", "land_razorwire_f"] +#define FENCE_A3_P3DS ["mil_wiredfence_f.p3d"] + +#define FENCE_AIA_TYPENAMES [] +#define FENCE_AIA_P3DS ["wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"] + +private ["_typeOf", "_returnValue"]; +PARAMS_1(_object); + +_typeOf = toLower (typeOf _object); +_returnValue = false; + +if (_typeOf != "") then { + _returnValue = _typeOf in (FENCE_A3_TYPENAMES + FENCE_AIA_TYPENAMES); +} else { + _typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d" + { + if ((_typeOf find _x) != -1) then { + _returnValue = true; + }; + } forEach (FENCE_A3_P3DS + FENCE_AIA_P3DS); +}; + +_returnValue diff --git a/addons/logistics_wirecutter/functions/script_component.hpp b/addons/logistics_wirecutter/functions/script_component.hpp new file mode 100644 index 0000000000..4a5c48048c --- /dev/null +++ b/addons/logistics_wirecutter/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\logistics_wirecutter\script_component.hpp" \ No newline at end of file diff --git a/addons/logistics_wirecutter/script_component.hpp b/addons/logistics_wirecutter/script_component.hpp new file mode 100644 index 0000000000..6dae60dfd2 --- /dev/null +++ b/addons/logistics_wirecutter/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT logistics_wirecutter +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_LOGISTICS_WIRECUTTER + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_LOGISTICS_WIRECUTTER + #define DEBUG_SETTINGS DEBUG_SETTINGS_LOGISTICS_WIRECUTTER +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/logistics_wirecutter/sound/wire_cut.ogg b/addons/logistics_wirecutter/sound/wire_cut.ogg new file mode 100644 index 0000000000..246b15432c Binary files /dev/null and b/addons/logistics_wirecutter/sound/wire_cut.ogg differ diff --git a/addons/logistics_wirecutter/sound/wire_cut_long.ogg b/addons/logistics_wirecutter/sound/wire_cut_long.ogg new file mode 100644 index 0000000000..36d25c9c73 Binary files /dev/null and b/addons/logistics_wirecutter/sound/wire_cut_long.ogg differ diff --git a/addons/logistics_wirecutter/stringtable.xml b/addons/logistics_wirecutter/stringtable.xml new file mode 100644 index 0000000000..cf6e96c1aa --- /dev/null +++ b/addons/logistics_wirecutter/stringtable.xml @@ -0,0 +1,50 @@ + + + + + + Wirecutter + Drahtschneider + Wirecutter + + + Wirecutter + + + Cut Fence + Zaun schneiden + Cortar alambrado + Przetnij płot + Přestřihnout plot + Cisailler Clôture + Cortar Cerca + Taglia + Drótkerítés átvágása + Вырезать забор + + + Cutting Fences / Wires ... + Zaun / Draht schneiden ... + Cortando alambrado / cables ... + Przecinanie płotu / drutów ... + Přestřihnout plot / dráty ... + Cisaille l'obstacle ... + Cortando Cerca / Arame ... + Sto tagliando ... + Drótok elvágása ... + Вырезаем забор / провода ... + + + Fence cut + Zaun geschnitten + Alambrado cortado + Płot przecięty + Plot přestřižen + Clôture cisaillée + Cerca cortada + Fatto! + Drótkerítés átvágva + Забор вырезан + + + \ No newline at end of file diff --git a/addons/logistics_wirecutter/ui/item_wirecutter_ca.paa b/addons/logistics_wirecutter/ui/item_wirecutter_ca.paa new file mode 100644 index 0000000000..768b061359 Binary files /dev/null and b/addons/logistics_wirecutter/ui/item_wirecutter_ca.paa differ diff --git a/addons/logistics_wirecutter/ui/wirecutter_ca.paa b/addons/logistics_wirecutter/ui/wirecutter_ca.paa new file mode 100644 index 0000000000..8cd2165385 Binary files /dev/null and b/addons/logistics_wirecutter/ui/wirecutter_ca.paa differ diff --git a/addons/magazinerepack/CfgEventHandlers.hpp b/addons/magazinerepack/CfgEventHandlers.hpp index f0a9f14d91..b928bc2de6 100644 --- a/addons/magazinerepack/CfgEventHandlers.hpp +++ b/addons/magazinerepack/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/magazinerepack/CfgSounds.hpp b/addons/magazinerepack/CfgSounds.hpp new file mode 100644 index 0000000000..1390397e5e --- /dev/null +++ b/addons/magazinerepack/CfgSounds.hpp @@ -0,0 +1,12 @@ +class CfgSounds { + class GVAR(soundMagazineFinished) { + name = QGVAR(soundMagazineFinished); + sound[]={QUOTE(PATHTOF(sounds\magrepack_finished.wav)),1,1}; + titles[]={}; + }; + class GVAR(soundRoundFinished) { + name = QGVAR(soundRoundFinished); + sound[] = {QUOTE(PATHTOF(sounds\magrepack_single.wav)),1,1}; + titles[] = {}; + }; +}; diff --git a/addons/magazinerepack/CfgVehicles.hpp b/addons/magazinerepack/CfgVehicles.hpp index ecb732f8fd..acd1c76c3d 100644 --- a/addons/magazinerepack/CfgVehicles.hpp +++ b/addons/magazinerepack/CfgVehicles.hpp @@ -1,18 +1,17 @@ - class CfgVehicles { - class Man; - class CAManBase: Man { - class ACE_SelfActions { - class ACE_RepackMagazines { - displayName = "$STR_ACE_MagazineRepack_RepackMagazines"; - condition = QUOTE(true); - statement = QUOTE([_player] call FUNC(magazineRepack)); - showDisabled = 0; - priority = -2; - icon = PATHTOF(UI\repack_ca.paa); - hotkey = "R"; - enableInside = 1; - }; + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_RepackMagazines { + displayName = "$STR_ACE_MagazineRepack_RepackMagazines"; + condition = QUOTE(true); + statement = QUOTE([_player] call FUNC(openSelectMagazineUI)); + showDisabled = 0; + priority = -2; + icon = QUOTE(PATHTOF(UI\repack_ca.paa)); + hotkey = "R"; + enableInside = 1; + }; + }; }; - }; }; diff --git a/addons/magazinerepack/README.md b/addons/magazinerepack/README.md index 49a3c9d531..28b7c3115a 100644 --- a/addons/magazinerepack/README.md +++ b/addons/magazinerepack/README.md @@ -3,10 +3,10 @@ ace_magazinerepack Adds the ability to consolidate multiple half-empty magazines. - ## Maintainers The people responsible for merging changes to this component or answering potential questions. - [commy2](https://github.com/commy2) - [esteldunedain](https://github.com/esteldunedain) +- [PabstMirror](https://github.com/PabstMirror) diff --git a/addons/magazinerepack/XEH_preInit.sqf b/addons/magazinerepack/XEH_preInit.sqf index e811ff60c6..7cd7107f54 100644 --- a/addons/magazinerepack/XEH_preInit.sqf +++ b/addons/magazinerepack/XEH_preInit.sqf @@ -1,5 +1,11 @@ #include "script_component.hpp" -PREP(magazineRepack); -PREP(magazineRepackCallback); +ADDON = false; + +PREP(magazineRepackFinish); +PREP(magazineRepackProgress); PREP(openSelectMagazineUI); +PREP(simulateRepackEvents); +PREP(startRepackingMagazine); + +ADDON = true; diff --git a/addons/magazinerepack/config.cpp b/addons/magazinerepack/config.cpp index 5f2c6edc7d..514a74350a 100644 --- a/addons/magazinerepack/config.cpp +++ b/addons/magazinerepack/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common","ace_interaction"}; + requiredAddons[] = {"ace_interaction"}; author[] = {"commy2","CAA-Picard"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; @@ -13,9 +13,16 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgSounds.hpp" #include "CfgVehicles.hpp" -class ACE_Parameters_Numeric { - GVAR(TimePerAmmo) = 1.5; - GVAR(TimePerMagazine) = 2.0; +class ACE_Settings { + class GVAR(TimePerAmmo) { + value = 1.5; + typeName = "SCALAR"; + }; + class GVAR(TimePerMagazine) { + value = 2.0; + typeName = "SCALAR"; + }; }; diff --git a/addons/magazinerepack/functions/fnc_magazineRepack.sqf b/addons/magazinerepack/functions/fnc_magazineRepack.sqf deleted file mode 100644 index 472b80e2bd..0000000000 --- a/addons/magazinerepack/functions/fnc_magazineRepack.sqf +++ /dev/null @@ -1,77 +0,0 @@ -// by commy2, esteldunedain -#include "script_component.hpp" - -private ["_unit", "_magazines", "_ammos", "_repackTime", "_magazine", "_ammo", "_count", "_index", "_i", "_j", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; - -_unit = _this select 0; - -_magazines = []; -_ammos = []; -_repackTime = []; - -// get all mags and ammo count -{ - _magazine = _x select 0; - _ammo = _x select 1; - - _count = getNumber (configfile >> "CfgMagazines" >> _magazine >> "count"); - - if (_ammo != _count && {_count > 1}) then { // additional checks here - if !(_magazine in _magazines) then { - _index = count _magazines; - _magazines set [_index, _magazine]; - _ammos set [_index, [_ammo]]; - } else { - _index = _magazines find _magazine; - _ammos set [_index, (_ammos select _index) + [_ammo]]; - }; - }; -} forEach magazinesAmmoFull _unit; - -// Remove invalid magazines -{ - if (count _x < 2) then { - _magazines set [_forEachIndex, -1]; - _ammos set [_forEachIndex, [-1]]; - }; -} forEach _ammos; -_magazines = _magazines - [-1]; -_ammos = _ammos - [[-1]]; - -{ - // Calculate actual ammo to transfer during repack - _count = getNumber (configfile >> "CfgMagazines" >> (_magazines select _forEachIndex) >> "count"); - - // Sort Ascending - _list = _x call BIS_fnc_sortNum; - - ["MagazineRepack", _list] call EFUNC(common,log); - - _i = 0; - _j = count _x - 1; - _ammoToTransfer = 0; - _ammoAvailable = 0; - while {_i < _j} do { - _ammoNeeded = _count - (_list select _j); - _exit = false; - while {_i < _j && {!_exit}} do { - _ammoAvailable = _list select _i; - if (_ammoAvailable >= _ammoNeeded) then { - _list set [_i, _ammoAvailable - _ammoNeeded]; - _ammoToTransfer = _ammoToTransfer + _ammoNeeded; - _exit = true; - } else { - _ammoNeeded = _ammoNeeded - _ammoAvailable; - _ammoToTransfer = _ammoToTransfer + _ammoAvailable; - _i = _i + 1; - }; - }; - _j = _j - 1; - }; - - _repackTime set [_forEachIndex, _ammoToTransfer * GVAR(TimePerAmmo) + (count _x) * GVAR(TimePerMagazine)]; -} forEach _ammos; - -["MagazineRepack", [_magazines, _repackTime]] call EFUNC(common,log); - -[_unit, _magazines, _repackTime] call FUNC(openSelectMagazineUI); diff --git a/addons/magazinerepack/functions/fnc_magazineRepackCallback.sqf b/addons/magazinerepack/functions/fnc_magazineRepackCallback.sqf deleted file mode 100644 index f209806f9c..0000000000 --- a/addons/magazinerepack/functions/fnc_magazineRepackCallback.sqf +++ /dev/null @@ -1,106 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_unit", "_magazine", "_ammo", "_ammoCount", "_fullMagazinesCount", "_restAmmo", "_isLoaded", "_weapon", "_reloadAction", "_text", "_picture"]; - -_unit = ACE_player; //_this select 0; -_magazine = _this select 1; - -// exit if the last magazine of this type was taken out of the backpack -if !(_magazine in magazines _unit) exitWith {}; - -// get current ammo count -_ammo = 0; -{ - if (_x select 0 == _magazine) then { - _ammo = _ammo + (_x select 1); - }; -} forEach magazinesAmmoFull _unit; - -// how many rounds fit in one mag -_ammoCount = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count"); - -// calculate new vaules -_fullMagazinesCount = floor (_ammo / _ammoCount); -_restAmmo = _ammo - _fullMagazinesCount * _ammoCount; - -// remove old magazines -_unit removeMagazines _magazine; - -_isLoaded = false; -// reload rifle -if (_magazine in primaryWeaponMagazine _unit) then { - _weapon = primaryWeapon _unit; - - if (_fullMagazinesCount > 0) then { - _unit setAmmo [_weapon, _ammoCount]; - _fullMagazinesCount = _fullMagazinesCount - 1; - } else { - _unit setAmmo [_weapon, _restAmmo]; - _restAmmo = 0; - }; - - if (_weapon == currentWeapon _unit) then { - _reloadAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); - _unit playActionNow _reloadAction; - }; - - _isLoaded = true; -}; - -// reload pistol -if (_magazine in handgunMagazine _unit) then { - _weapon = handgunWeapon _unit; - - if (_fullMagazinesCount > 0) then { - _unit setAmmo [_weapon, _ammoCount]; - _fullMagazinesCount = _fullMagazinesCount - 1; - } else { - _unit setAmmo [_weapon, _restAmmo]; - _restAmmo = 0; - }; - - if (_weapon == currentWeapon _unit) then { - _reloadAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); - _unit playActionNow _reloadAction; - }; - - _isLoaded = true; -}; - -// reload rocket launcher (just in case ...) -if (_magazine in secondaryWeaponMagazine _unit) then { - _weapon = secondaryWeapon _unit; - - if (_fullMagazinesCount > 0) then { - _unit setAmmo [_weapon, _ammoCount]; - _fullMagazinesCount = _fullMagazinesCount - 1; - } else { - _unit setAmmo [_weapon, _restAmmo]; - _restAmmo = 0; - }; - - if (_weapon == currentWeapon _unit) then { - _reloadAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); - _unit playActionNow _reloadAction; - }; - - _isLoaded = true; -}; - -// add new magazines -for "_a" from 1 to _fullMagazinesCount do { - _unit addMagazine _magazine; -}; - -if (_restAmmo > 0) then { - _unit addMagazine [_magazine, _restAmmo]; -}; - -// display text if successful -_text = format [localize "STR_ACE_MagazineRepack_RepackedMagazinesDetail", [_fullMagazinesCount, _fullMagazinesCount + 1] select _isLoaded, _restAmmo]; -_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); - -_text = parseText format ["
%2
%3", _picture, localize "STR_ACE_MagazineRepack_RepackedMagazines", _text]; - -[_text] call EFUNC(common,displayTextStructured); diff --git a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf new file mode 100644 index 0000000000..038b7fb151 --- /dev/null +++ b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf @@ -0,0 +1,52 @@ +/* + * Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg) + * Simulates repacking a set of magazines. + * Returns the timing and magazines counts at every stage. + * + * Arguments: + * 0: Arguments [classname,lastAmmoStatus,events] + * 1: Elapsed Time + * 2: Total Time Repacking Will Take + * 3: Error Code + * + * Return Value: + * Nothing + * + * Example: + * (args from progressBar) call ace_magazinerepack_fnc_magazineRepackFinish + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_4(_args,_elapsedTime,_totalTime,_errorCode); +EXPLODE_2_PVT(_args,_magazineClassname,_lastAmmoCount); +_fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count"); + +_structuredOutputText = + +if (_errorCode == 0) then { + format ["%1
", (localize "STR_ACE_MagazineRepack_RepackComplete")]; +} else { + format ["%1
", (localize "STR_ACE_MagazineRepack_RepackInterrupted")]; +}; + +_picture = getText (configFile >> "CfgMagazines" >> _magazineClassname >> "picture"); +_structuredOutputText = _structuredOutputText + format ["
", _picture]; + +_fullMags = 0; +_partialMags = 0; +{ + EXPLODE_2_PVT(_x,_xClassname,_xCount); + if ((_xClassname == _magazineClassname) && {_xCount > 0}) then { + if (_xCount == _fullMagazineCount) then { + _fullMags = _fullMags + 1; + } else { + _partialMags = _partialMags + 1; + }; + }; +} forEach (magazinesAmmoFull ACE_player); + +_structuredOutputText = _structuredOutputText + format [("" + (localize "STR_ACE_MagazineRepack_RepackedMagazinesCount") + ""), _fullMags, _partialMags]; + +[parseText _structuredOutputText] call EFUNC(common,displayTextStructured); diff --git a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf new file mode 100644 index 0000000000..64ce05d12d --- /dev/null +++ b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf @@ -0,0 +1,78 @@ +/* + * Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg) + * Handles each frame durring the repack progressBar. + * On each event (repacked bullet or move to new mag) it plays a sound and syncs up the new magazines to the player. + * + * Arguments: + * 0: Arguments [classname,lastAmmoStatus,events] + * 1: Elapsed Time + * 2: Total Time Repacking Will Take + * + * Return Value: + * Keep going (on missing mags return false) + * + * Example: + * (args from progressBar) call ace_magazinerepack_fnc_magazineRepackProgress + * + * Public: No + */ +#include "script_component.hpp" + +private ["_currentAmmoCount", "_addedMagazines", "_missingAmmo", "_index", "_updateMagazinesOnPlayerFnc"]; + +PARAMS_3(_args,_elapsedTime,_totalTime); +EXPLODE_3_PVT(_args,_magazineClassname,_lastAmmoCount,_simEvents); +if ((count _simEvents) == 0) exitWith {ERROR("No Event"); false}; +EXPLODE_3_PVT((_simEvents select 0),_nextEventTime,_nextEventIsBullet,_nextEventMags); + +if (_nextEventTime > _elapsedTime) exitWith {true};//waiting on next event + +//Verify we aren't missing any ammo +_currentAmmoCount = []; +{ + EXPLODE_2_PVT(_x,_xClassname,_xCount); + if (_xClassname == _magazineClassname) then { + _currentAmmoCount pushBack _xCount; + }; +} forEach (magazinesAmmo ACE_player); //only inventory mags + +//Go through mags we currently have and check off the ones we should have +_addedMagazines = +_currentAmmoCount; +_missingAmmo = false; +{ + if (_x > 0) then { + _index = _addedMagazines find _x; + if (_index != -1) then { + _addedMagazines deleteAt _index; + } else { + _missingAmmo = true; + }; + }; +} forEach _lastAmmoCount; + +if (_missingAmmo) exitWith {false}; //something removed ammo that was being repacked (could be other players or scripts) + +_updateMagazinesOnPlayerFnc = { + ACE_player removeMagazines _magazineClassname; //remove inventory magazines + { + if (_x > 0) then { + ACE_player addMagazine [_magazineClassname, _x]; + }; + } forEach (_addedMagazines + _nextEventMags); + _args set [1, _nextEventMags]; //store the new magazine +}; + +if (_nextEventIsBullet) then { + playSound QGVAR(soundRoundFinished); + if ((((count _simEvents) % 3) == 0) || {(count _simEvents) == 1}) then { + //For performance - only update mags every 3 bullets (or if it's the last event) + call _updateMagazinesOnPlayerFnc; + }; +} else { + playSound QGVAR(soundMagazineFinished); + call _updateMagazinesOnPlayerFnc; +}; + +_simEvents deleteAt 0; //pop off the event + +true; diff --git a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf index b1a31c266c..e96e84e9a1 100644 --- a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf +++ b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf @@ -1,40 +1,59 @@ -// by commy2 +/* + * Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg) + * Opens the selectMenu UI to chose which magazine to repack. + * Only shows classnames that have 2+ partial magazines + * + * Arguments: + * 0: Unit (player) + * + * Return Value: + * Nothing + * + * Example: + * [_player] call ace_magazinerepack_fnc_openSelectMagazineUI + * + * Public: No + */ #include "script_component.hpp" -private ["_unit", "_magazines", "_repackTime", "_listIDC", "_count", "_index", "_magazine", "_time", "_displayName", "_picture"]; +private ["_unitMagazines", "_unitMagCounts", "_xFullMagazineCount", "_index", "_actions", "_displayName", "_picture"]; -_unit = _this select 0; -_magazines = _this select 1; -_repackTime = _this select 2; +PARAMS_1(_unit); -_count = count _magazines; +_unitMagazines = []; +_unitMagCounts = []; + +// get all mags and ammo count +{ + EXPLODE_2_PVT(_x,_xClassname,_xCount); + _xFullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _xClassname >> "count"); + + if ((_xCount != _xFullMagazineCount) && {_xCount > 0}) then {//for every partial magazine + _index = _unitMagazines find _xClassname; + if (_index == -1) then { + _unitMagazines pushBack _xClassname; + _unitMagCounts pushBack [_xCount]; + } else { + (_unitMagCounts select _index) pushBack _xCount; + }; + }; +} forEach (magazinesAmmoFull _unit); _actions = [localize "STR_ACE_MagazineRepack_SelectMagazineMenu", localize "STR_ACE_MagazineRepack_SelectMagazine"] call EFUNC(interaction,prepareSelectMenu); -for "_index" from 0 to (_count - 1) do { - _magazine = _magazines select _index; - _time = _repackTime select _index; - _displayName = getText (configFile >> "CfgMagazines" >> _magazine >> "displayName"); - _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); - _actions = [ - _actions, - _displayName, - _picture, - [str _unit, _magazine, _time] - ] call EFUNC(interaction,addSelectableItem); -}; + +{ + if ((count (_unitMagCounts select _forEachIndex)) >= 2) then {// Ignore invalid magazines types (need 2+ partial mags to do anything) + _displayName = getText (configFile >> "CfgMagazines" >> _x >> "displayName"); + _picture = getText (configFile >> "CfgMagazines" >> _x >> "picture"); + _actions = [_actions, _displayName, _picture, _x] call EFUNC(interaction,addSelectableItem); + }; +} forEach _unitMagazines; [ - _actions, - { - _data = _this; - call EFUNC(interaction,hideMenu); - if (isNil "_data") exitWith {}; - _data set [2, [_data select 2] call EFUNC(common,toNumber)]; - [(_data select 2), _data, {(_this select 0) call FUNC(magazineRepackCallback)}, {}, (localize "STR_ACE_MagazineRepack_RepackingMagazine")] call EFUNC(common,progressBar); - [ACE_player] call EFUNC(common,goKneeling); - }, - { - call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [QGVAR(AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; - } +_actions, +{ [_this] call FUNC(startRepackingMagazine); }, +{ + call EFUNC(interaction,hideMenu); //ToDo: Self Interaction Integration + if !(profileNamespace getVariable [QGVAR(AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; +} ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf new file mode 100644 index 0000000000..2b8b383a9a --- /dev/null +++ b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf @@ -0,0 +1,67 @@ +/* + * Author: PabstMirror + * Simulates repacking a set of magazines. + * Returns the timing and magazines counts at every stage. + * + * Arguments: + * 0: How many rounds in a full magazine + * 1: Array of rounds in magazines + * + * Return Value: + * Array in format [time, isBullet, array of ammo counts] + * + * Example: + * [5, [1,2,3,8]] call ace_magazinerepack_fnc_simulateRepackEvents = + * [[1.5,true,[0,2,3,9]],[3.5,false,[0,2,3,9]],[5,true,[0,1,3,10]],[7,false,[0,1,3,10]],[8.5,true,[0,0,4,10]],[10.5,false,[0,0,4,10]]] + * + * Public: No + */ +#include "script_component.hpp" + +private ["_newMagFnc", "_time", "_events", "_swapAmmoFnc", "_ammoSwaped", "_lowIndex", "_highIndex", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; + +PARAMS_2(_fullMagazineCount,_arrayOfAmmoCounts); + +// Sort Ascending - Don't modify original +_arrayOfAmmoCounts = (+_arrayOfAmmoCounts) call BIS_fnc_sortNum; + +_newMagFnc = { + _time = _time + GVAR(TimePerMagazine); + _events pushBack [_time, false, +_arrayOfAmmoCounts]; +}; +_swapAmmoFnc = { + for "_swapProgress" from 0 to (_ammoSwaped - 1) do { + _time = _time + GVAR(TimePerAmmo); + _arrayOfAmmoCounts set [_lowIndex, ((_arrayOfAmmoCounts select _lowIndex) - 1)]; + _arrayOfAmmoCounts set [_highIndex, ((_arrayOfAmmoCounts select _highIndex) + 1)]; + _events pushBack [_time, true, +_arrayOfAmmoCounts]; + }; +}; + +_lowIndex = 0; +_highIndex = (count _arrayOfAmmoCounts) - 1; +_ammoToTransfer = 0; +_ammoAvailable = 0; + +_time = 0; +_events = []; + +while {_lowIndex < _highIndex} do { + _ammoNeeded = _fullMagazineCount - (_arrayOfAmmoCounts select _highIndex); + _ammoAvailable = _arrayOfAmmoCounts select _lowIndex; + + if (_ammoAvailable == 0) then { + _lowIndex = _lowIndex + 1; + call _newMagFnc; + } else { + if (_ammoNeeded == 0) then { + _highIndex = _highIndex - 1; + call _newMagFnc; + } else { + _ammoSwaped = _ammoAvailable min _ammoNeeded; + call _swapAmmoFnc; + }; + }; +}; + +_events diff --git a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf new file mode 100644 index 0000000000..06c0f0a137 --- /dev/null +++ b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf @@ -0,0 +1,67 @@ +/* + * Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg) + * Starts repacking a specific magazine classname. + * If room in inventory, unload magazine from weapon to be repacked. + * Precalcs all the event timings and starts the progressBar. + * + * Arguments: + * 0: Magazine Classname + * + * Return Value: + * Nothing + * + * Example: + * ["30Rnd_65x39_caseless_mag"] call ace_magazinerepack_fnc_startRepackingMagazine + * + * Public: No + */ +#include "script_component.hpp" + +private ["_unit", "_fullMagazineCount", "_startingAmmoCounts", "_simEvents", "_totalTime"]; + +PARAMS_1(_magazineClassname); +if (isNil "_magazineClassname" || {_magazineClassname == ""}) exitWith {ERROR("Bad Mag Classname");}; + +_unit = ACE_player; + +[ACE_player] call EFUNC(common,goKneeling); +call EFUNC(interaction,hideMenu);//ToDo: Self Interaction Integration + +// Calculate actual ammo to transfer during repack +_fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count"); + +_startingAmmoCounts = []; +{ + EXPLODE_4_PVT(_x,_xClassname,_xCount,_xLoaded,_xType); + if ((_xClassname == _magazineClassname) && {(_xCount != _fullMagazineCount) && {_xCount > 0}}) then { + if (_xLoaded) then { + //Try to Remove from weapon and add to inventory, otherwise ignore + if (_unit canAdd _magazineClassname) then { + switch (_xType) do { + case (1): {_unit removePrimaryWeaponItem _magazineClassname;}; + case (2): {_unit removeHandgunItem _magazineClassname;}; + case (4): {_unit removeSecondaryWeaponItem _magazineClassname;}; + default {ERROR("Loaded Location Invalid");}; + }; + _unit addMagazine [_magazineClassname, _xCount]; + _startingAmmoCounts pushBack _xCount; + }; + } else { + _startingAmmoCounts pushBack _xCount; + }; + }; +} forEach (magazinesAmmoFull _unit); + +if ((count _startingAmmoCounts) < 2) exitwith {ERROR("Not Enough Mags to Repack");}; + +_simEvents = [_fullMagazineCount, _startingAmmoCounts] call FUNC(simulateRepackEvents); +_totalTime = (_simEvents select ((count _simEvents) - 1) select 0); + +[ +_totalTime, +[_magazineClassname, _startingAmmoCounts, _simEvents], +{_this call FUNC(magazineRepackFinish)}, +{_this call FUNC(magazineRepackFinish)}, +(localize "STR_ACE_MagazineRepack_RepackingMagazine"), +{_this call FUNC(magazineRepackProgress)} +] call EFUNC(common,progressBar); diff --git a/addons/magazinerepack/sounds/magrepack_finished.wav b/addons/magazinerepack/sounds/magrepack_finished.wav new file mode 100644 index 0000000000..ab73615a55 Binary files /dev/null and b/addons/magazinerepack/sounds/magrepack_finished.wav differ diff --git a/addons/magazinerepack/sounds/magrepack_single.wav b/addons/magazinerepack/sounds/magrepack_single.wav new file mode 100644 index 0000000000..5d94e215fd Binary files /dev/null and b/addons/magazinerepack/sounds/magrepack_single.wav differ diff --git a/addons/magazinerepack/stringtable.xml b/addons/magazinerepack/stringtable.xml index 5ea62e3a18..937cfcbf9a 100644 --- a/addons/magazinerepack/stringtable.xml +++ b/addons/magazinerepack/stringtable.xml @@ -1,5 +1,5 @@  - + @@ -74,5 +74,20 @@ %1 tejles tár és %2 extra lőszer. %1 полных магазина(ов) и %2 патрона(ов) + + Repacking Finished + Wiederverpacken Fertig + Reembalaje Finalizado + + + Repacking Interrupted + Umpacken Unterbrochen + Reempaque Interrupted + + + %1 Full and %2 Partial + %1 Vollständigen und %2 Teilweisen + %1 Total y %2 Parcial + \ No newline at end of file diff --git a/addons/magazines/CfgVehicles.hpp b/addons/magazines/CfgVehicles.hpp index b78eb71abc..a7c2654d71 100644 --- a/addons/magazines/CfgVehicles.hpp +++ b/addons/magazines/CfgVehicles.hpp @@ -1,9 +1,4 @@ -#define MACRO_ADDMAGAZINE(MAGAZINE,COUNT) class _xx_##MAGAZINE { \ - magazine = #MAGAZINE; \ - count = COUNT; \ -} - class CfgVehicles { class NATO_Box_Base; class Box_NATO_Wps_F: NATO_Box_Base { diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 3b59e8b373..cc589aac3e 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -199,6 +199,22 @@ #define GETEGVAR(var1,var2,var3) GETMVAR(EGVAR(var1,var2),var3) +#define MACRO_ADDWEAPON(WEAPON,COUNT) class _xx_##WEAPON { \ + weapon = #WEAPON; \ + count = COUNT; \ +} + +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ +} + +#define MACRO_ADDMAGAZINE(MAGAZINE,COUNT) class _xx_##MAGAZINE { \ + magazine = #MAGAZINE; \ + count = COUNT; \ +} + + #ifdef DISABLE_COMPILE_CACHE #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)) #else diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index 6c2d4a1ee1..eafc85cdf1 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -85,12 +85,14 @@ class CfgVehicles { }; class ACE_Actions { - class ACE_CopyMap { - displayName = "$STR_ACE_Map_CopyMap"; - condition = QUOTE(([_target] call EFUNC(common,isPlayer) && {'ItemMap' in assigneditems _player} && {'ACE_MapTools' in items _player} && {'ItemMap' in assignedItems _target})); - statement = QUOTE([ARR_2(_player,_target)] call FUNC(copyMapStart)); - showDisabled = 0; - priority = -1; + class ACE_MainActions { + class ACE_CopyMap { + displayName = "$STR_ACE_Map_CopyMap"; + condition = QUOTE(([_target] call EFUNC(common,isPlayer) && {'ItemMap' in assigneditems _player} && {'ACE_MapTools' in items _player} && {'ItemMap' in assignedItems _target})); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(copyMapStart)); + showDisabled = 0; + priority = -1; + }; }; }; }; diff --git a/addons/map/XEH_preInit.sqf b/addons/map/XEH_preInit.sqf index b13b0ca384..1ab43c7ca8 100644 --- a/addons/map/XEH_preInit.sqf +++ b/addons/map/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(addLineMarker); PREP(blueForceTrackingModule); PREP(blueForceTrackingUpdate); @@ -29,3 +31,5 @@ PREP(updateLineMarker); ["drawing_requestMarkers", FUNC(copyMapRemoteSend) ] call EFUNC(common,addEventHandler); ["drawing_sendbackMarkers", FUNC(copyMapReceiveMarkers) ] call EFUNC(common,addEventHandler); + +ADDON = true; diff --git a/addons/map/config.cpp b/addons/map/config.cpp index c9980458db..36a6f85168 100644 --- a/addons/map/config.cpp +++ b/addons/map/config.cpp @@ -23,13 +23,23 @@ class RscButtonMenuCancel; class RscButtonMenu; class RscEdit; -class ACE_Parameters_Numeric { - GVAR(BFT_Interval) = 1; -}; -class ACE_Parameters_Boolean { - GVAR(EveryoneCanDrawOnBriefing) = 1; - GVAR(BFT_Enabled) = 0; - GVAR(BFT_HideAiGroups) = 0; +class ACE_Settings { + class GVAR(BFT_Interval) { + value = 1.0; + typeName = "SCALAR"; + }; + class GVAR(EveryoneCanDrawOnBriefing) { + value = 1; + typeName = "BOOL"; + }; + class GVAR(BFT_Enabled) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(BFT_HideAiGroups) { + value = 0; + typeName = "BOOL"; + }; }; #include "MapGpsUI.hpp" diff --git a/addons/map/functions/fnc_blueForceTrackingModule.sqf b/addons/map/functions/fnc_blueForceTrackingModule.sqf index 3951473026..cecfd348d2 100644 --- a/addons/map/functions/fnc_blueForceTrackingModule.sqf +++ b/addons/map/functions/fnc_blueForceTrackingModule.sqf @@ -21,8 +21,8 @@ _activated = _this select 2; if !(_activated) exitWith {}; GVAR(BFT_Enabled) = true; -[_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readNumericParameterFromModule); -[_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readBooleanParameterFromModule); +[_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readSettingFromModule); diag_log text "[ACE]: Blue Force Tracking Module initialized."; TRACE_2("[ACE]: Blue Force Tracking Module initialized.",GVAR(BFT_Interval), GVAR(BFT_HideAiGroups)); diff --git a/addons/markers/XEH_preInit.sqf b/addons/markers/XEH_preInit.sqf index 6ac258ed2a..8e07056da4 100644 --- a/addons/markers/XEH_preInit.sqf +++ b/addons/markers/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(initInsertMarker); PREP(onLBSelChangedColor); PREP(onLBSelChangedShape); @@ -72,3 +74,5 @@ if (isNil QGVAR(MarkerColorsCache)) then { }; [QGVAR(sendMarkersJIP), FUNC(sendMarkersJIP)] call EFUNC(common,addEventHandler); + +ADDON = true; diff --git a/addons/markers/functions/fnc_initInsertMarker.sqf b/addons/markers/functions/fnc_initInsertMarker.sqf index d172c6a532..e5328a7470 100644 --- a/addons/markers/functions/fnc_initInsertMarker.sqf +++ b/addons/markers/functions/fnc_initInsertMarker.sqf @@ -31,42 +31,49 @@ ctrlSetFocus _text; //Change ok button's text based on current channel - //if (isNull _buttonOK) exitWith {true}; + [{ + EXPLODE_2_PVT(_this,_params,_pfhId); + EXPLODE_1_PVT(_params,_buttonOK); - _channel = ""; - _textColor = [1,1,1,1]; - switch (call EFUNC(common,currentChannel)) do { + if (isNull _buttonOK) exitWith { + [_pfhId] call CBA_fnc_removePerFrameHandler; + }; + + _channel = ""; + _textColor = [1,1,1,1]; + switch (call EFUNC(common,currentChannel)) do { case ("global"): { - _channel = localize "str_channel_global"; - _textColor = [(216/255),(216/255),(216/255),1]; - }; + _channel = localize "str_channel_global"; + _textColor = [(216/255),(216/255),(216/255),1]; + }; case ("side"): { - _channel = localize "str_channel_side"; - _textColor = [(70/255),(211/255),(252/255),1]; - }; + _channel = localize "str_channel_side"; + _textColor = [(70/255),(211/255),(252/255),1]; + }; case ("group"): { - _channel = localize "str_channel_group"; - _textColor = [(181/255),(248/255),(98/255),1]; - }; + _channel = localize "str_channel_group"; + _textColor = [(181/255),(248/255),(98/255),1]; + }; case ("vehicle"): { - _channel = localize "str_channel_vehicle"; - _textColor = [(255/255),(208/255),(0/255),1]; - }; + _channel = localize "str_channel_vehicle"; + _textColor = [(255/255),(208/255),(0/255),1]; + }; case ("direct"): { - _channel = localize "str_channel_direct"; - _textColor = [(255/255),(255/255),(255/255),1]; - }; + _channel = localize "str_channel_direct"; + _textColor = [(255/255),(255/255),(255/255),1]; + }; case ("command"): { - _channel = localize "str_channel_command"; - _textColor = [(255/255),(255/255),(70/255),1]; + _channel = localize "str_channel_command"; + _textColor = [(255/255),(255/255),(70/255),1]; + }; }; - }; - //If localization not found, then don't touch anything (default is RscButtonMenuOK's localized text) - if (_channel != "") then { - _buttonOK ctrlSetTextColor _textColor; - _buttonOK ctrlSetText format [localize "STR_ACE_Markers_PlaceIn", _channel]; - }; + //If localization not found, then don't touch anything (default is RscButtonMenuOK's localized text) + if (_channel != "") then { + _buttonOK ctrlSetTextColor _textColor; + _buttonOK ctrlSetText format [localize "STR_ACE_Markers_PlaceIn", _channel]; + }; + }, 0, [_buttonOK]] call CBA_fnc_addPerFrameHandler; //--- Background _pos = ctrlposition _text; diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index e5139dcc01..921e4dff78 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -11,7 +11,6 @@ GVAR(playingHeartBeatSound) = false; ["Medical_treatmentCompleted", FUNC(onTreatmentCompleted)] call ace_common_fnc_addEventHandler; - // Initialize all effects // @todo: make this a macro? _fnc_createEffect = { diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 7363c63b66..0244978ef7 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -65,7 +65,7 @@ if (isPlayer _unit) then { }; // So the AI does not get stuck, we are moving the unit to a temp group on its own. -[_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide_f); +[_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); _captiveSwitch = false; // [_unit, true] call EFUNC(common,setCaptiveSwitch); [_unit, [_unit] call EFUNC(common,getDeathAnim), 1, true] call EFUNC(common,doAnimation); @@ -118,7 +118,7 @@ _minWaitingTime = (round(random(10)+5)); }; // Swhich the unit back to its original group - [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide_f); + [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); // Reset any visual and audio effects for players, or enable everything again for AI. if (isPlayer _unit) then { diff --git a/addons/missionmodules/$PBOPREFIX$ b/addons/missionmodules/$PBOPREFIX$ new file mode 100644 index 0000000000..6e7c7ebfc1 --- /dev/null +++ b/addons/missionmodules/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\missionmodules \ No newline at end of file diff --git a/addons/missionmodules/CfgEventHandlers.hpp b/addons/missionmodules/CfgEventHandlers.hpp new file mode 100644 index 0000000000..f0a9f14d91 --- /dev/null +++ b/addons/missionmodules/CfgEventHandlers.hpp @@ -0,0 +1,6 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/missionmodules/CfgFactionClasses.hpp b/addons/missionmodules/CfgFactionClasses.hpp new file mode 100644 index 0000000000..792f4d31e3 --- /dev/null +++ b/addons/missionmodules/CfgFactionClasses.hpp @@ -0,0 +1,6 @@ +class CfgFactionClasses { + class NO_CATEGORY; + class ACE_missionModules: NO_CATEGORY { + displayName = "ACE Mission Modules"; + }; +}; \ No newline at end of file diff --git a/addons/missionmodules/CfgVehicles.hpp b/addons/missionmodules/CfgVehicles.hpp new file mode 100644 index 0000000000..92c379efb2 --- /dev/null +++ b/addons/missionmodules/CfgVehicles.hpp @@ -0,0 +1,68 @@ +class CfgVehicles { + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits { + }; + }; + + // TODO make a curator variant for this + class ACE_moduleAmbianceSound: Module_F { + scope = 2; + displayName = "Ambiance Sounds [ACE]"; + icon = QUOTE(PATHTOF(data\moduleSound.paa)); + category = "ACE_missionModules"; + function = QUOTE(FUNC(moduleAmbianceSound)); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = "Glowbal"; + class Arguments { + class soundFiles { + displayName = "Sounds"; + description = "Classnames of the ambiance sounds played. Seperated by ','. "; + typeName = "STRING"; + defaultValue = ""; + }; + class minimalDistance { + displayName = "Minimal Distance"; + description = "Minimal Distance"; + typeName = "NUMBER"; + defaultValue = 400; + }; + class maximalDistance { + displayName = "Maximal Distance"; + description = "Maximal Distance"; + typeName = "NUMBER"; + defaultValue = 900; + }; + class minimalDelay { + displayName = "Minimal Delay"; + description = "Minimal Delay between sounds played"; + typeName = "NUMBER"; + defaultValue = 10; + }; + class maximalDelay { + displayName = "Maximal Delay"; + description = "Maximal Delay between sounds played"; + typeName = "NUMBER"; + defaultValue = 170; + }; + class followPlayers { + displayName = "Follow Players"; + description = "Follow players. If set to false, loop will play sounds only nearby logic position."; + typeName = "BOOL"; + defaultValue = 0; + }; + class soundVolume { + displayName = "Volume"; + description = "The volume of the sounds played"; + typeName = "NUMBER"; + defaultValue = 1; + }; + }; + class ModuleDescription { + description = "Ambiance sounds loop (synced across MP)"; + sync[] = {}; + }; + }; +}; diff --git a/addons/missionmodules/XEH_preInit.sqf b/addons/missionmodules/XEH_preInit.sqf new file mode 100644 index 0000000000..cadbbabdd1 --- /dev/null +++ b/addons/missionmodules/XEH_preInit.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(moduleAmbianceSound); + +ADDON = true; diff --git a/addons/missionmodules/config.cpp b/addons/missionmodules/config.cpp new file mode 100644 index 0000000000..0867b486c6 --- /dev/null +++ b/addons/missionmodules/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"cse_moduleAmbianceSound"}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"Glowbal"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgFactionClasses.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/missionmodules/data/moduleSound.paa b/addons/missionmodules/data/moduleSound.paa new file mode 100644 index 0000000000..bfe3b80327 Binary files /dev/null and b/addons/missionmodules/data/moduleSound.paa differ diff --git a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf new file mode 100644 index 0000000000..943d795b7a --- /dev/null +++ b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf @@ -0,0 +1,123 @@ +/* + * Author: Glowbal + * Plays synchronized ambiance sounds while the module is alive. + * + * Arguments: + * 0: Logic + * 1: Units + * 2: Activated + * + * Return Value: + * Nothing + * + * Example: + * N/A + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_logic", "_units", "_activated","_ambianceSounds", "_soundFiles", "_minimalDistance","_maximalDistance", "_minimalDistance", "_maxDelayBetweenSounds", "_allUnits", "_newPos", "_targetUnit", "_soundToPlay", "_soundPath", "_unparsedSounds", "_list", "_splittedList", "_nilCheckPassedList"]; +_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +_units = [_this,1,[],[[]]] call BIS_fnc_param; +_activated = [_this,2,true,[true]] call BIS_fnc_param; + +// We only play this on the locality of the logic, since the sounds are broadcasted across the network +if (_activated && local _logic) then { + _ambianceSounds = []; + _unparsedSounds = _logic getvariable ["soundFiles", ""]; + _minimalDistance = (_logic getvariable ["minimalDistance", 400]) max 1; + _maximalDistance = (_logic getvariable ["maximalDistance", 10]) max _minimalDistance; + _minDelayBetweensounds = (_logic getvariable ["minimalDelay", 10]) max 1; + _maxDelayBetweenSounds = (_logic getvariable ["maximalDelay", 170]) max _minDelayBetweensounds; + _volume = (_logic getvariable ["soundVolume", 30]) max 1; + _followPlayers = _logic getvariable ["followPlayers", false]; + + _splittedList = [_unparsedSounds, ","] call BIS_fnc_splitString; + + _nilCheckPassedList = ""; + { + _x = [_x] call EFUNC(common,string_removeWhiteSpace); + _splittedList set [_foreachIndex, _x]; + }foreach _splittedList; + + _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; + { + if (isclass (missionConfigFile >> "CfgSounds" >> _x)) then { + _ambianceSounds pushback (_soundPath + (getArray(missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0)); + } else { + if (isclass (configFile >> "CfgSounds" >> _x)) then { + _ambianceSounds pushback ((getArray(configFile >> "CfgSounds" >> _x >> "sound") select 0)); + }; + }; + }foreach _splittedList; + + if (count _ambianceSounds == 0) exitwith {}; + { + if !([".", _x, true] call BIS_fnc_inString) then { + _ambianceSounds set [_foreachIndex, _x + ".wss"]; + }; + }foreach _ambianceSounds; + + [{ + private ["_args", "_logic", "_ambianceSounds", "_minimalDistance", "_maximalDistance", "_minDelayBetweensounds", "_maxDelayBetweenSounds", "_volume", "_followPlayers","_lastTimePlayed", "_newPos"]; + _args = _this select 0; + _logic = _args select 0; + _minDelayBetweensounds = _args select 4; + _maxDelayBetweenSounds = _args select 5; + _lastTimePlayed = _args select 8; + + if (!alive _logic) exitwith { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; + + if (time - _lastTimePlayed >= ((_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds)) then { + _ambianceSounds = _args select 1; + _minimalDistance = _args select 2; + _maximalDistance = _args select 3; + + _volume = _args select 6; + _followPlayers = _args select 7; + + // Find all players in session. + _allUnits = if (isMultiplayer) then {playableUnits} else {[ACE_player]}; + + // Check if there are enough players to even start playing this sound. + if (count _allUnits > 0) then { + + // Select a target unit at random. + _targetUnit = _allUnits select (round(random((count _allUnits)-1))); + + // find the position from which we are going to play this sound from. + _newPos = (getPos _targetUnit); + if (!_followPlayers) then { + _newPos = getPos _logic; + }; + + // Randomize this position. + if (random(1) >= 0.5) then { + if (random(1) >= 0.5) then { + _newPos set [0, (_newPos select 0) + (_minimalDistance + random(_maximalDistance))]; + } else { + _newPos set [0, (_newPos select 0) - (_minimalDistance + random(_maximalDistance))]; + }; + } else { + if (random(1) >= 0.5) then { + _newPos set [1, (_newPos select 1) + (_minimalDistance + random(_maximalDistance))]; + } else { + _newPos set [1, (_newPos select 1) - (_minimalDistance + random(_maximalDistance))]; + }; + }; + + // If no unit is to close to this position, we will play the sound. + if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then { + playSound3D [_ambianceSounds select (round(random((count _ambianceSounds)-1))), ObjNull, false, _newPos, _volume, 1, 1000]; + _args set [8, time]; + }; + }; + }; + }, 0.1, [_logic, _ambianceSounds, _minimalDistance, _maximalDistance, _minDelayBetweensounds, _maxDelayBetweenSounds, _volume, _followPlayers, time] ] call cba_fnc_addPerFrameHandler; +}; + +true; diff --git a/addons/missionmodules/functions/script_component.hpp b/addons/missionmodules/functions/script_component.hpp new file mode 100644 index 0000000000..42d34d4801 --- /dev/null +++ b/addons/missionmodules/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\missionmodules\script_component.hpp" \ No newline at end of file diff --git a/addons/missionmodules/script_component.hpp b/addons/missionmodules/script_component.hpp new file mode 100644 index 0000000000..a567966c7b --- /dev/null +++ b/addons/missionmodules/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT missionModules +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_MISSIONMODULES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MISSIONMODULES + #define DEBUG_SETTINGS DEBUG_SETTINGS_MISSIONMODULES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/movement/CfgMoves.hpp b/addons/movement/CfgMoves.hpp index 9d32d4e856..677ad3dc94 100644 --- a/addons/movement/CfgMoves.hpp +++ b/addons/movement/CfgMoves.hpp @@ -77,6 +77,15 @@ class CfgMovesMaleSdr: CfgMovesBasic { class AmovPercMwlkSlowWrflDr: AmovPercMwlkSlowWrflDf { leftHandIKCurve[] = {}; }; + class AmovPercMwlkSlowWrflDf_v1: AmovPercMwlkSlowWrflDf { + leftHandIKCurve[] = {}; + }; + class AidlPercMwlkSrasWrflDf: AmovPercMwlkSlowWrflDf { + leftHandIKCurve[] = {}; + }; + class AmovPercMtacSlowWrflDf: AmovPercMwlkSlowWrflDf { + leftHandIKCurve[] = {}; + }; // enable optics in prone left and right stance class AidlPpneMstpSrasWrflDnon_G0S; diff --git a/addons/movement/XEH_preInit.sqf b/addons/movement/XEH_preInit.sqf index e4c6a2f056..3047be3518 100644 --- a/addons/movement/XEH_preInit.sqf +++ b/addons/movement/XEH_preInit.sqf @@ -1,6 +1,10 @@ #include "script_component.hpp" +ADDON = false; + PREP(getWeight); PREP(canClimb); PREP(climb); PREP(handleClimb); + +ADDON = true; diff --git a/addons/movement/config.cpp b/addons/movement/config.cpp index e8661b748c..51ab97b80a 100644 --- a/addons/movement/config.cpp +++ b/addons/movement/config.cpp @@ -17,9 +17,11 @@ class CfgPatches { //#include "CfgInventoryGlobalVariable.hpp" #include "CfgMoves.hpp" -class ACE_Options { +class ACE_Settings { class GVAR(useImperial) { + value = 0; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_Movement_UseImperial"; - default = 0; }; }; diff --git a/addons/movement/functions/fnc_getWeight.sqf b/addons/movement/functions/fnc_getWeight.sqf index a52ed3cb12..254b706d56 100644 --- a/addons/movement/functions/fnc_getWeight.sqf +++ b/addons/movement/functions/fnc_getWeight.sqf @@ -7,7 +7,7 @@ _unit = _this select 0; _weight = loadAbs _unit * 0.1; -if (GETGVAR(useImperial, 0) == 1) then { +if (GVAR(useImperial)) then { _weight = format ["%1lb", (round (_weight * 100)) / 100]; } else { _weight = format ["%1kg", (round (_weight * FACTOR_POUND_TO_KILOGRAMM * 100)) / 100]; diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index 444622f0ed..e3c4227834 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -15,40 +15,44 @@ class CfgVehicles { typeName = "NUMBER"; defaultValue = 5; }; - class ShowNamesForAI { + class showNamesForAI { displayName = "Show name tags for AI?"; - description = "Show the name and rank tags for friendly AI units? Default: No"; - typeName = "BOOL"; - class values { - class Yes { - name = "Yes"; - value = 1; - }; - class No { - default = 1; - name = "No"; - value = 0; - }; - }; - }; - class Visibility { - displayName = "Visibility of crew info"; - description = "Forces visibility of vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force"; - typeName = "INT"; + description = "Show the name and rank tags for friendly AI units? Default: Do not force"; + typeName = "NUMBER"; class values { class DoNotForce { default = 1; name = "Do Not Force"; + value = -1; + }; + class ForceHide { + name = "Force Hide"; + value = 0; + }; + class ForceShow { + name = "Force show"; + value = 1; + }; + }; + }; + class showVehicleCrewInfo { + displayName = "Show crew info?"; + description = "Show vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force"; + typeName = "NUMBER"; + class values { + class DoNotForce { + default = 1; + name = "Do Not Force"; + value = -1; + }; + class ForceHide { + name = "Force Hide"; value = 0; }; class ForceShow { name = "Force Show"; value = 1; }; - class ForceHide { - name = "Force Hide"; - value = -1; - }; }; }; }; diff --git a/addons/nametags/XEH_preInit.sqf b/addons/nametags/XEH_preInit.sqf index 14ecdc8a41..79258c5cec 100644 --- a/addons/nametags/XEH_preInit.sqf +++ b/addons/nametags/XEH_preInit.sqf @@ -1,5 +1,6 @@ #include "script_component.hpp" +ADDON = false; PREP(canShow); PREP(doShow); @@ -10,3 +11,5 @@ PREP(onMouseZChanged); PREP(setText); GVAR(ShowNamesTime) = -10; + +ADDON = true; diff --git a/addons/nametags/config.cpp b/addons/nametags/config.cpp index 1846cd616e..aa55dd2aad 100644 --- a/addons/nametags/config.cpp +++ b/addons/nametags/config.cpp @@ -15,29 +15,43 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -class ACE_Options { +class ACE_Settings { class GVAR(showPlayerNames) { + value = 1; + typeName = "SCALAR"; + isClientSetable = 1; displayName = "$STR_ACE_NameTags_ShowPlayerNames"; values[] = {"Disabled", "Enabled", "Only Cursor", "Only On Keypress", "Only Cursor and KeyPress"}; - default = 1; }; class GVAR(showPlayerRanks) { + value = 1; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_NameTags_ShowPlayerRanks"; - default = 1; }; class GVAR(showVehicleCrewInfo) { - displayName = "$STR_ACE_CrewInfo_ShowVehicleCrewInfo"; - default = 1; + value = 1; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_NameTags_ShowVehicleCrewInfo"; + }; + class GVAR(showNamesForAI) { + value = 0; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_NameTags_ShowNamesForAI"; }; -}; -class ACE_Parameters_Numeric { - GVAR(PlayerNamesViewDistance) = 5; - GVAR(PlayerNamesMaxAlpha) = 0.8; - GVAR(CrewInfoVisibility) = 0; -}; -class ACE_Parameters_Boolean { - GVAR(ShowNamesForAI) = 0; + class GVAR(PlayerNamesViewDistance) { + value = 5; + typeName = "SCALAR"; + isClientSetable = 0; + }; + class GVAR(PlayerNamesMaxAlpha) { + value = 0.8; + typeName = "SCALAR"; + isClientSetable = 0; + }; }; #include diff --git a/addons/nametags/functions/fnc_canShow.sqf b/addons/nametags/functions/fnc_canShow.sqf index 8b61352def..0e187fee0f 100644 --- a/addons/nametags/functions/fnc_canShow.sqf +++ b/addons/nametags/functions/fnc_canShow.sqf @@ -1,12 +1,12 @@ /* Author: aeroson - + Description: Might be called several times a second - - Parameters: + + Parameters: None - + Returns: true if CrewInfo can be shown, false otherwise */ @@ -17,11 +17,6 @@ private["_player"]; _player = ACE_player; -// AGM_NameTags_ShowVehicleCrewInfo: -1 force NO, 0 doesnt care, 1 force YES - vehicle _player != _player && -{ - (GVAR(CrewInfoVisibility) == 1) || - (GVAR(CrewInfoVisibility) != -1 && GVAR(showVehicleCrewInfo)) -} && +{GVAR(ShowCrewInfo)} && {!(vehicle _player isKindOf "ParachuteBase")}; diff --git a/addons/nametags/functions/fnc_moduleNameTags.sqf b/addons/nametags/functions/fnc_moduleNameTags.sqf index b701a2db8c..24b30e5d6b 100644 --- a/addons/nametags/functions/fnc_moduleNameTags.sqf +++ b/addons/nametags/functions/fnc_moduleNameTags.sqf @@ -22,8 +22,8 @@ if !(_activated) exitWith {}; GVAR(Module) = true; -[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readNumericParameterFromModule); -[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(CrewInfoVisibility), "Visibility" ] call EFUNC(common,readNumericParameterFromModule); +[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(showVehicleCrewInfo), "showVehicleCrewInfo" ] call EFUNC(common,readSettingFromModule); diag_log text "[ACE]: NameTags Module Initialized."; diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml index 7d085b9d44..9cd99adaef 100644 --- a/addons/nametags/stringtable.xml +++ b/addons/nametags/stringtable.xml @@ -58,9 +58,7 @@ Játékosok rendfokozatának mutatása (névcímke szükséges) Показать звания игроков (требует имен игроков) - - - + Show vehicle crew info Zeige Fahrzeugbesatzung Mostrar tripulantes @@ -68,5 +66,8 @@ Zobrazit info o posádce vozidla Показать экипаж + + Show name tags for AI units + diff --git a/addons/nightvision/CfgEventHandlers.hpp b/addons/nightvision/CfgEventHandlers.hpp index d76482dd7f..380f190f47 100644 --- a/addons/nightvision/CfgEventHandlers.hpp +++ b/addons/nightvision/CfgEventHandlers.hpp @@ -1,19 +1,19 @@ class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit) ); - }; + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit) ); + }; }; class Extended_PostInit_EventHandlers { - class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) ); - }; + class ADDON { + clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) ); + }; }; class Extended_FiredBIS_EventHandlers { - class AllVehicles { - class ADDON { - clientFiredBIS = QUOTE( _this call FUNC(blending) ); + class AllVehicles { + class ADDON { + clientFiredBIS = QUOTE( _this call FUNC(blending) ); + }; }; - }; }; diff --git a/addons/nightvision/CfgVehicles.hpp b/addons/nightvision/CfgVehicles.hpp index 63abfb47e2..d53ce54467 100644 --- a/addons/nightvision/CfgVehicles.hpp +++ b/addons/nightvision/CfgVehicles.hpp @@ -1,22 +1,22 @@ class CfgVehicles { - class All { - ACE_NightVision_grain = 0.75; - ACE_NightVision_blur = 0.055; - }; - - #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; - - class Box_NATO_Support_F; - class ACE_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(ACE_NVG_Gen1,6) - MACRO_ADDITEM(ACE_NVG_Gen2,6) - //MACRO_ADDITEM(ACE_NVG_Gen3,6) - MACRO_ADDITEM(ACE_NVG_Gen4,6) - MACRO_ADDITEM(ACE_NVG_Wide,6) + class All { + ACE_NightVision_grain = 0.75; + ACE_NightVision_blur = 0.055; + }; + +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_NVG_Gen1,6) + MACRO_ADDITEM(ACE_NVG_Gen2,6) + //MACRO_ADDITEM(ACE_NVG_Gen3,6) + MACRO_ADDITEM(ACE_NVG_Gen4,6) + MACRO_ADDITEM(ACE_NVG_Wide,6) + }; }; - }; }; diff --git a/addons/nightvision/CfgWeapons.hpp b/addons/nightvision/CfgWeapons.hpp index 99cc55db20..c40885c2c4 100644 --- a/addons/nightvision/CfgWeapons.hpp +++ b/addons/nightvision/CfgWeapons.hpp @@ -1,56 +1,56 @@ class CfgWeapons { - class Binocular; - class NVGoggles: Binocular { - displayName = "$STR_ACE_NightVision_NVG_Gen3_brown"; - ACE_NightVision_grain = 0.75; - ACE_NightVision_blur = 0.055; - ACE_NightVision_radBlur = 0.001; - }; - class NVGoggles_OPFOR: NVGoggles { - displayName = "$STR_ACE_NightVision_NVG_Gen3_black"; - }; - class NVGoggles_INDEP: NVGoggles { - displayName = "$STR_ACE_NightVision_NVG_Gen3_green"; - }; + class Binocular; + class NVGoggles: Binocular { + displayName = "$STR_ACE_NightVision_NVG_Gen3_brown"; + ACE_NightVision_grain = 0.75; + ACE_NightVision_blur = 0.055; + ACE_NightVision_radBlur = 0.001; + }; + class NVGoggles_OPFOR: NVGoggles { + displayName = "$STR_ACE_NightVision_NVG_Gen3_black"; + }; + class NVGoggles_INDEP: NVGoggles { + displayName = "$STR_ACE_NightVision_NVG_Gen3_green"; + }; - class ACE_NVG_Gen1: NVGoggles_OPFOR { - author = "$STR_ACE_Common_ACETeam"; - modelOptics = "\A3\weapons_f\reticle\optics_night"; - displayName = "$STR_ACE_NightVision_NVG_Gen1"; - ACE_NightVision_grain = 2.25; - ACE_NightVision_blur = 0.22; - ACE_NightVision_radBlur = 0.004; - }; - class ACE_NVG_Gen2: NVGoggles_INDEP { - author = "$STR_ACE_Common_ACETeam"; - modelOptics = "\A3\weapons_f\reticle\optics_night"; - displayName = "$STR_ACE_NightVision_NVG_Gen2"; - ACE_NightVision_grain = 1.5; - ACE_NightVision_blur = 0.11; - ACE_NightVision_radBlur = 0.002; - }; - /*class ACE_NVG_Gen3: NVGoggles { + class ACE_NVG_Gen1: NVGoggles_OPFOR { + author = "$STR_ACE_Common_ACETeam"; + modelOptics = "\A3\weapons_f\reticle\optics_night"; + displayName = "$STR_ACE_NightVision_NVG_Gen1"; + ACE_NightVision_grain = 2.25; + ACE_NightVision_blur = 0.22; + ACE_NightVision_radBlur = 0.004; + }; + class ACE_NVG_Gen2: NVGoggles_INDEP { + author = "$STR_ACE_Common_ACETeam"; + modelOptics = "\A3\weapons_f\reticle\optics_night"; + displayName = "$STR_ACE_NightVision_NVG_Gen2"; + ACE_NightVision_grain = 1.5; + ACE_NightVision_blur = 0.11; + ACE_NightVision_radBlur = 0.002; + }; + /*class ACE_NVG_Gen3: NVGoggles { author = "$STR_ACE_Common_ACETeam"; modelOptics = "\A3\weapons_f\reticle\optics_night"; displayName = "$STR_ACE_NightVision_NVG_Gen3"; ACE_NightVision_grain = 0.75; ACE_NightVision_blur = 0.055; ACE_NightVision_radBlur = 0.001; - };*/ - class ACE_NVG_Gen4: NVGoggles { - author = "$STR_ACE_Common_ACETeam"; - modelOptics = "\A3\weapons_f\reticle\optics_night"; - displayName = "$STR_ACE_NightVision_NVG_Gen4"; - ACE_NightVision_grain = 0.0; - ACE_NightVision_blur = 0.0; - ACE_NightVision_radBlur = 0.0; - }; - class ACE_NVG_Wide: NVGoggles { - author = "$STR_ACE_Common_ACETeam"; - modelOptics = QUOTE(PATHTOF(ACE_nvg_wide_optics)); - displayName = "$STR_ACE_NightVision_NVG_FullScreen"; - ACE_NightVision_grain = 0.75; - ACE_NightVision_blur = 0.055; - ACE_NightVision_radBlur = 0.001; - }; +};*/ + class ACE_NVG_Gen4: NVGoggles { + author = "$STR_ACE_Common_ACETeam"; + modelOptics = "\A3\weapons_f\reticle\optics_night"; + displayName = "$STR_ACE_NightVision_NVG_Gen4"; + ACE_NightVision_grain = 0.0; + ACE_NightVision_blur = 0.0; + ACE_NightVision_radBlur = 0.0; + }; + class ACE_NVG_Wide: NVGoggles { + author = "$STR_ACE_Common_ACETeam"; + modelOptics = QUOTE(PATHTOF(models\ACE_nvg_wide_optics)); + displayName = "$STR_ACE_NightVision_NVG_FullScreen"; + ACE_NightVision_grain = 0.75; + ACE_NightVision_blur = 0.055; + ACE_NightVision_radBlur = 0.001; + }; }; diff --git a/addons/nightvision/XEH_postInitClient.sqf b/addons/nightvision/XEH_postInitClient.sqf index b81bedc07b..7513b1df16 100644 --- a/addons/nightvision/XEH_postInitClient.sqf +++ b/addons/nightvision/XEH_postInitClient.sqf @@ -35,3 +35,40 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; ["cameraViewChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); ["playerVehicleChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); ["playerTurretChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); + +// Add keybinds +["ACE3", +localize "STR_ACE_NightVision_IncreaseNVGBrightness", +{ + // Conditions: canInteract + _exceptions = [QEGVAR(captives,isNotEscorting)]; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if ((currentVisionMode _player != 1)) exitWith {false}; + + // Statement + [ACE_player, 1] call FUNC(changeNVGBrightness); + true +}, +[201, [false, false, true]], //PageUp + ALT +false, +"keydown" +] call cba_fnc_registerKeybind; + +["ACE3", +localize "STR_ACE_NightVision_DecreaseNVGBrightness", +{ + // Conditions: canInteract + _exceptions = [QEGVAR(captives,isNotEscorting)]; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if ((currentVisionMode _player != 1)) exitWith {false}; + + // Statement + [ACE_player, -1] call FUNC(changeNVGBrightness); + true +}, +[209, [false, false, true]], //PageDown + ALT +false, +"keydown" +] call cba_fnc_registerKeybind; diff --git a/addons/nightvision/XEH_preInit.sqf b/addons/nightvision/XEH_preInit.sqf index 98e19f31ad..27f8ea7d48 100644 --- a/addons/nightvision/XEH_preInit.sqf +++ b/addons/nightvision/XEH_preInit.sqf @@ -1,6 +1,9 @@ #include "script_component.hpp" +ADDON = false; + PREP(blending); -PREP(decreaseNVGBrightness); -PREP(increaseNVGBrightness); +PREP(changeNVGBrightness); PREP(updatePPEffects); + +ADDON = true; diff --git a/addons/nightvision/config.cpp b/addons/nightvision/config.cpp index 32c563bfb6..4e6aa2e39a 100644 --- a/addons/nightvision/config.cpp +++ b/addons/nightvision/config.cpp @@ -1,42 +1,17 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {"ACE_NVG_Gen1", "ACE_NVG_Gen2", /*"ACE_NVG_Gen3",*/ "ACE_NVG_Gen4", "ACE_NVG_Wide"}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi", "PabstMirror"}; - authorUrl = "https://github.com/commy2/"; - VERSION_CONFIG; - }; + class ADDON { + units[] = {}; + weapons[] = {"ACE_NVG_Gen1", "ACE_NVG_Gen2", /*"ACE_NVG_Gen3",*/ "ACE_NVG_Gen4", "ACE_NVG_Wide"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"commy2", "KoffeinFlummi", "PabstMirror"}; + authorUrl = "https://github.com/commy2/"; + VERSION_CONFIG; + }; }; #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" - - -// class EGVAR(common,Default_Keys) { //??? -class ACE_common_Default_Keys { - class increaseNVGBrightness { - displayName = "$STR_ACE_NightVision_IncreaseNVGBrightness"; - condition = QUOTE( currentVisionMode _player == 1 ); - statement = QUOTE( [_player, _vehicle] call FUNC(increaseNVGBrightness) ); - key = 201; - shift = 0; - control = 0; - alt = 1; - allowHolding = 1; - }; - class decreaseNVGBrightness { - displayName = "$STR_ACE_NightVision_DecreaseNVGBrightness"; - condition = QUOTE( currentVisionMode _player == 1 ); - statement = QUOTE( [_player, _vehicle] call FUNC(decreaseNVGBrightness) ); - key = 209; - shift = 0; - control = 0; - alt = 1; - allowHolding = 1; - }; -}; diff --git a/addons/nightvision/functions/fnc_blending.sqf b/addons/nightvision/functions/fnc_blending.sqf index df46c62b58..96e7f404a5 100644 --- a/addons/nightvision/functions/fnc_blending.sqf +++ b/addons/nightvision/functions/fnc_blending.sqf @@ -1,4 +1,24 @@ -// by commy2 +/* + * Author: commy2 + * Change the blending when the player fires?? + * + * Arguments: + * 0: unit - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot + * + * Return Value: + * Nothing + * + * Example: + * [clientFiredBIS-XEH] call ace_nightvision_fnc_blending + * + * Public: No + */ #include "script_component.hpp" private ["_vehicle", "_weapon", "_ammo", "_magazine", "_player"]; @@ -8,26 +28,26 @@ _weapon = _this select 1; _ammo = _this select 4; _magazine = _this select 5; -if ((_vehicle != (vehicle ACE_player)) || {(currentVisionMode _vehicle) != 1}) exitWith {}; - _player = ACE_player; - +//If our vehicle didn't shoot, or we're not in NVG mode, exit +if ((_vehicle != (vehicle _player)) || {(currentVisionMode _player) != 1}) exitWith {}; +//If we are mounted, and it wasn't our weapon system that fired, exit if (_player != _vehicle && {!(_weapon in (_vehicle weaponsTurret ([_player] call EFUNC(common,getTurretIndex))))}) exitWith {}; private ["_silencer", "_visibleFireCoef", "_visibleFireTimeCoef", "_visibleFire", "_visibleFireTime", "_nvgBrightnessCoef", "_fnc_isTracer", "_darkness"]; _silencer = switch (_weapon) do { - case (primaryWeapon _player) : {primaryWeaponItems _player select 0}; - case (secondaryWeapon _player) : {secondaryWeaponItems _player select 0}; - case (handgunWeapon _player) : {handgunItems _player select 0}; - default {""}; +case (primaryWeapon _player) : {primaryWeaponItems _player select 0}; +case (secondaryWeapon _player) : {secondaryWeaponItems _player select 0}; +case (handgunWeapon _player) : {handgunItems _player select 0}; + default {""}; }; _visibleFireCoef = 1; _visibleFireTimeCoef = 1; if (_silencer != "") then { - _visibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire"); - _visibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFireTime"); + _visibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire"); + _visibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFireTime"); }; _visibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFire"); @@ -36,24 +56,24 @@ _visibleFireTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFireTi _nvgBrightnessCoef = 1 + (_player getVariable [QGVAR(NVGBrightness), 0]) / 4; _fnc_isTracer = { - private ["_indexShot", "_lastRoundsTracer", "_tracersEvery"]; + private ["_indexShot", "_lastRoundsTracer", "_tracersEvery"]; - if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false}; + if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false}; - _indexShot = (_player ammo _weapon) + 1; + _indexShot = (_player ammo _weapon) + 1; - _lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer"); - if (_indexShot <= _lastRoundsTracer) exitWith {true}; + _lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer"); + if (_indexShot <= _lastRoundsTracer) exitWith {true}; - _tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery"); - if (_tracersEvery == 0) exitWith {false}; + _tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery"); + if (_tracersEvery == 0) exitWith {false}; - (_indexShot - _lastRoundsTracer) % _tracersEvery == 0 + (_indexShot - _lastRoundsTracer) % _tracersEvery == 0 }; if (call _fnc_isTracer) then { - _visibleFire = _visibleFire + 2; - _visibleFireTime = _visibleFireTime + 2; + _visibleFire = _visibleFire + 2; + _visibleFireTime = _visibleFireTime + 2; }; _darkness = 1 - (call EFUNC(common,ambientBrightness)); diff --git a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf new file mode 100644 index 0000000000..e1894aba00 --- /dev/null +++ b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf @@ -0,0 +1,33 @@ +/* + * Author: commy2 + * Change the brightness of the unit's NVG + * + * Arguments: + * 0: The Unit + * 1: Change in brightness (1 or -1) + * + * Return Value: + * Nothing + * + * Example: + * [player, 1] call ace_nightvision_fnc_changeNVGBrightness + * + * Public: No + */ +#include "script_component.hpp" + +private ["_brightness"]; + +PARAMS_2(_player,_changeInBrightness); + +_brightness = _player getVariable [QGVAR(NVGBrightness), 0]; + +_brightness = ((round (10 * _brightness + _changeInBrightness) / 10) min 1) max -1; + +_player setVariable [QGVAR(NVGBrightness), _brightness, false]; + +GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, 1, _brightness / 4, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]]; +GVAR(ppEffectNVGBrightness) ppEffectCommit 0; + +[format [(localize "STR_ACE_NightVision_NVGBrightness"), (_brightness * 100)]] call EFUNC(common,displayTextStructured); +playSound "ACE_Sound_Click"; diff --git a/addons/nightvision/functions/fnc_decreaseNVGBrightness.sqf b/addons/nightvision/functions/fnc_decreaseNVGBrightness.sqf deleted file mode 100644 index 0fb2de9d33..0000000000 --- a/addons/nightvision/functions/fnc_decreaseNVGBrightness.sqf +++ /dev/null @@ -1,21 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_player", "_vehicle", "_brightness"]; - -_player = _this select 0; -_vehicle = _this select 1; - -_brightness = _player getVariable [QGVAR(NVGBrightness), 0]; - -if (_brightness > -1) then { - _brightness = round (10 * _brightness - 1) / 10; - - _player setVariable [QGVAR(NVGBrightness), _brightness, false]; - - GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, 1, _brightness / 4, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]]; - GVAR(ppEffectNVGBrightness) ppEffectCommit 0; - - [format [localize "STR_ACE_NightVision_NVGBrightness", format ["%1%", _brightness * 100]]] call EFUNC(common,displayTextStructured); - playSound "ACE_Sound_Click"; -}; diff --git a/addons/nightvision/functions/fnc_increaseNVGBrightness.sqf b/addons/nightvision/functions/fnc_increaseNVGBrightness.sqf deleted file mode 100644 index e2143d5a5e..0000000000 --- a/addons/nightvision/functions/fnc_increaseNVGBrightness.sqf +++ /dev/null @@ -1,21 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_player", "_vehicle", "_brightness"]; - -_player = _this select 0; -_vehicle = _this select 1; - -_brightness = _player getVariable [QGVAR(NVGBrightness), 0]; - -if (_brightness < 1) then { - _brightness = round (10 * _brightness + 1) / 10; - - _player setVariable [QGVAR(NVGBrightness), _brightness, false]; - - GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, 1, _brightness / 4, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]]; - GVAR(ppEffectNVGBrightness) ppEffectCommit 0; - - [format [localize "STR_ACE_NightVision_NVGBrightness", format ["%1%", _brightness * 100]]] call EFUNC(common,displayTextStructured); - playSound "ACE_Sound_Click"; -}; diff --git a/addons/nightvision/functions/fnc_updatePPEffects.sqf b/addons/nightvision/functions/fnc_updatePPEffects.sqf index 1fdfbb9778..3edfe28e74 100644 --- a/addons/nightvision/functions/fnc_updatePPEffects.sqf +++ b/addons/nightvision/functions/fnc_updatePPEffects.sqf @@ -1,4 +1,18 @@ -//by commy2, PabstMirror and CAA-Picard +/* + * Author: commy2, PabstMirror and CAA-Picard + * Update the ppEffects everytime something changes + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * [someEvent] call ace_nightvision_fnc_updatePPEffects + * + * Public: No + */ #include "script_component.hpp" private ["_currentVehicle", "_grainSetting", "_blurSetting", "_radBlurSetting", "_config"]; diff --git a/addons/nightvision/ace_nvg_wide_optics.p3d b/addons/nightvision/models/ace_nvg_wide_optics.p3d similarity index 100% rename from addons/nightvision/ace_nvg_wide_optics.p3d rename to addons/nightvision/models/ace_nvg_wide_optics.p3d diff --git a/addons/optionsmenu/CfgEventHandlers.hpp b/addons/optionsmenu/CfgEventHandlers.hpp index 88bfdf4e6b..b97829836e 100644 --- a/addons/optionsmenu/CfgEventHandlers.hpp +++ b/addons/optionsmenu/CfgEventHandlers.hpp @@ -3,9 +3,3 @@ class Extended_PreInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; - -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); - }; -}; diff --git a/addons/optionsmenu/XEH_postInit.sqf b/addons/optionsmenu/XEH_postInit.sqf deleted file mode 100644 index c0b61d87de..0000000000 --- a/addons/optionsmenu/XEH_postInit.sqf +++ /dev/null @@ -1,4 +0,0 @@ -#include "script_component.hpp" - -//Add Settings from configFile -[] call FUNC(addFromConfig); diff --git a/addons/optionsmenu/XEH_preInit.sqf b/addons/optionsmenu/XEH_preInit.sqf index 97df9410e6..83a50bce65 100644 --- a/addons/optionsmenu/XEH_preInit.sqf +++ b/addons/optionsmenu/XEH_preInit.sqf @@ -2,16 +2,11 @@ ADDON = false; -PREP(addClientSideColor); -PREP(addClientSideOptions); -PREP(addFromConfig); -PREP(loadFromProfile); PREP(onListBoxSettingsChanged); PREP(onListBoxShowSelectionChanged); PREP(onSettingsMenuOpen); PREP(onSliderPosChanged); PREP(resetSettings); -PREP(saveToProfile); PREP(settingsMenuUpdateKeyView); PREP(settingsMenuUpdateList); PREP(updateSetting); diff --git a/addons/optionsmenu/functions/fnc_addClientSideColor.sqf b/addons/optionsmenu/functions/fnc_addClientSideColor.sqf deleted file mode 100644 index ca0473cb89..0000000000 --- a/addons/optionsmenu/functions/fnc_addClientSideColor.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/** - * fnc_addClientSideColor.sqf - * @Descr: N/A - * @Author: PabstMirror - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" - -private ["_currentValue"]; -PARAMS_4(_name,_localizedName,_localizedDescription,_defaultValue); - -GVAR(clientSideColors) pushBack [_name, _localizedName, _localizedDescription, [], _defaultValue]; - -//Get the current setting from profile (or default) and set it: -_currentValue = [MENU_TAB_COLORS, _name, _defaultValue] call FUNC(loadFromProfile); -[MENU_TAB_COLORS, _name, _currentValue] call FUNC(updateSetting); diff --git a/addons/optionsmenu/functions/fnc_addClientSideOptions.sqf b/addons/optionsmenu/functions/fnc_addClientSideOptions.sqf deleted file mode 100644 index 4ad9584410..0000000000 --- a/addons/optionsmenu/functions/fnc_addClientSideOptions.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/** - * fnc_addClientSideOptions.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" - -private ["_currentValue"]; -PARAMS_5(_name,_localizedName,_localizedDescription,_possibleValues,_defaultValue); - -GVAR(clientSideOptions) pushBack [_name, _localizedName, _localizedDescription, _possibleValues, -1, _defaultValue]; - -//Get the current setting from profile (or default) and set it: -_currentValue = [MENU_TAB_OPTIONS, _name, _defaultValue] call FUNC(loadFromProfile); -[MENU_TAB_OPTIONS, _name, _currentValue] call FUNC(updateSetting); diff --git a/addons/optionsmenu/functions/fnc_addFromConfig.sqf b/addons/optionsmenu/functions/fnc_addFromConfig.sqf deleted file mode 100644 index 226b5dee73..0000000000 --- a/addons/optionsmenu/functions/fnc_addFromConfig.sqf +++ /dev/null @@ -1,38 +0,0 @@ -/** -* fnc_addFromConfig.sqf -* @Descr: N/A -* @Author: PabstMirror -* -* @Arguments: [] -* @Return: -* @PublicAPI: false -*/ -#include "script_component.hpp" - -if (isClass (configFile >> "ACE_Options")) then { - _countOptions = count (configFile >> "ACE_Options"); - for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = (configFile >> "ACE_Options") select _index; - _name = configName _optionEntry; - _displayName = getText (_optionEntry >> "displayName"); - _description = getText (_optionEntry >> "description"); - _default = getNumber (_optionEntry >> "default"); - _choices = getArray (_optionEntry >> "values"); - if ((count _choices) == 0) then { - _choices = [(localize "STR_ACE_OptionsMenu_Disabled"), (localize "STR_ACE_OptionsMenu_Enabled")]; - }; - [_name, _displayName, _description, _choices, _default] call FUNC(addClientSideOptions); - }; -}; - -if (isClass (configFile >> "ACE_Colors")) then { - _countOptions = count (configFile >> "ACE_Colors"); - for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = (configFile >> "ACE_Colors") select _index; - _name = configName _optionEntry; - _displayName = getText (_optionEntry >> "displayName"); - _description = getText (_optionEntry >> "description"); - _default = getArray (_optionEntry >> "default"); - [_name, _displayName, _description, _default] call FUNC(addClientSideColor); - }; -}; diff --git a/addons/optionsmenu/functions/fnc_loadFromProfile.sqf b/addons/optionsmenu/functions/fnc_loadFromProfile.sqf deleted file mode 100644 index 21819f1add..0000000000 --- a/addons/optionsmenu/functions/fnc_loadFromProfile.sqf +++ /dev/null @@ -1,36 +0,0 @@ -/** -* fnc_loadFromProfile.sqf -* @Descr: N/A -* @Author: Glowbal -* -* @Arguments: [] -* @Return: -* @PublicAPI: false -*/ -#include "script_component.hpp" - -private ["_typeString", "_settingValue", "_badData"]; -PARAMS_3(_type,_name,_default); - -_typeString = ""; -switch (_type) do { -case (MENU_TAB_OPTIONS): {_typeString = "option";}; -case (MENU_TAB_COLORS): {_typeString = "color";}; -}; - -_settingValue = profileNamespace getvariable [(format ["ace_%1_%2", _typeString, _name]), _default]; - -_badData = isNil "_settingValue"; -if (!_badData) then { - switch (_type) do { - case (MENU_TAB_OPTIONS): {_badData = ((typeName _settingValue) != (typeName 0));}; - case (MENU_TAB_COLORS): {_badData = (((typeName _settingValue) != (typeName [])) || {(count _settingValue) != 4});}; - }; -}; -if (_badData) then { - _settingValue = _default; - systemChat format ["Bad Data in profile [ace_%1_%2] using default", _typeString, _name]; - ERROR("Bad Value in profile"); -}; - -_settingValue diff --git a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf index 11f5a3ef64..e3137f8ca9 100644 --- a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf @@ -9,5 +9,26 @@ */ #include "script_component.hpp" +// Filter only user setable setting +GVAR(clientSideOptions) = []; +GVAR(clientSideColors) = []; +{ + // If the setting is user setable and not forced + if ((_x select 2) && !(_x select 6)) then { + // Append the current value to the setting metadata + _setting = + _x; + _setting pushBack (missionNamespace getVariable (_x select 0)); + + // Categorize the setting according to types + // @todo: allow the user to modify other types of parameters? + if ((_x select 1) == "SCALAR" || (_x select 1) == "BOOL") then { + GVAR(clientSideOptions) pushBack _setting; + }; + if ((_x select 1) == "COLOR") then { + GVAR(clientSideColors) pushBack _setting; + }; + }; +} forEach EGVAR(common,settings); + //Delay a frame [{ [MENU_TAB_OPTIONS] call FUNC(onListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame); diff --git a/addons/optionsmenu/functions/fnc_resetSettings.sqf b/addons/optionsmenu/functions/fnc_resetSettings.sqf index bdc5c7662a..dd4b951ef5 100644 --- a/addons/optionsmenu/functions/fnc_resetSettings.sqf +++ b/addons/optionsmenu/functions/fnc_resetSettings.sqf @@ -13,13 +13,13 @@ private ["_name", "_default", "_lastSelected"]; { _name = _x select 0; - _default = _x select 5; + _default = _x select 7; [MENU_TAB_OPTIONS, _name, _default] call FUNC(updateSetting); } forEach GVAR(clientSideOptions); { _name = _x select 0; - _default = _x select 4; + _default = _x select 7; [MENU_TAB_COLORS, _name, _default] call FUNC(updateSetting); } forEach GVAR(clientSideColors); diff --git a/addons/optionsmenu/functions/fnc_saveToProfile.sqf b/addons/optionsmenu/functions/fnc_saveToProfile.sqf deleted file mode 100644 index 30db652186..0000000000 --- a/addons/optionsmenu/functions/fnc_saveToProfile.sqf +++ /dev/null @@ -1,37 +0,0 @@ -/** -* fnc_saveToProfile.sqf -* @Descr: Save the clientside option to the profile. -* @Author: Glowbal -* -* @Arguments: [name STRING (Name of setting)] -* @Return: BOOL True if saved. -* @PublicAPI: false -*/ -#include "script_component.hpp" - -private ["_nameSelected", "_saved"]; -PARAMS_2(_type,_name); - -_saved = false; -switch (_type) do { -case (MENU_TAB_OPTIONS): { - { - _nameSelected = _x select 0; - if (_nameSelected == _name) exitwith { - profileNamespace setvariable [(format ["ace_option_%1", _name]), (_x select 4)]; - _saved = true; - }; - }foreach GVAR(clientSideOptions); - }; -case (MENU_TAB_COLORS): { - { - _nameSelected = _x select 0; - if (_nameSelected == _name) exitwith { - profileNamespace setvariable [(format ["ace_color_%1", _name]), (_x select 3)]; - _saved = true; - }; - }foreach GVAR(clientSideColors); - }; -}; - -_saved diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf index 09242bcb8c..c271ecd176 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf @@ -33,8 +33,8 @@ if (count _collection > 0) then { _setting = _collection select _settingIndex; _entryName = _setting select 0; - _localizedName = _setting select 1; - _localizedDescription = _setting select 2; + _localizedName = _setting select 3; + _localizedDescription = _setting select 4; if (_localizedName == "") then {_localizedName = _entryName;}; (_settingsMenu displayCtrl 250) ctrlSetText _localizedName; @@ -43,15 +43,23 @@ if (count _collection > 0) then { switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { - _possibleValues = _setting select 3; - _settingsValue = _setting select 4; - lbClear 400; - { lbAdd [400, _x]; } foreach _possibleValues; + _possibleValues = _setting select 5; + _settingsValue = _setting select 8; + // Created disable/enable options for bools + if ((_setting select 1) == "BOOL") then { + lbClear 400; + lbAdd [400, (localize "STR_ACE_OptionsMenu_Disabled")]; + lbAdd [400, (localize "STR_ACE_OptionsMenu_Enabled")]; + _settingsValue = [0, 1] select _settingsValue; + } else { + lbClear 400; + { lbAdd [400, _x]; } foreach _possibleValues; + }; (_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue; }; case (MENU_TAB_COLORS): { - _currentColor = _setting select 3; + _currentColor = _setting select 8; { sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))]; } forEach [410, 411, 412, 413]; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf index ff825a2141..73a6d3de3b 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf @@ -21,21 +21,30 @@ lbclear _ctrlList; switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { { - _settingsText = ((_x select 3) select (_x select 4)); - _ctrlList lbadd (_x select 1); + _ctrlList lbadd (_x select 3); + + _settingsValue = _x select 8; + + // Created disable/enable options for bools + _settingsText = if ((_x select 1) == "BOOL") then { + [(localize "STR_ACE_OptionsMenu_Disabled"), (localize "STR_ACE_OptionsMenu_Enabled")] select _settingsValue; + } else { + (_x select 5) select _settingsValue; + }; + _ctrlList lbadd (_settingsText); }foreach GVAR(clientSideOptions); }; case (MENU_TAB_COLORS): { { - _color = +(_x select 3); + _color = +(_x select 8); { _color set [_forEachIndex, ((round (_x * 100))/100)]; } forEach _color; _settingsColor = str _color; - _ctrlList lbadd (_x select 1); + _ctrlList lbadd (_x select 3); _ctrlList lbadd (_settingsColor); - _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 3)]; + _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 8)]; }foreach GVAR(clientSideColors); }; }; diff --git a/addons/optionsmenu/functions/fnc_updateSetting.sqf b/addons/optionsmenu/functions/fnc_updateSetting.sqf index 403a09cdb2..e4a9917f25 100644 --- a/addons/optionsmenu/functions/fnc_updateSetting.sqf +++ b/addons/optionsmenu/functions/fnc_updateSetting.sqf @@ -17,25 +17,31 @@ _changed = false; switch (_type) do { case (MENU_TAB_OPTIONS): { { - if (((_x select 0) == _name) && {!((_x select 4) isEqualTo _newValue)}) then { - _changed = true; - _x set [4, _newValue]; + if ((_x select 0) == _name) then { + + if ((_x select 1) == "BOOL") then { + _newValue = [false, true] select _newValue; + }; + + if !((_x select 8) isEqualTo _newValue) then { + _changed = true; + _x set [8, _newValue]; + } ; + }; } foreach GVAR(clientSideOptions); }; case (MENU_TAB_COLORS): { { - if (((_x select 0) == _name) && {!((_x select 3) isEqualTo _newValue)}) then { + if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then { _changed = true; - _x set [3, _newValue]; + _x set [8, _newValue]; }; } foreach GVAR(clientSideColors); }; }; if (_changed) then { - missionNameSpace setVariable [_name, _newValue]; - [_type, _name] call FUNC(saveToProfile); - ["SettingChanged", [_name, _newValue]] call EFUNC(common,localEvent); - TRACE_2("Variable Updated",_name,_newValue); + profileNamespace setVariable [_name, _newValue]; + [_name, _newValue] call EFUNC(common,setSetting); }; diff --git a/addons/overheating/CfgSounds.hpp b/addons/overheating/CfgSounds.hpp index fd3a5596bd..c32fc02abf 100644 --- a/addons/overheating/CfgSounds.hpp +++ b/addons/overheating/CfgSounds.hpp @@ -3,4 +3,24 @@ class CfgSounds { sound[] = {QUOTE(PATHTOF(sounds\barrelswap.ogg)),5,1,200}; titles[] = {}; }; + class GVAR(jamming_rifle) { + name=QGVAR(jamming_rifle); + sound[]={QUOTE(PATHTOF(sounds\jamming_rifle.wav)),1,1}; + titles[]={}; + }; + class GVAR(jamming_pistol) { + name=QGVAR(jamming_pistol); + sound[]={QUOTE(PATHTOF(sounds\jamming_pistol.wav)),1,1}; + titles[]={}; + }; + class GVAR(fixing_rifle) { + name=QGVAR(fixing_rifle); + sound[]={QUOTE(PATHTOF(sounds\fixing_rifle.wav)),1,1}; + titles[]={}; + }; + class GVAR(fixing_pistol) { + name= QGVAR(fixing_pistol); + sound[]={QUOTE(PATHTOF(sounds\fixing_pistol.wav)),1,1}; + titles[]={}; + }; }; diff --git a/addons/overheating/XEH_preInit.sqf b/addons/overheating/XEH_preInit.sqf index fb3c53040d..2bd256087b 100644 --- a/addons/overheating/XEH_preInit.sqf +++ b/addons/overheating/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(checkTemperature); PREP(clearJam); PREP(cooldown); @@ -8,3 +10,5 @@ PREP(jamWeapon); PREP(overheat); PREP(swapBarrel); PREP(swapBarrelCallback); + +ADDON = true; diff --git a/addons/overheating/functions/fnc_checkTemperature.sqf b/addons/overheating/functions/fnc_checkTemperature.sqf index 92b6d1727e..02747b0129 100644 --- a/addons/overheating/functions/fnc_checkTemperature.sqf +++ b/addons/overheating/functions/fnc_checkTemperature.sqf @@ -1,15 +1,18 @@ /* * Author: Commy2 and CAA-Picard - * * Make the player check the temperature of his weapon * * Arguments: - * 0: _player - * 1: _weapon + * 0: Player + * 1: Weapon * - * Return Values: + * Return Value: * None * + * Example: + * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf index 829ab34811..76941d75ac 100644 --- a/addons/overheating/functions/fnc_clearJam.sqf +++ b/addons/overheating/functions/fnc_clearJam.sqf @@ -1,15 +1,16 @@ /* * Author: Commy2 + * Make the unit clear the jam from a weapon * - * Clears the jam from a weapon + * Arguments: + * 0: Player + * 1: Weapon + * 2: Skip anim? * - * Argument: - * 0: Last temperature (number) - * 1: Barrel mass (number) - * 2: Time (number) + * Return Value: + * None * - * Return value: - * New temperature (number) + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" @@ -42,6 +43,12 @@ if (_weapon in _jammedWeapons) then { _unit playActionNow _clearJamAction; }; - + if (_weapon == primaryWeapon _unit) then { + playSound QGVAR(fixing_rifle); + } else { + if (_weapon == secondaryWeapon _unit) then { + playSound QGVAR(fixing_pistol); + }; + }; [localize "STR_ACE_Overheating_WeaponUnjammed"] call EFUNC(common,displayTextStructured); }; diff --git a/addons/overheating/functions/fnc_cooldown.sqf b/addons/overheating/functions/fnc_cooldown.sqf index 13d53c7327..718c77474f 100644 --- a/addons/overheating/functions/fnc_cooldown.sqf +++ b/addons/overheating/functions/fnc_cooldown.sqf @@ -1,15 +1,16 @@ /* * Author: CAA-Picard - * * Calculate cooling down of the weapon. * * Argument: - * 0: Last temperature (number) - * 1: Barrel mass (number) - * 2: Time (number) + * 0: Last temperature + * 1: Barrel mass + * 2: Time * * Return value: - * New temperature (number) + * New temperature + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_displayTemperature.sqf b/addons/overheating/functions/fnc_displayTemperature.sqf index 130eec5f39..9af817f8fd 100644 --- a/addons/overheating/functions/fnc_displayTemperature.sqf +++ b/addons/overheating/functions/fnc_displayTemperature.sqf @@ -1,15 +1,15 @@ /* * Author: Commy2 and CAA-Picard - * * Displays the weapon temperature * * Arguments: - * 0: _player - * 1: _weapon + * 0: Player + * 1: Weapon * * Return Values: * None * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf index beb3a1925b..f11b72688c 100644 --- a/addons/overheating/functions/fnc_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -1,14 +1,15 @@ /* * Author: Commy2, based on KK_fnc_playerWeaponMulfunction from KillzoneKid - * * Jam the weapon * * Argument: - * 0: unit - * 1: weapon + * 0: Unit + * 1: Weapon * * Return value: * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index 05a286cfa2..9f26d51869 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -1,17 +1,19 @@ /* * Author: Commy2 and CAA-Picard - * - * Heat up the weapon + * Handle weapon fire, heat up the weapon * * Argument: - * 0: unit - * 1: weapon - * 2: ammo - * 3: projectile - * 4: velocity + * 0: Unit + * 1: Weapon + * 3: Muzzle + * 4: Ammo + * 5: Magazine + * 6: Projectile * * Return value: * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_swapBarrel.sqf b/addons/overheating/functions/fnc_swapBarrel.sqf index 6bacbe5049..2384fb470e 100644 --- a/addons/overheating/functions/fnc_swapBarrel.sqf +++ b/addons/overheating/functions/fnc_swapBarrel.sqf @@ -1,14 +1,15 @@ /* * Author: Commy2 - * * Make a unit start swapping it's barrel * * Argument: - * 0: unit - * 1: weapon + * 0: Unit + * 1: Weapon * * Return value: * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_swapBarrelCallback.sqf b/addons/overheating/functions/fnc_swapBarrelCallback.sqf index 88201dc9f4..e626bf2aea 100644 --- a/addons/overheating/functions/fnc_swapBarrelCallback.sqf +++ b/addons/overheating/functions/fnc_swapBarrelCallback.sqf @@ -1,14 +1,15 @@ /* * Author: Commy2 - * * Swap barrel callback * * Argument: - * 0: unit - * 1: weapon + * 0: Unit + * 1: Weapon * * Return value: * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/TO_MERGE/cse/sys_weaponheat/sound/fixing_pistol.wav b/addons/overheating/sounds/fixing_pistol.wav similarity index 100% rename from TO_MERGE/cse/sys_weaponheat/sound/fixing_pistol.wav rename to addons/overheating/sounds/fixing_pistol.wav diff --git a/TO_MERGE/cse/sys_weaponheat/sound/fixing_rifle.wav b/addons/overheating/sounds/fixing_rifle.wav similarity index 100% rename from TO_MERGE/cse/sys_weaponheat/sound/fixing_rifle.wav rename to addons/overheating/sounds/fixing_rifle.wav diff --git a/TO_MERGE/cse/sys_weaponheat/sound/jamming_pistol.wav b/addons/overheating/sounds/jamming_pistol.wav similarity index 100% rename from TO_MERGE/cse/sys_weaponheat/sound/jamming_pistol.wav rename to addons/overheating/sounds/jamming_pistol.wav diff --git a/TO_MERGE/cse/sys_weaponheat/sound/jamming_rifle.wav b/addons/overheating/sounds/jamming_rifle.wav similarity index 100% rename from TO_MERGE/cse/sys_weaponheat/sound/jamming_rifle.wav rename to addons/overheating/sounds/jamming_rifle.wav diff --git a/addons/overpressure/$PBOPREFIX$ b/addons/overpressure/$PBOPREFIX$ new file mode 100644 index 0000000000..fc5a82e0f7 --- /dev/null +++ b/addons/overpressure/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\overpressure \ No newline at end of file diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp new file mode 100644 index 0000000000..40c3b32a57 --- /dev/null +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -0,0 +1,46 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +class Extended_FiredBIS_EventHandlers { + class CAManBase { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireLauncherBackblast)}); + }; + }; + + class Tank { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Car { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Helicopter { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Plane { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Ship_F { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; +}; diff --git a/addons/overpressure/CfgWeapons.hpp b/addons/overpressure/CfgWeapons.hpp new file mode 100644 index 0000000000..5880795ee2 --- /dev/null +++ b/addons/overpressure/CfgWeapons.hpp @@ -0,0 +1,49 @@ + +class CfgWeapons { + + class LauncherCore; + class Launcher: LauncherCore { + GVAR(angle) = 60; + GVAR(range) = 10; + GVAR(damage) = 0.7; + }; + + class Launcher_Base_F: Launcher {}; + + class launch_Titan_base: Launcher_Base_F { + GVAR(angle) = 40; + GVAR(range) = 8; + GVAR(damage) = 0.5; + }; + + class launch_Titan_short_base: launch_Titan_base { + GVAR(angle) = 40; + GVAR(range) = 8; + GVAR(damage) = 0.5; + }; + + class launch_NLAW_F: Launcher_Base_F { + GVAR(angle) = 40; + GVAR(range) = 5; + GVAR(damage) = 0.6; + }; + + class launch_RPG32_F: Launcher_Base_F { + GVAR(angle) = 60; + GVAR(range) = 15; + GVAR(damage) = 0.7; + }; + + class CannonCore; + class cannon_120mm: CannonCore { + GVAR(angle) = 90; + GVAR(range) = 50; + GVAR(damage) = 0.85; + }; + + class mortar_155mm_AMOS: CannonCore { + GVAR(angle) = 90; + GVAR(range) = 60; + GVAR(damage) = 1; + }; +}; diff --git a/addons/backblast/README.md b/addons/overpressure/README.md similarity index 94% rename from addons/backblast/README.md rename to addons/overpressure/README.md index 857776693a..3d3f242e40 100644 --- a/addons/backblast/README.md +++ b/addons/overpressure/README.md @@ -1,4 +1,4 @@ -ace_backblast +ace_overpressure ============= Adds backblast to AT launchers and overpressure zones to tank cannons. diff --git a/addons/overpressure/XEH_postInit.sqf b/addons/overpressure/XEH_postInit.sqf new file mode 100644 index 0000000000..33c2e679c9 --- /dev/null +++ b/addons/overpressure/XEH_postInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +["overpressure", FUNC(overpressureDamage)] call EFUNC(common,addEventHandler); diff --git a/addons/overpressure/XEH_preInit.sqf b/addons/overpressure/XEH_preInit.sqf new file mode 100644 index 0000000000..5eefc5eae4 --- /dev/null +++ b/addons/overpressure/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(fireLauncherBackblast); +PREP(fireOverpressureZone); +PREP(getDistance); +PREP(overpressureDamage); + +ADDON = true; diff --git a/addons/backblast/config.cpp b/addons/overpressure/config.cpp similarity index 85% rename from addons/backblast/config.cpp rename to addons/overpressure/config.cpp index 88de936cf9..4f866beedc 100644 --- a/addons/backblast/config.cpp +++ b/addons/overpressure/config.cpp @@ -6,12 +6,11 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi"}; + author[] = {"commy2","KoffeinFlummi","CAA-Picard"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" - #include "CfgWeapons.hpp" diff --git a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf new file mode 100644 index 0000000000..f42ffd23ed --- /dev/null +++ b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf @@ -0,0 +1,97 @@ +/* + * Author: commy2 and CAA-Picard + * + * Handle fire of local launchers + * + * Argument: + * 0: Unit that fired (Object) + * 1: Weapon fired (String) + * 2: Muzzle (String) + * 3: Mode (String) + * 4: Ammo (String) + * 5: Magazine (String) + * 6: Projectile (Object) + * + * Return value: + * None + */ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +// Prevent AI from causing backblast damage +if !([_firer] call EFUNC(common,isPlayer)) exitWith {}; + +private ["_position", "_direction"]; + +_position = getPosASL _projectile; +_direction = [0, 0, 0] vectorDiff (vectorDir _projectile); + +private ["_backblastAngle", "_backblastRange", "_backblastDamage"]; + +_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); + +// Damage to others +private "_affected"; +_affected = getPos _projectile nearEntities ["CAManBase", _backblastRange]; + +// Let each client handle their own affected units +["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); + +// Damage to the firer +private "_distance"; +_distance = [_position, _direction, _backblastRange] call FUNC(getDistance); + +TRACE_1("Distance",_distance); + +if (_distance < _backblastRange) then { + private ["_alpha", "_beta", "_damage"]; + + _alpha = sqrt (1 - _distance / _backblastRange); + _beta = sqrt 0.5; + + _damage = 2 * _alpha * _beta * _backblastDamage; + [_damage * 100] call BIS_fnc_bloodEffect; + + // TODO: Sort this interaction with medical + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { + [_firer, "HitBody", ([_firer, "", ((_firer getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); + } else { + _firer setDamage (damage _firer + _damage); + }; +}; + +// Draw debug lines +#ifdef DEBUG_MODE_FULL + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + private "_ref"; + _ref = _direction call EFUNC(common,createOrthonormalReference); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + [ _position, + _position vectorAdd (_direction vectorMultiply (_distance min _backblastRange)), + [1,0,0,1] + ] call EFUNC(common,addLineToDebugDraw); +#endif diff --git a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf new file mode 100644 index 0000000000..cc4918275d --- /dev/null +++ b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf @@ -0,0 +1,70 @@ +/* + * Author: commy2 and CAA-Picard + * + * Handle fire of local vehicle weapons creating overpressure zones + * + * Argument: + * 0: Unit that fired (Object) + * 1: Weapon fired (String) + * 2: Muzzle (String) + * 3: Mode (String) + * 4: Ammo (String) + * 5: Magazine (String) + * 6: Projectile (Object) + * + * Return value: + * None + */ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +// Prevent AI from causing overpressure damage +if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets? + +private ["_position", "_direction"]; + +_position = getPosASL _projectile; +_direction = vectorDir _projectile; + +private ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; + +_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); + +// Damage to others +private "_affected"; +_affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; + +// Let each client handle their own affected units +["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); + +// Draw debug lines +#ifdef DEBUG_MODE_FULL + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange), + [1,0,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + private "_ref"; + _ref = _direction call EFUNC(common,createOrthonormalReference); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + +#endif diff --git a/addons/overpressure/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf new file mode 100644 index 0000000000..6ffa60f7af --- /dev/null +++ b/addons/overpressure/functions/fnc_getDistance.sqf @@ -0,0 +1,40 @@ +/* + * Author: commy2 and CAA-Picard + * + * Calculate the distance to the first intersection of a line + * + * Argument: + * 0: Pos ASL of origin (Array) + * 1: Direction (Array) + * 2: Max distance to search (Number) + * + * Return value: + * Distance to intersection (+- 0.1 m) + */ +#include "script_component.hpp" + +EXPLODE_3_PVT(_this,_posASL,_direction,_maxDistance); + +private ["_distance", "_interval", "_line", "_intersections"]; + +_distance = _maxDistance; +_interval = _distance; +_line = [_posASL, []]; + +while { + _interval > 0.1 +} do { + _interval = _interval / 2; + + _line set [1, _posASL vectorAdd (_direction vectorMultiply _distance)]; + + _intersections = { + _x isKindOf "Static" || {_x isKindOf "AllVehicles"} + } count (lineIntersectsWith _line); + + _distance = _distance + ([1, -1] select (_intersections > 0 || {terrainIntersectASL _line})) * _interval; + + if (_distance > _maxDistance) exitWith {_distance = 999}; +}; + +_distance diff --git a/addons/overpressure/functions/fnc_overpressureDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf new file mode 100644 index 0000000000..c19fed1c04 --- /dev/null +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -0,0 +1,70 @@ +/* + * Author: commy2 and CAA-Picard + * + * Calculate and apply backblast damage to potentially affected local units + * + * Argument: + * 0: Unit that fired (Object) + * 1: Pos ASL of the projectile (Array) + * 2: Direction of the projectile (Array) + * 3: Weapon fired (String) + * + * Return value: + * None + */ +#include "script_component.hpp" + +EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon); + +private ["_overpressureAngle", "_overpressureRange", "_overpressureDamage"]; + +_overpressureAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_overpressureRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_overpressureDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); + +TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon); + +private "_pos"; +_pos = _posASL; +if (!surfaceIsWater _pos) then { + _pos = ASLtoATL _pos; +}; + +{ + if (local _x && {_x != _firer} && {vehicle _x == _x}) then { + private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"]; + + _targetPositionASL = eyePos _x; + _relativePosition = _targetPositionASL vectorDiff _posASL; + _axisDistance = _relativePosition vectorDotProduct _direction; + _distance = vectorMagnitude _relativePosition; + _angle = acos (_axisDistance / _distance); + + _line = [_posASL, _targetPositionASL, _firer, _x]; + _line2 = [_posASL, _targetPositionASL]; + TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); + + if (_angle < _overpressureAngle && {_distance < _overpressureRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { + private ["_alpha", "_beta", "_damage"]; + + _alpha = sqrt (1 - _distance / _overpressureRange); + _beta = sqrt (1 - _angle / _overpressureAngle); + + _damage = 2 * _alpha * _beta * _overpressureDamage; + + // If the target is the ACE_player + if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; + + // TODO: Sort this interaction with medical + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { + [_x, "HitBody", ([_x, "", (_x getHitPointDamage "HitBody") + _damage, objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); + _x spawn { + sleep 0.5; + [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); + }; + } else { + _x setDamage (damage _x + _damage); + }; + }; + }; +} forEach (_pos nearEntities ["CAManBase", _overpressureRange]); diff --git a/addons/overpressure/functions/script_component.hpp b/addons/overpressure/functions/script_component.hpp new file mode 100644 index 0000000000..d66ac7aec3 --- /dev/null +++ b/addons/overpressure/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\overpressure\script_component.hpp" \ No newline at end of file diff --git a/addons/overpressure/script_component.hpp b/addons/overpressure/script_component.hpp new file mode 100644 index 0000000000..8dac72cbbf --- /dev/null +++ b/addons/overpressure/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT overpressure +#include "\z\ace\Addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_OVERPRESSURE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_ENABLED_OVERPRESSURE + #define DEBUG_SETTINGS DEBUG_ENABLED_OVERPRESSURE +#endif + +#include "\z\ace\Addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/parachute/$PBOPREFIX$ b/addons/parachute/$PBOPREFIX$ new file mode 100644 index 0000000000..724d3e9c6d --- /dev/null +++ b/addons/parachute/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\parachute diff --git a/addons/parachute/CfgEventHandlers.hpp b/addons/parachute/CfgEventHandlers.hpp new file mode 100644 index 0000000000..8c7edda20f --- /dev/null +++ b/addons/parachute/CfgEventHandlers.hpp @@ -0,0 +1,10 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/TO_MERGE/agm/Parachute/Gurtgeschirr.p3d b/addons/parachute/Gurtgeschirr.p3d similarity index 100% rename from TO_MERGE/agm/Parachute/Gurtgeschirr.p3d rename to addons/parachute/Gurtgeschirr.p3d diff --git a/addons/parachute/README.md b/addons/parachute/README.md new file mode 100644 index 0000000000..fcf1a36333 --- /dev/null +++ b/addons/parachute/README.md @@ -0,0 +1,11 @@ +ace_parachute +=========== + +Improves parachutes and adds an altimeter. + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [CorruptedHeart](https://github.com/CorruptedHeart) +- [esteldunedain](https://github.com/esteldunedain) diff --git a/TO_MERGE/agm/Parachute/RscTitles.hpp b/addons/parachute/RscTitles.hpp similarity index 89% rename from TO_MERGE/agm/Parachute/RscTitles.hpp rename to addons/parachute/RscTitles.hpp index ae90e0f472..d51bcad128 100644 --- a/TO_MERGE/agm/Parachute/RscTitles.hpp +++ b/addons/parachute/RscTitles.hpp @@ -1,18 +1,18 @@ class RscText; class RscPicture; class RscTitles { - class AGM_Altimeter { + class ACE_Altimeter { idd = 9935; enableSimulation = 1; movingEnable = 0; fadeIn=0; fadeOut=1; duration = 10e10; - onLoad = "uiNamespace setVariable ['AGM_Altimeter', _this select 0];"; + onLoad = "uiNamespace setVariable ['ACE_Altimeter', _this select 0];"; class controls { class AltimeterImage: RscPicture { idc = 1200; - text = "AGM_Parachute\UI\watch_altimeter.paa"; + text = PATHTOF(UI\watch_altimeter.paa); x = 0.118437 * safezoneW + safezoneX; y = 0.621 * safezoneH + safezoneY; w = 0.20625 * safezoneW; @@ -48,4 +48,4 @@ class RscTitles { }; }; }; -}; \ No newline at end of file +}; diff --git a/TO_MERGE/agm/Parachute/T10Schirm.p3d b/addons/parachute/T10Schirm.p3d similarity index 100% rename from TO_MERGE/agm/Parachute/T10Schirm.p3d rename to addons/parachute/T10Schirm.p3d diff --git a/TO_MERGE/agm/Parachute/UI/watch_altimeter.paa b/addons/parachute/UI/watch_altimeter.paa similarity index 100% rename from TO_MERGE/agm/Parachute/UI/watch_altimeter.paa rename to addons/parachute/UI/watch_altimeter.paa diff --git a/addons/parachute/XEH_postInit.sqf b/addons/parachute/XEH_postInit.sqf new file mode 100644 index 0000000000..a15e125edd --- /dev/null +++ b/addons/parachute/XEH_postInit.sqf @@ -0,0 +1,43 @@ +/* + * Author: Garth 'L-H' de Wet + * Initialises the parachute system. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ +#include "script_component.hpp" +if (!hasInterface) exitWith {}; + +["ACE3", localize "STR_ACE_Parachute_showAltimeter", +{ + // Conditions: canInteract + _exceptions = [QEGVAR(interaction,isNotEscorting)]; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false}; + if (!(missionNamespace getVariable [QGVAR(AltimeterActive), false])) then { + [ace_player] call FUNC(showAltimeter); + } else { + call FUNC(hideAltimeter); + }; + true +}, [24, false, false, false], false, "keydown"] call CALLSTACK(cba_fnc_registerKeybind); + +GVAR(PFH) = false; +["playerVehicleChanged",{ + if (!GVAR(PFH) && {(vehicle ACE_player) isKindOf "ParachuteBase"}) then { + GVAR(PFH) = true; + [FUNC(onEachFrame), 0.1, []] call CALLSTACK(cba_fnc_addPerFrameHandler); + }; +}] call EFUNC(common,addEventHandler); + +// don't show speed and height when in expert mode +["Parachute", {if (!cadetMode) then {_dlg = _this select 0; {(_dlg displayCtrl _x) ctrlShow false} forEach [121, 122, 1004, 1005, 1006, 1014];};}] call EFUNC(common,addInfoDisplayEventHandler); //@todo addEventHandler infoDisplayChanged with select 1 == "Parachute" +["Soldier", {if (!cadetMode) then {_dlg = _this select 0; {_ctrl = (_dlg displayCtrl _x); _ctrl ctrlSetPosition [0,0,0,0]; _ctrl ctrlCommit 0;} forEach [380, 382]};}] call EFUNC(common,addInfoDisplayEventHandler); //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier" diff --git a/addons/parachute/XEH_preInit.sqf b/addons/parachute/XEH_preInit.sqf new file mode 100644 index 0000000000..91c24606c6 --- /dev/null +++ b/addons/parachute/XEH_preInit.sqf @@ -0,0 +1,25 @@ +/* + * Author: Garth 'L-H' de Wet + * Initialises the parachute system. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ +#include "script_component.hpp" + +ADDON = false; + +PREP(doLanding); +PREP(hideAltimeter); +PREP(onEachFrame); +PREP(showAltimeter); + +ADDON = true; diff --git a/addons/parachute/config.cpp b/addons/parachute/config.cpp new file mode 100644 index 0000000000..924c8ccb2c --- /dev/null +++ b/addons/parachute/config.cpp @@ -0,0 +1,61 @@ +#include "script_component.hpp" + +class CfgPatches { + class ACE_Parachute { + units[] = {"ACE_NonSteerableParachute"}; + weapons[] = {"ACE_Altimeter"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + VERSION_CONFIG; + author[] = {"Garth 'LH' de Wet"}; + authorUrl = "http://garth.snakebiteink.co.za/"; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "RscTitles.hpp" + +class CfgWeapons { + class ItemWatch; + class ACE_Altimeter:ItemWatch { + author = "$STR_ACE_Common_ACETeam"; + descriptionShort = "$STR_ACE_Parachute_AltimeterDescription"; + displayName = "$STR_ACE_Parachute_AltimeterDisplayName"; + picture = PATHTOF(UI\watch_altimeter.paa); + }; +}; + +class CfgVehicles { + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + class _xx_ACE_Altimeter { + name = "ACE_Altimeter"; + count = 6; + }; + }; + class TransportBackpacks { + class _xx_ACE_NonSteerableParachute { + backpack = "ACE_NonSteerableParachute"; + count = 4; + }; + }; + }; + + class B_Parachute; + class ACE_NonSteerableParachute: B_Parachute { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; + displayName = "$STR_ACE_Parachute_NonSteerableParachute"; + //picture = "\A3\Characters_F\data\ui\icon_b_parachute_ca.paa"; // @todo + //model = "\A3\Weapons_F\Ammoboxes\Bags\Backpack_Parachute"; // @todo + backpackSimulation = "ParachuteNonSteerable"; //ParachuteSteerable + ParachuteClass = "NonSteerable_Parachute_F"; + maximumLoad = 0; + mass = 100; + }; + + class B_Soldier_05_f; class B_Pilot_F: B_Soldier_05_f {backpack = "ACE_NonSteerableParachute";}; + class I_Soldier_04_F; class I_pilot_F: I_Soldier_04_F {backpack = "ACE_NonSteerableParachute";}; + class O_helipilot_F; class O_Pilot_F: O_helipilot_F {backpack = "ACE_NonSteerableParachute";}; +}; diff --git a/addons/parachute/functions/fnc_doLanding.sqf b/addons/parachute/functions/fnc_doLanding.sqf new file mode 100644 index 0000000000..134ab8a3ea --- /dev/null +++ b/addons/parachute/functions/fnc_doLanding.sqf @@ -0,0 +1,26 @@ +/* + * Author: Garth 'L-H' de Wet + * Performs the landing animation fix + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [player] call ACE_Parachute_fnc_doLanding; + * + * Public: No + */ +#include "script_component.hpp" +private ["_unit"]; +_unit = _this select 0; +GVAR(PFH) = false; +[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call EFUNC(common,doAnimation); +[{ + if (time >= ((_this select 0) select 0) + 1) then { + ((_this select 0) select 1) playActionNow "Crouch"; + [(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler); + }; +}, 1, [time,_unit]] call CALLSTACK(cba_fnc_addPerFrameHandler); diff --git a/addons/parachute/functions/fnc_hideAltimeter.sqf b/addons/parachute/functions/fnc_hideAltimeter.sqf new file mode 100644 index 0000000000..dd7d29fce4 --- /dev/null +++ b/addons/parachute/functions/fnc_hideAltimeter.sqf @@ -0,0 +1,18 @@ +/* + * Author: Garth 'L-H' de Wet + * Removes the altimeter from the screen. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ACE_Parachute_fnc_hideAltimeter + * + * Public: No + */ +#include "script_component.hpp" +GVAR(AltimeterActive) = false; +(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutText ["","PLAIN",0,true]; diff --git a/addons/parachute/functions/fnc_onEachFrame.sqf b/addons/parachute/functions/fnc_onEachFrame.sqf new file mode 100644 index 0000000000..be9f0e000c --- /dev/null +++ b/addons/parachute/functions/fnc_onEachFrame.sqf @@ -0,0 +1,33 @@ +/* + * Author: Garth 'L-H' de Wet + * Checks whether the unit should preform landing. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ACE_Parachute_fnc_onEachFrame; + * + * Public: No + */ +#include "script_component.hpp" +private "_player"; +_player = ACE_player; +if (!GVAR(PFH)) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);}; +if (isNull _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;}; +if !((vehicle _player) isKindOf "ParachuteBase") exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;}; +if (isTouchingGround _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;}; + +private ["_pos"]; +_pos = getPosASL (vehicle _player); + +if ((lineIntersects [_pos, _pos vectorAdd [0,0,-0.5], vehicle _player, _player]) || {((ASLtoATL _pos) select 2) < 0.75}) then { + [(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler); + GVAR(PFH) = false; +// I believe this will not work for Zeus units. + deleteVehicle (vehicle _player); + [_player] call FUNC(doLanding); +}; diff --git a/addons/parachute/functions/fnc_showAltimeter.sqf b/addons/parachute/functions/fnc_showAltimeter.sqf new file mode 100644 index 0000000000..1b3edc26f5 --- /dev/null +++ b/addons/parachute/functions/fnc_showAltimeter.sqf @@ -0,0 +1,46 @@ +/* + * Author: Garth 'L-H' de Wet + * Displays the altimeter on screen. + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [player] call ACE_Parachute_fnc_showAltimeter + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_unit"]; +_unit = _this select 0; +(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutRsc ["ACE_Altimeter", "PLAIN",0,true]; +if (isNull (uiNamespace getVariable ["ACE_Altimeter", displayNull])) exitWith {}; + +GVAR(AltimeterActive) = true; +[{ + if (!GVAR(AltimeterActive)) exitWith {[_this select 1] call CALLSTACK(cba_fnc_removePerFrameEventHandler);}; + disableSerialization; + EXPLODE_4_PVT(_this select 0,_display,_unit,_oldHeight,_prevTime); + if !("ACE_Altimeter" in assignedItems _unit) exitWith {[_this select 1] call CALLSTACK(cba_fnc_removePerFrameEventHandler);call FUNC(hideAltimeter);}; + + private ["_height", "_hour", "_minute", "_descentRate","_HeightText", "_DecendRate", "_TimeText", "_curTime"]; + _HeightText = _display displayCtrl 1100; + _DecendRate = _display displayCtrl 1000; + _TimeText = _display displayCtrl 1001; + _hour = floor daytime; + _minute = floor ((daytime - _hour) * 60); + + _height = (getPosASL _unit) select 2; + _curTime = time; + _descentRate = floor ((_oldHeight - _height) / (_curTime - _prevTime)); + + _TimeText ctrlSetText (format ["%1:%2",[_hour, 2] call EFUNC(common,numberToDigitsString),[_minute, 2] call EFUNC(common,numberToDigitsString)]); + _HeightText ctrlSetText (format ["%1", floor(_height)]); + _DecendRate ctrlSetText (format ["%1", _descentRate max 0]); + + (_this select 0) set [2, _height]; + (_this select 0) set [3, _curTime]; +}, 0.2, [uiNamespace getVariable ["ACE_Altimeter", displayNull], _unit,floor ((getPosASL _unit) select 2), time]] call CALLSTACK(cba_fnc_addPerFrameEventHandler); diff --git a/addons/parachute/functions/script_component.hpp b/addons/parachute/functions/script_component.hpp new file mode 100644 index 0000000000..29f2e63e07 --- /dev/null +++ b/addons/parachute/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\parachute\script_component.hpp" diff --git a/addons/parachute/script_component.hpp b/addons/parachute/script_component.hpp new file mode 100644 index 0000000000..0b0493b202 --- /dev/null +++ b/addons/parachute/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT parachute +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_PARACHUTE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_PARACHUTE + #define DEBUG_SETTINGS DEBUG_SETTINGS_PARACHUTE +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/TO_MERGE/agm/Parachute/stringtable.xml b/addons/parachute/stringtable.xml similarity index 89% rename from TO_MERGE/agm/Parachute/stringtable.xml rename to addons/parachute/stringtable.xml index f1542b1db8..f97b389eeb 100644 --- a/TO_MERGE/agm/Parachute/stringtable.xml +++ b/addons/parachute/stringtable.xml @@ -1,8 +1,8 @@  - + - + Altimeter Altimètre Höhenmesser @@ -12,7 +12,7 @@ Magasságmérő Высотомер - + Altimeter Watch Montre altimètre Höhenmesser @@ -22,7 +22,7 @@ Magasságmérő Часы с высотомером - + Used to show height, descent rate and the time. Affiche la hauteur, le taux de descente et l'heure. Zeigt Höhe, Fallgeschwindigkeit und Uhrzeit. @@ -32,7 +32,7 @@ Mutatja a magasságot, zuhanás sebességét és az időt. Используется для определения высоты, скорости снижения и времени. - + Non-Steerable Parachute Ungelenkter Fallschirm Paracaídas no dirigible diff --git a/addons/realisticnames/config.cpp b/addons/realisticnames/config.cpp index 347d0c1b2e..ea1318686b 100644 --- a/addons/realisticnames/config.cpp +++ b/addons/realisticnames/config.cpp @@ -292,8 +292,8 @@ class CfgVehicles { displayName = "$STR_ACE_RealisticNames_Heli_Attack_01_Name"; }; - class Heli_Light_01_base_F; - class B_Heli_Light_01_F: Heli_Light_01_base_F { + class Heli_Light_01_unarmed_base_F; + class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F { displayName = "$STR_ACE_RealisticNames_Heli_Light_01_Name"; }; @@ -302,7 +302,7 @@ class CfgVehicles { displayName = "$STR_ACE_RealisticNames_Heli_Light_01_armed_Name"; }; - class Heli_Light_01_civil_base_F: Heli_Light_01_base_F { + class Heli_Light_01_civil_base_F: Heli_Light_01_unarmed_base_F { displayName = "$STR_ACE_RealisticNames_Heli_Light_01_civil_Name"; }; diff --git a/addons/recoil/XEH_preInit.sqf b/addons/recoil/XEH_preInit.sqf index 4d2bf8c538..2df8a83ebd 100644 --- a/addons/recoil/XEH_preInit.sqf +++ b/addons/recoil/XEH_preInit.sqf @@ -1,4 +1,8 @@ #include "script_component.hpp" +ADDON = false; + PREP(burstDispersion); PREP(camShake); + +ADDON = true; diff --git a/addons/reload/XEH_preInit.sqf b/addons/reload/XEH_preInit.sqf index 9a7373b2dc..b5c8e45d35 100644 --- a/addons/reload/XEH_preInit.sqf +++ b/addons/reload/XEH_preInit.sqf @@ -1,3 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(checkAmmo); + +ADDON = true; diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index bdf4576eb3..cbf35b0baf 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -78,13 +78,18 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = QUOTE(side group _player == west); - statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + selection = ""; + class ACE_Teleport { + displayName = "Teleport to Rallypoint"; + distance = 4; + condition = QUOTE(side group _player == west); + statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -98,13 +103,18 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = QUOTE(side group _player == east); - statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + selection = ""; + class ACE_Teleport { + displayName = "Teleport to Rallypoint"; + distance = 4; + condition = QUOTE(side group _player == east); + statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -118,13 +128,18 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = QUOTE(side group _player == independent); - statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + selection = ""; + class ACE_Teleport { + displayName = "Teleport to Rallypoint"; + distance = 4; + condition = QUOTE(side group _player == independent); + statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -139,13 +154,17 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = QUOTE(side group _player == west); - statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + class ACE_Teleport { + displayName = "Teleport to Base"; + distance = 4; + condition = QUOTE(side group _player == west); + statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -159,13 +178,17 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = QUOTE(side group _player == east); - statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + class ACE_Teleport { + displayName = "Teleport to Base"; + distance = 4; + condition = QUOTE(side group _player == east); + statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -179,13 +202,17 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = QUOTE(side group _player == independent); - statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + class ACE_Teleport { + displayName = "Teleport to Base"; + distance = 4; + condition = QUOTE(side group _player == independent); + statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; diff --git a/addons/respawn/XEH_preInit.sqf b/addons/respawn/XEH_preInit.sqf index 831aeaa423..f57e1f3714 100644 --- a/addons/respawn/XEH_preInit.sqf +++ b/addons/respawn/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(canMoveRallypoint); PREP(handleKilled); PREP(handleRespawn); @@ -13,3 +15,5 @@ PREP(removeDisconnectedPlayer); PREP(restoreGear); PREP(showFriendlyFireMessage); PREP(teleportToRallypoint); + +ADDON = true; diff --git a/addons/respawn/config.cpp b/addons/respawn/config.cpp index 0d914df949..19032df4f7 100644 --- a/addons/respawn/config.cpp +++ b/addons/respawn/config.cpp @@ -17,7 +17,13 @@ class CfgPatches { #include "CfgVehicleClasses.hpp" #include "CfgVehicles.hpp" -class ACE_Parameters_Boolean { - GVAR(SavePreDeathGear) = 0; - GVAR(RemoveDeadBodiesDisconnected) = 1; +class ACE_Settings { + class GVAR(SavePreDeathGear) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(RemoveDeadBodiesDisconnected) { + value = 1; + typeName = "BOOL"; + }; }; diff --git a/addons/respawn/functions/fnc_module.sqf b/addons/respawn/functions/fnc_module.sqf index 0a996d0acc..5ba52fd40e 100644 --- a/addons/respawn/functions/fnc_module.sqf +++ b/addons/respawn/functions/fnc_module.sqf @@ -1,17 +1,17 @@ /* Name: ACE_Respawn_fnc_module - + Author(s): KoffeinFlummi, bux578, CAA-Picard, commy2 - + Description: initializes the respawn module - + Parameters: 0: OBJECT - logic 1: ARRAY - synced units 2: BOOLEAN - activated - + Returns: VOID */ @@ -27,8 +27,8 @@ if !(_activated) exitWith {}; GVAR(Module) = true; -[_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readBooleanParameterFromModule); +[_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readSettingFromModule); if (isServer) then { if (GVAR(RemoveDeadBodiesDisconnected)) then { diff --git a/addons/resting/CfgSounds.hpp b/addons/resting/CfgSounds.hpp new file mode 100644 index 0000000000..b55d4d9ae8 --- /dev/null +++ b/addons/resting/CfgSounds.hpp @@ -0,0 +1,14 @@ +class CfgSounds { + class GVAR(rest) + { + name=QGVAR(rest); + sound[]={QUOTE(PATHTOF(sounds\weaponrest_rest.wav)),1,1}; + titles[]={}; + }; + class GVAR(unrest) + { + name=QGVAR(unrest); + sound[]={QUOTE(PATHTOF(sounds\weaponrest_unrest.wav)),1,1}; + titles[]={}; + }; +}; \ No newline at end of file diff --git a/addons/resting/XEH_preInit.sqf b/addons/resting/XEH_preInit.sqf index 5a91cc7868..6a2a2040b7 100644 --- a/addons/resting/XEH_preInit.sqf +++ b/addons/resting/XEH_preInit.sqf @@ -1,7 +1,11 @@ #include "script_component.hpp" +ADDON = false; + PREP(getIntersection); PREP(hasBipod); PREP(pfhCheckRest); PREP(restWeapon); PREP(unRestWeapon); + +ADDON = true; diff --git a/addons/resting/config.cpp b/addons/resting/config.cpp index ac710c82a8..599c15d318 100644 --- a/addons/resting/config.cpp +++ b/addons/resting/config.cpp @@ -17,3 +17,5 @@ class CfgPatches { #include "CfgWeapons.hpp" #include "CfgMoves.hpp" + +#include "CfgSounds.hpp" \ No newline at end of file diff --git a/addons/resting/data/icons/icon_bipod.paa b/addons/resting/data/icons/icon_bipod.paa new file mode 100644 index 0000000000..c2b6a2fb3e Binary files /dev/null and b/addons/resting/data/icons/icon_bipod.paa differ diff --git a/addons/resting/functions/fnc_restWeapon.sqf b/addons/resting/functions/fnc_restWeapon.sqf index e22a1309f3..793ef4fff3 100644 --- a/addons/resting/functions/fnc_restWeapon.sqf +++ b/addons/resting/functions/fnc_restWeapon.sqf @@ -27,12 +27,16 @@ _intersects = _this call FUNC(getIntersection); if (true in _intersects) then { _unit setVariable ["ACE_weaponRested", true]; + if (_unit == ACE_PLAYER) then { + [QGVAR(bipodDeployed), true, QUOTE(PATHTOF(data\icons\icon_bipod.paa)), [1,1,1,1], -1] call EFUNC(common,displayIcon); + }; private "_restedPosition"; _restedPosition = getPosASL _unit; // REST THE WEAPON addCamShake CAMSHAKE; + playSound QGVAR(rest); if ([_weapon] call FUNC(hasBipod) && {_intersects select 3}) then { _unit setVariable ["ACE_bipodDeployed", true]; diff --git a/addons/resting/functions/fnc_unRestWeapon.sqf b/addons/resting/functions/fnc_unRestWeapon.sqf index b182cd89e8..2cf885676f 100644 --- a/addons/resting/functions/fnc_unRestWeapon.sqf +++ b/addons/resting/functions/fnc_unRestWeapon.sqf @@ -43,6 +43,11 @@ if (_unit getVariable ["ACE_bipodDeployed", false]) then { _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); [localize "STR_ACE_Resting_WeaponLifted", _picture] call EFUNC(common,displayTextPicture); }; +playSound QGVAR(unrest); _unit setVariable ["ACE_weaponRested", false]; _unit setVariable ["ACE_bipodDeployed", false]; + +if (_unit == ACE_PLAYER) then { + [QGVAR(bipodDeployed), false, "", [1,1,1,1], -1] call EFUNC(common,displayIcon); +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_rest.wav b/addons/resting/sounds/weaponrest_rest.wav similarity index 100% rename from TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_rest.wav rename to addons/resting/sounds/weaponrest_rest.wav diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_unrest.wav b/addons/resting/sounds/weaponrest_unrest.wav similarity index 100% rename from TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_unrest.wav rename to addons/resting/sounds/weaponrest_unrest.wav diff --git a/addons/safemode/XEH_preInit.sqf b/addons/safemode/XEH_preInit.sqf index bc80c4269d..6bedb35134 100644 --- a/addons/safemode/XEH_preInit.sqf +++ b/addons/safemode/XEH_preInit.sqf @@ -1,7 +1,11 @@ #include "script_component.hpp" +ADDON = false; + PREP(firstMode); PREP(lockSafety); PREP(playChangeFiremodeSound); PREP(setSafeModeVisual); PREP(unlockSafety); + +ADDON = true; diff --git a/addons/scopes/CfgEventHandlers.hpp b/addons/scopes/CfgEventHandlers.hpp index 204f2e267e..b3d70a2861 100644 --- a/addons/scopes/CfgEventHandlers.hpp +++ b/addons/scopes/CfgEventHandlers.hpp @@ -13,39 +13,7 @@ class Extended_PostInit_EventHandlers { class Extended_Fired_EventHandlers { class CAManBase { class ADDON { - clientFired = QUOTE(if (_this select 0 == ACE_player) then { _this call FUNC(firedEH);};); - }; - }; -}; - -class Extended_Take_EventHandlers { - class CAManBase { - class ADDON { - clientTake = QUOTE(if (_this select 0 == ACE_player) then{ _this call FUNC(inventoryCheck);};); - }; - }; -}; - -class Extended_Put_EventHandlers { - class CAManBase { - class ADDON { - clientPut = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(inventoryCheck);};); - }; - }; -}; - -class Extended_InitPost_EventHandlers { - class CAManBase { - class ADDON { - init = QUOTE(if (_this select 0 == call EFUNC(common,player)) then{ _this call FUNC(inventoryCheck);};); - }; - }; -}; - -class Extended_Respawn_EventHandlers { - class CAManBase { - class ADDON { - respawn = QUOTE(if (_this select 0 == call EFUNC(common,player)) then{ _this call FUNC(inventoryCheck);};); + fired = QUOTE(_this call FUNC(firedEH);); }; }; }; diff --git a/addons/scopes/RscTitles.hpp b/addons/scopes/RscTitles.hpp index 79de7e8214..a9c43aedaf 100644 --- a/addons/scopes/RscTitles.hpp +++ b/addons/scopes/RscTitles.hpp @@ -4,7 +4,7 @@ class RscTitles { movingEnable = 0; enableSimulation = 1; enableDisplay = 1; - onLoad = QUOTE(_this spawn compile preprocessFileLineNumbers QUOTE(QUOTE(PATHTOF(scripts\zeroingOnLoad.sqf))); uiNamespace setVariable [ARR_2('ACE_Scopes_Debug', _this)];); + onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(ZeroingDisplay)),_this select 0)];); duration = 1e+011; fadein = 0; fadeout = 0; @@ -13,7 +13,7 @@ class RscTitles { class RscText; class controls { class ACE_Scopes_Zeroing_BG : RscPicture { - idc = 925001; + idc = 11; type = 0; text = PATHTOF(UI\scopes_bg.paa); style = 48 + 0x800; @@ -30,7 +30,7 @@ class RscTitles { h = 0.3 * safezoneH; }; class ACE_Scopes_Zeroing_Vertical : RscText { - idc = 925002; + idc = 12; type = 0; style = 2; sizeEx = 0.04; @@ -47,7 +47,7 @@ class RscTitles { h = 0.025 * safezoneH; }; class ACE_Scopes_Zeroing_Horizontal : RscText { - idc = 925003; + idc = 13; type = 0; style = 0; sizeEx = 0.04; diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index b7fd4bfc3a..8de7ff8af0 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -9,32 +9,27 @@ if !(hasInterface) exitWith {}; -// show overlay after changing weapon/optic -0 spawn { - _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; - while {True} do { - waitUntil {[ACE_player, 0,0] call FUNC(canAdjustScope)}; - _layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false]; - sleep 3; - _layer cutFadeOut 2; +// Check inventory when it changes +["playerInventoryChanged", { + [ACE_player] call FUNC(inventoryCheck); +}] call EFUNC(common,addEventhandler); - _weapon = currentWeapon ACE_player; - _optics = [ACE_player] call FUNC(getOptics); - waitUntil {sleep 0.05; !(_optics isEqualTo ([ACE_player] call FUNC(getOptics))) or (currentWeapon ACE_player != _weapon)}; - }; -}; -// instantly hide when scoping in -0 spawn { - _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; - while {True} do { - waitUntil {sleep 0.05; cameraView == "GUNNER"}; - if !(isNull GVAR(fadeScript)) then { - terminate GVAR(fadeScript); - }; +// Instantly hide knobs when scoping in +["cameraViewChanged", { + EXPLODE_2_PVT(_this,_player,_newCameraView); + if (_newCameraView == "GUNNER") then { + private "_layer"; + _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; _layer cutText ["", "PLAIN", 0]; + + + if !(isNil QGVAR(fadePFH)) then { + [GVAR(fadePFH)] call cba_fnc_removePerFrameHandler; + GVAR(fadePFH) = nil; + }; }; -}; +}] call EFUNC(common,addEventhandler); // Add keybinds diff --git a/addons/scopes/XEH_preInit.sqf b/addons/scopes/XEH_preInit.sqf index cc83dd6332..e574cc72d4 100644 --- a/addons/scopes/XEH_preInit.sqf +++ b/addons/scopes/XEH_preInit.sqf @@ -1,10 +1,14 @@ #include "script_component.hpp" +ADDON = false; + PREP(adjustScope); PREP(canAdjustScope); PREP(firedEH); PREP(getOptics); -PREP(hideZeroing); PREP(inventoryCheck); +PREP(showZeroing); GVAR(fadeScript) = scriptNull; + +ADDON = true; diff --git a/addons/scopes/config.cpp b/addons/scopes/config.cpp index 9d2ddbeacb..50ff6528d0 100644 --- a/addons/scopes/config.cpp +++ b/addons/scopes/config.cpp @@ -5,8 +5,8 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { "ace_main", "ace_common" }; - author[] = {"KoffeinFlummi"}; + requiredAddons[] = { "ace_common" }; + author[] = {"KoffeinFlummi", "CAA-Picard"}; authorUrl = "https://github.com/KoffeinFlummi"; VERSION_CONFIG; }; diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index 7db640590a..6e71a391aa 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -1,42 +1,44 @@ /* * Author: KoffeinFlummi - * * Changes the adjustment for the current scope * - * Arguments: - * 0: Horizontal adjustment - * 1: Vertical adjustment + * Argument: + * 0: Unit + * 1: Horizontal adjustment + * 2: Vertical adjustment * - * Return Value: - * True + * Return value: + * True + * + * Public: No */ - #include "script_component.hpp" - + private ["_unit", "_weapons", "_zeroing", "_pitchbankyaw", "_pitch", "_bank", "_yaw", "_hint"]; _unit = _this select 0; -_weapons = [ - primaryWeapon _unit, - secondaryWeapon _unit, - handgunWeapon _unit -]; +_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); -if (isNil QGVAR(Adjustment)) then { - GVAR(Adjustment) = [[0,0], [0,0], [0,0]]; +_adjustment = _unit getVariable QGVAR(Adjustment); +if (isNil "_adjustment") then { + _adjustment = [[0,0], [0,0], [0,0]]; + _unit setVariable [QGVAR(Adjustment), _adjustment]; }; -_zeroing = GVAR(Adjustment) select (_weapons find (currentWeapon _unit)); +_zeroing = _adjustment select _weaponIndex; _zeroing set [0, (round (((_zeroing select 0) + (_this select 1)) * 10)) / 10]; _zeroing set [1, (round (((_zeroing select 1) + (_this select 2)) * 10)) / 10]; -GVAR(Adjustment) set [_weapons find (currentWeapon _unit), _zeroing]; +// Change the adjustment array +_adjustment set [_weaponIndex, _zeroing]; +[_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3); // slightly rotate the player if looking through optic if (cameraView == "GUNNER") then { + _pitchbankyaw = [_unit] call EFUNC(common,getPitchBankYaw); // these are not exact mil-to-degree conversions, but instead chosen // to minimize the effect of rounding errors @@ -44,26 +46,11 @@ if (cameraView == "GUNNER") then { _bank = _pitchbankyaw select 1; _yaw = (_pitchbankyaw select 2) + ((_this select 1) * -0.04); [_unit, _pitch, _bank, _yaw] call EFUNC(common,setPitchBankYaw) -}; -_display = uiNamespace getVariable [QGVAR(ZeroingDisplay), displayNull]; -if !(isNull _display) then { - _vertical = _display displayCtrl 925002; - _horizontal = _display displayCtrl 925003; - _vertical ctrlSetText (str (_zeroing select 1)); - _horizontal ctrlSetText (str (_zeroing select 0)); -}; +} else { + + [] call FUNC(showZeroing); -if (!isNull (missionNamespace getVariable [QGVAR(fadeScript), scriptNull])) then { - terminate GVAR(fadeScript); -}; -if (cameraView != "GUNNER") then { - GVAR(fadeScript) = 0 spawn { - _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; - _layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false]; - sleep 3; - _layer cutFadeOut 2; - }; }; true diff --git a/addons/scopes/functions/fnc_canAdjustScope.sqf b/addons/scopes/functions/fnc_canAdjustScope.sqf index 8aea2ff9e4..eda08dc0ee 100644 --- a/addons/scopes/functions/fnc_canAdjustScope.sqf +++ b/addons/scopes/functions/fnc_canAdjustScope.sqf @@ -1,43 +1,40 @@ /* * Author: KoffeinFlummi - * * Checks if a player can adjust his optic in the given way. * - * Arguments: - * 0: Horizontal adjustment - * 1: Vertical adjustment + * Argument: + * 0: Unit + * 1: Horizontal adjustment + * 2: Vertical adjustment * - * Return Value: - * Can adjustment be done? (Bool) + * Return value: + * Can adjustment be done? + * + * Public: No */ - #include "script_component.hpp" -private ["_unit", "_weapons", "_zeroing", "_optic", "_maxHorizontal", "_maxVertical"]; +private ["_unit", "_weaponIndex", "_zeroing", "_optic", "_maxHorizontal", "_maxVertical"]; _unit = _this select 0; -_weapons = [ - primaryWeapon _unit, - secondaryWeapon _unit, - handgunWeapon _unit -]; +_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); +if (_weaponIndex < 0) exitWith {false}; -if !(currentWeapon _unit in _weapons) exitWith {false}; - -if (isNil QGVAR(Adjustment)) then { - GVAR(Adjustment) = [[0,0], [0,0], [0,0]]; +_adjustment = _unit getVariable QGVAR(Adjustment); +if (isNil "_adjustment") then { + _adjustment = [[0,0], [0,0], [0,0]]; }; if (isNil QGVAR(Optics)) then { GVAR(Optics) = ["", "", ""]; }; -_zeroing = GVAR(Adjustment) select (_weapons find (currentWeapon _unit)); +_zeroing = _adjustment select _weaponIndex; _zeroX = (_zeroing select 0) + (_this select 1); _zeroY = (_zeroing select 1) + (_this select 2); -_optic = GVAR(Optics) select (_weapons find (currentWeapon _unit)); +_optic = GVAR(Optics) select _weaponIndex; _maxHorizontal = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Horizontal"); _maxVertical = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Vertical"); if ((count _maxHorizontal < 2) or (count _maxVertical < 2)) exitWith {false}; diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 4414f617d6..371d1e5f33 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -1,35 +1,42 @@ /* - * Author: KoffeinFlummi - * + * Author: KoffeinFlummi and CAA-Picard * Adjusts the flight path of the bullet according to the zeroing * - * Arguments: - * Fired EH + * Argument: + * 0: Unit + * 1: Weapon + * 3: Muzzle + * 4: Magazine + * 5: Ammo + * 6: Projectile * - * Return Value: + * Return value: * None + * + * Public: No */ - #include "script_component.hpp" -private ["_unit", "_weaponType", "_ammoType", "_magazineType", "_round", "_weapons", "_zeroing", "_direction", "_azimuth", "_altitude", "_velocity"]; +private ["_unit", "_adjustment", "_weapon", "_projectile", "_weaponIndex", "_zeroing", "_adjustment"]; _unit = _this select 0; -_weaponType = _this select 1; -_ammoType = _this select 4; -_round = _this select 5; -_magazineType = _this select 6; -_weapons = [ - primaryWeapon _unit, - secondaryWeapon _unit, - handgunWeapon _unit -]; -if !(_weaponType in _weapons) exitWith {}; +// Exit if the unit doesn't have any adjusment variable +_adjustment = _unit getVariable QGVAR(Adjustment); +if (isNil "_adjustment") exitWith {}; -_zeroing = GVAR(Adjustment) select (_weapons find _weaponType); +// Exit if the unit isn't a player +if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; -// convert zeroing from mils to degrees +_weapon = _this select 1; +_projectile = _this select 5; + +_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); +if (_weaponIndex < 0) exitWith {}; + +_zeroing = _adjustment select _weaponIndex; + +// Convert zeroing from mils to degrees _zeroing = [_zeroing, {_this * 0.05625}] call EFUNC(common,map); -[_round, _zeroing select 0, _zeroing select 1, 0] call EFUNC(common,changeProjectileDirection); +[_projectile, _zeroing select 0, _zeroing select 1, 0] call EFUNC(common,changeProjectileDirection); diff --git a/addons/scopes/functions/fnc_getOptics.sqf b/addons/scopes/functions/fnc_getOptics.sqf index 7ff2c7ea1d..289ed5e7bd 100644 --- a/addons/scopes/functions/fnc_getOptics.sqf +++ b/addons/scopes/functions/fnc_getOptics.sqf @@ -1,21 +1,22 @@ /* * Author: commy2 - * * Gets the optic classnames of all currently equipped weapons. * * Arguments: - * 0: Unit (Object) + * 0: Unit * * Return Value: - * [optic of primary, optic of secondary, optic of handgun] (Array) + * 0: Optic of primary + * 1: Optic of secondary + * 2: Optic of handgun + * + * Public: No */ - #include "script_component.hpp" -private ["_unit", "_array"]; - -_unit = _this select 0; +EXPLODE_1_PVT(_this,_unit); +private ["_array"]; _array = ["", "", ""]; if !(_unit isKindOf "CAManBase") exitWith {_array}; diff --git a/addons/scopes/functions/fnc_hideZeroing.sqf b/addons/scopes/functions/fnc_hideZeroing.sqf deleted file mode 100644 index b41fd1dab6..0000000000 --- a/addons/scopes/functions/fnc_hideZeroing.sqf +++ /dev/null @@ -1,27 +0,0 @@ -// by commy2 - -#include "script_component.hpp" - -private ["_state", "_ctrl"]; - -_state = _this select 0; - -disableSerialization; -_ctrl = (uiNamespace getVariable ['ACE_dlgWeaponZeroing', displayNull]) displayCtrl 168; - -if (_state) then { - _ctrl ctrlSetPosition [0,0,0,0]; -} else { - private "_config"; - - _config = configFile >> "RscInGameUI" >> "RscWeaponZeroing" >> "CA_Zeroing"; - - _ctrl ctrlSetPosition [ - getNumber (_config >> "x"), - getNumber (_config >> "y"), - getNumber (_config >> "w"), - getNumber (_config >> "h") - ]; -}; - -_ctrl ctrlCommit 0; diff --git a/addons/scopes/functions/fnc_inventoryCheck.sqf b/addons/scopes/functions/fnc_inventoryCheck.sqf index 23971098d6..c83112c8a6 100644 --- a/addons/scopes/functions/fnc_inventoryCheck.sqf +++ b/addons/scopes/functions/fnc_inventoryCheck.sqf @@ -1,23 +1,42 @@ -// by KoffeinFlummi / commy2 - +/* + * Author: KoffeinFlummi and Commy2 + * Check if weapon optics changed and reset zeroing if needed + * + * Arguments: + * 0: Player + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private "_new"; +EXPLODE_1_PVT(_this,_player); -_new = _this call FUNC(getOptics); +private ["_newOptics", "_adjustment"]; + +_adjustment = ACE_player getVariable QGVAR(Adjustment); +if (isNil "_adjustment") then { + _adjustment = [[0,0], [0,0], [0,0]]; + ACE_player setVariable [QGVAR(Adjustment), _adjustment]; + [ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); +}; if (isNil QGVAR(Optics)) then { GVAR(Optics) = ["", "", ""]; }; - -if (isNil QGVAR(Adjustment)) then { - GVAR(Adjustment) = [[0,0], [0,0], [0,0]]; -}; +_newOptics = [_player] call FUNC(getOptics); { - if (_new select _forEachIndex != _x) then { - GVAR(Adjustment) set [_forEachIndex, [0,0]]; + if (_newOptics select _forEachIndex != _x) then { + // The optic for this weapon changed, set adjustment to zero + if !((_adjustment select _foreachindex) isEqualTo [0,0]) then { + _adjustment set [_forEachIndex, [0,0]]; + [ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); + }; }; } forEach GVAR(Optics); -GVAR(Optics) = _new; +_adjustment = ACE_player getVariable QGVAR(Adjustment); +GVAR(Optics) = _newOptics; diff --git a/addons/scopes/functions/fnc_showZeroing.sqf b/addons/scopes/functions/fnc_showZeroing.sqf new file mode 100644 index 0000000000..836f69b2df --- /dev/null +++ b/addons/scopes/functions/fnc_showZeroing.sqf @@ -0,0 +1,59 @@ +/* + * Author: KoffeinFlummi and CAA-Picard + * Display the adjustment knobs, update their value and fade them out later + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; + +private ["_weaponIndex","_adjustment","_layer","_display","_zeroing","_vertical","_horizontal"]; + +_weaponIndex = [ACE_player, currentWeapon ACE_player] call EFUNC(common,getWeaponIndex); +if (_weaponIndex < 0) exitWith {}; + +_adjustment = ACE_player getVariable QGVAR(Adjustment); +if (isNil "_adjustment") then { + _adjustment = [[0,0], [0,0], [0,0]]; +}; + +// Display the adjustment knobs +_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; +_layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false]; + +// Find the display +_display = uiNamespace getVariable [QGVAR(ZeroingDisplay), displayNull]; +if (isNull _display) exitWith {}; + +// Update values +_zeroing = _adjustment select _weaponIndex; +_vertical = _display displayCtrl 12; +_horizontal = _display displayCtrl 13; +_vertical ctrlSetText (str (_zeroing select 1)); +_horizontal ctrlSetText (str (_zeroing select 0)); + +// Set the time when to hide the knobs +GVAR(timeToHide) = diag_tickTime + 3.0; + +if !(isNil QGVAR(fadePFH)) exitWith {}; + +// Launch a PFH to wait and fade out the knobs +GVAR(fadePFH) = [{ + + if (diag_tickTime >= GVAR(timeToHide)) exitWith { + private "_layer"; + _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; + _layer cutFadeOut 2; + + GVAR(fadePFH) = nil; + [_this select 1] call cba_fnc_removePerFrameHandler; + }; + +}, 0.1, []] call CBA_fnc_addPerFrameHandler diff --git a/addons/scopes/scripts/script_component.hpp b/addons/scopes/scripts/script_component.hpp deleted file mode 100644 index acca51b4b5..0000000000 --- a/addons/scopes/scripts/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\scopes\script_component.hpp" diff --git a/addons/scopes/scripts/zeroingOnLoad.sqf b/addons/scopes/scripts/zeroingOnLoad.sqf deleted file mode 100644 index 591b5fc07b..0000000000 --- a/addons/scopes/scripts/zeroingOnLoad.sqf +++ /dev/null @@ -1,20 +0,0 @@ -#include "script_component.hpp" - -disableSerialization; - -_display = _this select 0; -uiNamespace setVariable [QGVAR(ZeroingDisplay, _display]; -_vertical = _display displayCtrl 925002; -_horizontal = _display displayCtrl 925003; - -_weapons = [ - primaryWeapon player, - secondaryWeapon player, - handgunWeapon player -]; - -if ((currentWeapon ACE_player) in _weapons) then { - _zeroing = GVAR(Adjustment) select (_weapons find (currentWeapon ACE_player)); - _horizontal ctrlSetText (str (_zeroing select 0)); - _vertical ctrlSetText (str (_zeroing select 1)); -}; diff --git a/addons/switchunits/CfgEventHandlers.hpp b/addons/switchunits/CfgEventHandlers.hpp index 47dcd984d1..38f9883743 100644 --- a/addons/switchunits/CfgEventHandlers.hpp +++ b/addons/switchunits/CfgEventHandlers.hpp @@ -5,7 +5,7 @@ class Extended_PreInit_EventHandlers { }; class Extended_PostInit_EventHandlers { - class ADDON { - postInit = QUOTE(call COMPILE_FILE(XEH_postInit) ); - }; + class ADDON { + clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); + }; }; diff --git a/addons/switchunits/XEH_clientInit.sqf b/addons/switchunits/XEH_clientInit.sqf new file mode 100644 index 0000000000..3075d67941 --- /dev/null +++ b/addons/switchunits/XEH_clientInit.sqf @@ -0,0 +1,39 @@ +/* + * Author: bux578 + * Initializes the SwitchUnits pbo. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +DFUNC(pfhClientInit) = { + + if (GVAR(EnableSwitchUnits)) exitWith { + + private ["_sides"]; + _sides = []; + + if(GVAR(SwitchToWest)) then {_sides pushBack west;}; + if(GVAR(SwitchToEast)) then {_sides pushBack east;}; + if(GVAR(SwitchToIndependent)) then {_sides pushBack independent;}; + if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian;}; + + if (player getVariable ["ACE_CanSwitchUnits", false]) then { + [player, _sides] call FUNC(initPlayer); + }; + + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; +}; + +[FUNC(pfhClientInit), 0.5, []] call cba_fnc_addPerFrameHandler; diff --git a/addons/switchunits/XEH_postInit.sqf b/addons/switchunits/XEH_postInit.sqf deleted file mode 100644 index 3ce84ef838..0000000000 --- a/addons/switchunits/XEH_postInit.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/* - Author(s): - bux578 -*/ - -#include "script_component.hpp" - -//0 spawn { - -private ["_sides"]; - -//waitUntil {sleep 0.5; AGM_SwitchUnits_EnableSwitchUnits}; - -//_side = [west, east, independent, civilian] select AGM_SwitchUnits_SwitchUnitsAllowedForSide; - -_sides = []; - -if(GVAR(SwitchToWest)) then {_sides pushBack west}; -if(GVAR(SwitchToEast)) then {_sides pushBack east}; -if(GVAR(SwitchToIndependent)) then {_sides pushBack independent}; -if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian}; - -if (player getVariable ["ACE_CanSwitchUnits", false]) then { -[player, _sides] call FUNC(initPlayer); -}; - -//}; diff --git a/addons/switchunits/config.cpp b/addons/switchunits/config.cpp index b89adb3a7a..09d3e05594 100644 --- a/addons/switchunits/config.cpp +++ b/addons/switchunits/config.cpp @@ -15,15 +15,33 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -class ACE_Parameters_Numeric { - GVAR(SafeZoneRadius) = 100; -}; - -class ACE_Parameters_Boolean { - GVAR(EnableSwitchUnits) = 0; - GVAR(SwitchToWest) = 0; - GVAR(SwitchToEast) = 0; - GVAR(SwitchToIndependent) = 0; - GVAR(SwitchToCivilian) = 0; - GVAR(EnableSafeZone) = 1; +class ACE_Settings { + class GVAR(SafeZoneRadius) { + value = 100; + typeName = "SCALAR"; + }; + class GVAR(EnableSwitchUnits) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(SwitchToWest) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(SwitchToEast) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(SwitchToIndependent) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(SwitchToCivilian) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(EnableSafeZone) { + value = 1; + typeName = "BOOL"; + }; }; diff --git a/addons/switchunits/functions/fnc_addMapFunction.sqf b/addons/switchunits/functions/fnc_addMapFunction.sqf index 1c4e158d80..62a7c42a22 100644 --- a/addons/switchunits/functions/fnc_addMapFunction.sqf +++ b/addons/switchunits/functions/fnc_addMapFunction.sqf @@ -1,19 +1,19 @@ /* - Name: ACE_SwitchUnits_fnc_addMapFunction - - Author(s): - bux578 - - Description: - Adds a mapClick Eventhandler - - Parameters: - 0: OBJECT - unit - 1: ARRAY - sides - - Returns: - VOID -*/ + * Author: bux578 + * Adds a mapClick Eventhandler + * + * Arguments: + * 0: unit + * 1: sides > + * + * Return Value: + * None + * + * Example: + * [_unit, _sides] call FUNC(addMapFunction) + * + * Public: No + */ #include "script_component.hpp" diff --git a/addons/switchunits/functions/fnc_handleMapClick.sqf b/addons/switchunits/functions/fnc_handleMapClick.sqf index bce28963da..3033071984 100644 --- a/addons/switchunits/functions/fnc_handleMapClick.sqf +++ b/addons/switchunits/functions/fnc_handleMapClick.sqf @@ -1,45 +1,41 @@ /* - Name: ACE_SwitchUnits_fnc_handleMapClick - - Author(s): - bux578 - - Description: - Finds the clicked unit - - Parameters: - 0: OBJECT - MapClickEventHandlerArgs - 0: OBJECT - unit // useless - 1: ARRAY - sides - - Returns: - VOID -*/ + * Author: bux578 + * Switches to a unit close to a clicked map position + * + * Arguments: + * 0: unit + * 1: sides > + * + * Return Value: + * None + * + * Example: + * [_unit, _sides] call FUNC(handleMapClick) + * + * Public: No + */ #include "script_component.hpp" private ["_sides", "_pos", "_sideNearest"]; -// that's wrong -//_currentPlayerUnit = (_this select 0) select 0; - _sides = (_this select 0) select 1; _pos = _this select 1; _sideNearest = []; { - if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then { - _sideNearest pushBack _x; - }; + if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then { + _sideNearest pushBack _x; + }; } forEach (nearestObjects [_pos, ["Man"], 20]); if (count _sideNearest > 0) then { - private ["_switchUnit"]; - - _switchUnit = _sideNearest select 0; - [ACE_player, _switchUnit] call FUNC(switchUnit); - - openMap false; + private ["_switchUnit"]; + + _switchUnit = _sideNearest select 0; + [ACE_player, _switchUnit] call FUNC(switchUnit); + + openMap false; }; diff --git a/addons/switchunits/functions/fnc_initPlayer.sqf b/addons/switchunits/functions/fnc_initPlayer.sqf index 81e4fc259f..9c71f8cefc 100644 --- a/addons/switchunits/functions/fnc_initPlayer.sqf +++ b/addons/switchunits/functions/fnc_initPlayer.sqf @@ -1,19 +1,19 @@ /* - Name: ACE_SwitchUnits_fnc_initPlayer - - Author(s): - bux578 - - Description: - Initializes the player - - Parameters: - 0: OBJECT - player - 1: ARRAY - Array containing selected sides - - Returns: - VOID -*/ + * Author: bux578 + * Initializes the player + * + * Arguments: + * 0: player + * 1: sides > + * + * Return Value: + * None + * + * Example: + * [_player, _sides] call FUNC(initPlayer) + * + * Public: No + */ #include "script_component.hpp" @@ -24,27 +24,28 @@ _sides = _this select 1; if (vehicle _playerUnit == _playerUnit) then { - [_sides] call FUNC(markAiOnMap); + [_sides] call FUNC(markAiOnMap); - _playerUnit setVariable [QGVAR(IsPlayerUnit), true]; - _playerUnit allowDamage false; + _playerUnit setVariable [QGVAR(IsPlayerUnit), true]; + _playerUnit allowDamage false; - GVAR(OriginalUnit) = _playerUnit; - GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); - GVAR(OriginalGroup) = group _playerUnit; + GVAR(OriginalUnit) = _playerUnit; + //GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); + GVAR(OriginalName) = name _playerUnit; + GVAR(OriginalGroup) = group _playerUnit; - // remove all starting gear of a player - removeAllWeapons _playerUnit; - removeGoggles _playerUnit; - removeHeadgear _playerUnit; - removeVest _playerUnit; - removeAllAssignedItems _playerUnit; - clearAllItemsFromBackpack _playerUnit; - removeBackpack _playerUnit; - _playerUnit linkItem "ItemMap"; - removeUniform _playerUnit; + // remove all starting gear of a player + removeAllWeapons _playerUnit; + removeGoggles _playerUnit; + removeHeadgear _playerUnit; + removeVest _playerUnit; + removeAllAssignedItems _playerUnit; + clearAllItemsFromBackpack _playerUnit; + removeBackpack _playerUnit; + _playerUnit linkItem "ItemMap"; + removeUniform _playerUnit; - [_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus); + [_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus); - [_playerUnit, _sides] call FUNC(addMapFunction); + [_playerUnit, _sides] call FUNC(addMapFunction); }; diff --git a/addons/switchunits/functions/fnc_isValidAi.sqf b/addons/switchunits/functions/fnc_isValidAi.sqf index 5beb59d430..61c2401da9 100644 --- a/addons/switchunits/functions/fnc_isValidAi.sqf +++ b/addons/switchunits/functions/fnc_isValidAi.sqf @@ -1,22 +1,22 @@ /* - Name: ACE_SwitchUnits_fnc_isValidAi - - Author(s): - bux578 - - Description: - Checks if AI is a valid target for switching - - Parameters: - 0: OBJECT - unit - - Returns: - VOID -*/ + * Author: bux578 + * Checks if AI is a valid target for switching. + * + * Arguments: + * 0: unit + * + * Return Value: + * Boolean + * + * Example: + * [_unit] call FUNC(isValidAi) + * + * Public: Yes + */ #include "script_component.hpp" -private ["_unit"]; +private "_unit"; _unit = _this select 0; diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index e54673c1a5..ed94c31b0b 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -1,69 +1,71 @@ /* - Name: ACE_SwitchUnits_fnc_markAiOnMap - - Author(s): - bux578 - - Description: - Creates markers for AI units for given sides - Marks players in a different color - - Parameters: - 0: OBJECT - side - - Returns: - VOID -*/ + * Author: bux578 + * Creates markers for AI units for given sides. + * Marks players in a different colour. + * + * Arguments: + * 0: side + * + * Return Value: + * None + * + * Example: + * [[west, east]] call FUNC(markAiOnMap) + * + * Public: No + */ #include "script_component.hpp" -private ["_sidesToShow"]; +private "_sidesToShow"; _sidesToShow = _this select 0; -_sidesToShow spawn { +GVAR(AllMarkerNames) = []; - private ["_sides", "_allMarkerNames"]; - _sides = _this; - _allMarkerNames = []; +DFUNC(pfhMarkAiOnMap) = { + private ["_args", "_sides"]; + _args = _this select 0; + _sides = _args select 0; - while { true } do { - sleep 1.5; + + // delete markers + { + deleteMarkerLocal _x; + } forEach GVAR(AllMarkerNames); - // delete markers + if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then { + + // create markers { - deleteMarkerLocal _x; - } forEach _allMarkerNames; + if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then { + private ["_markerName", "_marker", "_markerColor"]; + + hint format ["marker. %1", time]; - if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then { + //_markerName = format ["%1", [_x] call EFUNC(common,getName)]; + _markerName = str _x; - // create markers - { - if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then { - private ["_markerName", "_marker", "_markerColor"]; + _marker = createMarkerLocal [_markerName, position _x]; + _markerName setMarkerTypeLocal "mil_triangle"; + _markerName setMarkerShapeLocal "ICON"; + _markerName setMarkerSizeLocal [0.5,0.7]; + _markerName setMarkerDirLocal getDir _x; - //_markerName = format ["%1", [_x] call EFUNC(common,getName)]; - _markerName = str _x; + // commy's one liner magic + _markerColor = format ["Color%1", side group _x]; - _marker = createMarkerLocal [_markerName, position _x]; - _markerName setMarkerTypeLocal "mil_triangle"; - _markerName setMarkerShapeLocal "ICON"; - _markerName setMarkerSizeLocal [0.5,0.7]; - _markerName setMarkerDirLocal getDir _x; - - // commy's one liner magic - _markerColor = format ["Color%1", side group _x]; - - if ((_x getVariable [QGVAR(IsPlayerControlled), false])) then { - _markerName setMarkerColorLocal "ColorOrange"; - _markerName setMarkerTextLocal (_x getVariable [QGVAR(PlayerControlledName), ""]); - } else { - _markerName setMarkerColorLocal _markerColor; - _markerName setMarkerTextLocal (getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName")); - }; - - _allMarkerNames pushBack _markerName; + if ((_x getVariable [QGVAR(IsPlayerControlled), false])) then { + _markerName setMarkerColorLocal "ColorOrange"; + _markerName setMarkerTextLocal (_x getVariable [QGVAR(PlayerControlledName), ""]); + } else { + _markerName setMarkerColorLocal _markerColor; + _markerName setMarkerTextLocal (getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName")); }; - } forEach allUnits; - }; + + GVAR(AllMarkerNames) pushBack _markerName; + }; + } forEach allUnits; }; }; + +[FUNC(pfhMarkAiOnMap), 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_module.sqf b/addons/switchunits/functions/fnc_module.sqf index c4f5c378c2..e622a65338 100644 --- a/addons/switchunits/functions/fnc_module.sqf +++ b/addons/switchunits/functions/fnc_module.sqf @@ -1,20 +1,20 @@ /* - Name: ACE_SwitchUnits_fnc_module - - Author(s): - bux578 - - Description: - Initializes the SwitchUnits module - - Parameters: - 0: OBJECT - module logic - 1: ARRAY - list of affected units - 2: BOOLEAN - isActivated - - Returns: - BOOLEAN (Good practice to include one) -*/ + * Author: bux578 + * Initializes the SwitchUnits module + * + * Arguments: + * 0: module logic + * 1: list of affected units > + * 2: isActivated + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ #include "script_component.hpp" @@ -27,14 +27,14 @@ if !(_activated) exitWith {}; GVAR(Module) = true; -[QGVAR(EnableSwitchUnits), true] call EFUNC(common,setParameter); +[_logic, QGVAR(SwitchToWest), "SwitchToWest"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(SwitchToEast), "SwitchToEast"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(SwitchToIndependent), "SwitchToIndependent"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(SwitchToCivilian), "SwitchToCivilian"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(SwitchToWest), "SwitchToWest"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(SwitchToEast), "SwitchToEast"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(SwitchToIndependent), "SwitchToIndependent"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(SwitchToCivilian), "SwitchToCivilian"] call EFUNC(common,readBooleanParameterFromModule); - -[_logic, QGVAR(EnableSafeZone), "EnableSafeZone"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(SafeZoneRadius), "SafeZoneRadius"] call EFUNC(common,readNumericParameterFromModule); +[_logic, QGVAR(EnableSafeZone), "EnableSafeZone"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(SafeZoneRadius), "SafeZoneRadius"] call EFUNC(common,readSettingFromModule); + +[QGVAR(EnableSwitchUnits), true, false, true] call EFUNC(common,setSetting); diag_log text "[ACE]: SwitchUnits Module Initialized."; diff --git a/addons/switchunits/functions/fnc_nearestPlayers.sqf b/addons/switchunits/functions/fnc_nearestPlayers.sqf index 217e1b90e4..b79c54054f 100644 --- a/addons/switchunits/functions/fnc_nearestPlayers.sqf +++ b/addons/switchunits/functions/fnc_nearestPlayers.sqf @@ -1,19 +1,19 @@ /* - Name: ACE_SwitchUnits_fnc_nearestPlayers - - Author(s): - bux578 - - Description: - Returns an array of alive players in a given radius around a given location - - Parameters: - 0: POSTION - Center position - 1: NUMBER - Radius - - Returns: - ARRAY - Player units -*/ + * Author: bux578 + * Returns an array of alive players in a given radius around a given location + * + * Arguments: + * 0: Center position + * 1: Radius + * + * Return Value: + * Player units > + * + * Example: + * [_pos, 100] call FUNC(nearestPlayers) + * + * Public: Yes + */ #include "script_component.hpp" diff --git a/addons/switchunits/functions/fnc_switchBack.sqf b/addons/switchunits/functions/fnc_switchBack.sqf index 6bdc2c8bac..d54713bbe4 100644 --- a/addons/switchunits/functions/fnc_switchBack.sqf +++ b/addons/switchunits/functions/fnc_switchBack.sqf @@ -1,31 +1,41 @@ /* - Name: ACE_SwitchUnits_fnc_switchBack - - Author(s): - bux578 - - Description: - Switches back to the original player unit - This method needs to be "spawn"ed - - Parameters: - 0: OBJECT - original player unit - 1: OBJECT - respawned unit - - Returns: - VOID -*/ + * Author: bux578 + * Switches back to the original player unit + * + * Arguments: + * 0: Original player unit + * 1: Respawned unit + * + * Return Value: + * None + * + * Example: + * [_origPlayer, _respPlayer] call FUNC(switchBack) + * + * Public: Yes + */ #include "script_component.hpp" -private ["_originalPlayerUnit", "_currentUnit"]; -_originalPlayerUnit = _this select 0; -_currentUnit = _this select 1; +private ["_origPlayerUnit"]; -[_originalPlayerUnit] joinSilent GVAR(OriginalGroup); +_origPlayerUnit = _this select 0; +[_origPlayerUnit] joinSilent GVAR(OriginalGroup); -waitUntil {local _originalPlayerUnit}; +DFUNC(pfhSwitchBack) = { + + private ["_args", "_originalPlayerUnit", "_currentUnit"]; + + _args = _this select 0; + + _originalPlayerUnit = _args select 0; + _currentUnit = _args select 1; -selectPlayer _originalPlayerUnit; + if (local _originalPlayerUnit) exitWith { + selectPlayer _originalPlayerUnit; + deleteVehicle _currentUnit; + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; +}; -deleteVehicle _currentUnit; +[FUNC(pfhSwitchBack), 0.2, _this] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index efe3cef901..abd053ffae 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -1,81 +1,98 @@ /* - Name: ACE_SwitchUnits_fnc_switchUnit - - Author(s): - bux578 - - Description: - Selects the new given player unit - - Parameters: - 0: OBJECT - the unit to switch to - - Returns: - VOID -*/ + * Author: bux578 + * Switches to the new given player unit + * + * Arguments: + * 0: current unit + * 1: the unit to switch to + * + * Return Value: + * None + * + * Example: + * [_unit] call FUNC(switchUnit) + * + * Public: Yes + */ + #include "script_component.hpp" -private ["_newUnit"]; +private ["_unit", "_allNearestPlayers", "_oldUnit", "_leave"]; -_newUnit = _this select 1; +_unit = _this select 1; // don't switch to original player units -if (!([_newUnit] call FUNC(isValidAi))) exitWith {}; +if (!([_unit] call FUNC(isValidAi))) exitWith {}; + +// exit var +_leave = false; + +if (GVAR(EnableSafeZone)) then { -_newUnit spawn { - private ["_unit", "_allNearestPlayers", "_oldUnit", "_respawnEhId", "_oldOwner", "_leave"]; - - _unit = _this; - - _leave = false; - - if (GVAR(EnableSafeZone)) then { - _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers); _nearestEnemyPlayers = [_allNearestPlayers, {((side GVAR(OriginalGroup)) getFriend (side _this) < 0.6) && !(_this getVariable [QGVAR(IsPlayerControlled), false])}] call EFUNC(common,filter); if (count _nearestEnemyPlayers > 0) exitWith { - _leave = true; + _leave = true; }; - }; - - // exitWith doesn't exit past the "if(EnableSafeZone)" block - if (_leave) exitWith { - [localize "STR_ACE_SwitchUnits_TooCloseToEnemy"] call EFUNC(common,displayTextStructured); - }; - - // should switch locality - // This doesn't work anymore, because one's now able to switch to units from a different side - //[_unit] joinSilent group player; - [[_unit, player], QUOTE({(_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; (_this select 0) setOwner owner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); - - _oldUnit = player; - waitUntil {sleep 0.2; local _unit}; - - _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; - _oldUnit setVariable [QGVAR(PlayerControlledName), "", true]; - - _respawnEhId = _unit getVariable [QGVAR(RespawnEhId), -1]; - if (_respawnEhId != -1) then { - _oldUnit removeEventHandler ["Respawn", _respawnEhId]; - }; - - selectPlayer _unit; - - _unit setVariable [QGVAR(IsPlayerControlled), true, true]; - _unit setVariable [QGVAR(PlayerControlledName), GVAR(OriginalName), true]; - - _respawnEhId = _unit addEventHandler ["Respawn", { - [GVAR(OriginalUnit), _this select 0] spawn FUNC(switchBack); - }]; - _unit setVariable [QGVAR(RespawnEhId), _respawnEhId, true]; - - // set owner back to original owner - _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1]; - if (_oldOwner > -1) then { - [[_oldUnit, _oldOwner], QUOTE({(_this select 0) setOwner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); - }; - - [localize "STR_ACE_SwitchUnits_SwitchedUnit"] call EFUNC(common,displayTextStructured); + }; + +// exitWith doesn't exit past the "if(EnableSafeZone)" block +if (_leave) exitWith { + [localize "STR_ACE_SwitchUnits_TooCloseToEnemy"] call EFUNC(common,displayTextStructured); +}; + +// should switch locality +// This doesn't work anymore, because one's now able to switch to units from a different side +//[_unit] joinSilent group player; +[[_unit, player], QUOTE({(_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; (_this select 0) setOwner owner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); + +_oldUnit = player; + + +DFUNC(pfhSwitchUnit) = { + + private ["_args", "_unit", "_oldUnit", "_respawnEhId", "_oldOwner"]; + _args = _this select 0; + + _unit = _args select 0; + _oldUnit = _args select 1; + + + + if (local _unit) exitWith { + + _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; + _oldUnit setVariable [QGVAR(PlayerControlledName), "", true]; + + _respawnEhId = _unit getVariable [QGVAR(RespawnEhId), -1]; + if (_respawnEhId != -1) then { + _oldUnit removeEventHandler ["Respawn", _respawnEhId]; + }; + + selectPlayer _unit; + + _unit setVariable [QGVAR(IsPlayerControlled), true, true]; + _unit setVariable [QGVAR(PlayerControlledName), GVAR(OriginalName), true]; + + _respawnEhId = _unit addEventHandler ["Respawn", { + [GVAR(OriginalUnit), _this select 0] call FUNC(switchBack); + }]; + _unit setVariable [QGVAR(RespawnEhId), _respawnEhId, true]; + + // set owner back to original owner + _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1]; + if (_oldOwner > -1) then { + [[_oldUnit, _oldOwner], QUOTE({(_this select 0) setOwner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); + }; + + [localize "STR_ACE_SwitchUnits_SwitchedUnit"] call EFUNC(common,displayTextStructured); + + [(_this select 1)] call cba_fnc_removePerFrameHandler; + + }; +}; + +[FUNC(pfhSwitchUnit), 0.2, [_unit, _oldUnit]] call cba_fnc_addPerFrameHandler; diff --git a/addons/vector/XEH_postInit.sqf b/addons/vector/XEH_postInit.sqf index 0a8f031347..8bbf7d7aa6 100644 --- a/addons/vector/XEH_postInit.sqf +++ b/addons/vector/XEH_postInit.sqf @@ -1,78 +1,4 @@ // by commy2 #include "script_component.hpp" -["ACE3", - localize "STR_ACE_Vector_AzimuthKey", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"} && {!(GETGVAR(isDownStateKeyAzimuth,false))}) exitWith {false}; - - GVAR(isDownStateKeyAzimuth) = true; - - // Statement - ["azimuth"] call FUNC(onKeyDown); - true - }, - [15, [false, false, false]], - false, - "keydown" -] call CBA_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Vector_AzimuthKey", - { - GVAR(isDownStateKeyAzimuth) = false; - - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - - // Statement - ["azimuth"] call FUNC(onKeyUp); - true - }, - [15, [false, false, false]], - false, - "keyup" -] call CBA_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Vector_DistanceKey", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"} && {!(GETGVAR(isDownStateKeyDistance,false))}) exitWith {false}; - - GVAR(isDownStateKeyDistance) = true; - - // Statement - ["distance"] call FUNC(onKeyDown); - true - }, - [19, [false, false, false]], - false, - "keydown" -] call CBA_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Vector_DistanceKey", - { - GVAR(isDownStateKeyDistance) = false; - - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - - // Statement - ["distance"] call FUNC(onKeyUp); - true - }, - [19, [false, false, false]], - false, - "keyup" -] call CBA_fnc_registerKeybind; +#include "initKeybinds.sqf" diff --git a/addons/vector/XEH_preInit.sqf b/addons/vector/XEH_preInit.sqf index 4ce39de4e9..a0a20d3315 100644 --- a/addons/vector/XEH_preInit.sqf +++ b/addons/vector/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(clearDisplay); PREP(convertToTexturesDegree); PREP(convertToTexturesDistance); @@ -37,3 +39,5 @@ GVAR(keyDownTimeDistance) = -1; GVAR(useMil) = false; GVAR(useFeet) = false; GVAR(modeReticle) = 0; + +ADDON = true; diff --git a/addons/vector/initKeybinds.sqf b/addons/vector/initKeybinds.sqf new file mode 100644 index 0000000000..f81c280905 --- /dev/null +++ b/addons/vector/initKeybinds.sqf @@ -0,0 +1,83 @@ +// by commy2 + +["ACE3", + localize "STR_ACE_Vector_AzimuthKey", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false}; + + // prevent holding down + if (GETGVAR(isDownStateKey1,false)) exitWith {false}; + GVAR(isDownStateKey1) = true; + + // Statement + ["azimuth"] call FUNC(onKeyDown); + true + }, + [15, [false, false, false]], + false, + "keydown" +] call CBA_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_Vector_AzimuthKey", + { + // prevent holding down + GVAR(isDownStateKey1) = false; + + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + + // Statement + ["azimuth"] call FUNC(onKeyUp); + true + }, + [15, [false, false, false]], + false, + "keyup" +] call CBA_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_Vector_DistanceKey", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false}; + + // prevent holding down + if (GETGVAR(isDownStateKey2,false)) exitWith {false}; + GVAR(isDownStateKey2) = true; + + // Statement + ["distance"] call FUNC(onKeyDown); + true + }, + [19, [false, false, false]], + false, + "keydown" +] call CBA_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_Vector_DistanceKey", + { + // prevent holding down + GVAR(isDownStateKey2) = false; + + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + + // Statement + ["distance"] call FUNC(onKeyUp); + true + }, + [19, [false, false, false]], + false, + "keyup" +] call CBA_fnc_registerKeybind; diff --git a/addons/vehiclelock/CfgVehicles.hpp b/addons/vehiclelock/CfgVehicles.hpp index 79591280d8..2ffb4eee44 100644 --- a/addons/vehiclelock/CfgVehicles.hpp +++ b/addons/vehiclelock/CfgVehicles.hpp @@ -1,29 +1,34 @@ #define MACRO_LOCK_ACTIONS \ - class ACE_unlockVehicle { \ - displayName = "$STR_ACE_Vehicle_Action_UnLock"; \ - distance = 4; \ - condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(2,3)]}); \ - statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \ - showDisabled = 0; \ - priority = 0.3; \ - icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ - }; \ - class ACE_lockVehicle { \ - displayName = "$STR_ACE_Vehicle_Action_Lock"; \ - distance = 4; \ - condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(0,1)]}); \ - statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \ - showDisabled = 0; \ - priority = 0.2; \ - icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ - }; \ - class ACE_lockpickVehicle { \ - displayName = "$STR_ACE_Vehicle_Action_Lockpick"; \ - distance = 4; \ - condition = QUOTE([ARR_3(_player, _target, 'canLockpick')] call FUNC(lockpick)); \ - statement = QUOTE([ARR_3(_player, _target, 'startLockpick')] call FUNC(lockpick)); \ - showDisabled = 0; \ - priority = 0.1; \ + class ACE_MainActions { \ + selection = ""; \ + distance = 5; \ + condition = "true"; \ + class ACE_unlockVehicle { \ + displayName = "$STR_ACE_Vehicle_Action_UnLock"; \ + distance = 4; \ + condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(2,3)]}); \ + statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \ + showDisabled = 0; \ + priority = 0.3; \ + icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ + }; \ + class ACE_lockVehicle { \ + displayName = "$STR_ACE_Vehicle_Action_Lock"; \ + distance = 4; \ + condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(0,1)]}); \ + statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \ + showDisabled = 0; \ + priority = 0.2; \ + icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ + }; \ + class ACE_lockpickVehicle { \ + displayName = "$STR_ACE_Vehicle_Action_Lockpick"; \ + distance = 4; \ + condition = QUOTE([ARR_3(_player, _target, 'canLockpick')] call FUNC(lockpick)); \ + statement = QUOTE([ARR_3(_player, _target, 'startLockpick')] call FUNC(lockpick)); \ + showDisabled = 0; \ + priority = 0.1; \ + }; \ }; class CfgVehicles { diff --git a/addons/vehiclelock/CfgWeapons.hpp b/addons/vehiclelock/CfgWeapons.hpp index c7df1116f8..157fb4bf60 100644 --- a/addons/vehiclelock/CfgWeapons.hpp +++ b/addons/vehiclelock/CfgWeapons.hpp @@ -3,7 +3,7 @@ class CfgWeapons { class ACE_ItemCore; class ACE_key_master: ACE_ItemCore { - author = "$STR_ACE_Core_ACETeam"; + author = "$STR_ACE_Common_ACETeam"; displayName = "Vehicle Key: Master"; descriptionShort = "$STR_ACE_Vehicle_Item_Master_Description"; model = "\A3\weapons_F\ammo\mag_univ.p3d"; diff --git a/addons/vehiclelock/XEH_preInit.sqf b/addons/vehiclelock/XEH_preInit.sqf index 7040450597..80d1d6335f 100644 --- a/addons/vehiclelock/XEH_preInit.sqf +++ b/addons/vehiclelock/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(addKeyForVehicle); PREP(getVehicleSideKey); PREP(hasKeyForVehicle); @@ -12,3 +14,5 @@ PREP(setVehicleLockEH); //Add Event Handlers ["SetupCustomKey", {_this call FUNC(serverSetupCustomKeyEH)}] call EFUNC(common,addEventHandler); ["SetVehicleLock", {_this call FUNC(setVehicleLockEH)}] call EFUNC(common,addEventHandler); + +ADDON = true; diff --git a/addons/vehiclelock/config.cpp b/addons/vehiclelock/config.cpp index 83850a2bef..9031987315 100644 --- a/addons/vehiclelock/config.cpp +++ b/addons/vehiclelock/config.cpp @@ -12,8 +12,11 @@ class CfgPatches { }; }; -class ACE_Parameters_Numeric { - GVAR(DefaultLockpickStrength) = 10; +class ACE_Settings { + class GVAR(DefaultLockpickStrength) { + value = 10; + typeName = "SCALAR"; + }; }; #include "CfgEventHandlers.hpp" diff --git a/addons/vehiclelock/functions/fnc_moduleInit.sqf b/addons/vehiclelock/functions/fnc_moduleInit.sqf index b0ae230724..a344185ab0 100644 --- a/addons/vehiclelock/functions/fnc_moduleInit.sqf +++ b/addons/vehiclelock/functions/fnc_moduleInit.sqf @@ -29,7 +29,7 @@ _sideKeysAssignment = _logic getVariable["SideKeysAssignment", 0]; _setLockState = _logic getVariable["SetLockState", 0]; if (isServer) then { - [_logic, QGVAR(DefaultLockpickStrength), "LockpickStrength"] call EFUNC(common,readNumericParameterFromModule); + [_logic, QGVAR(DefaultLockpickStrength), "LockpickStrength"] call EFUNC(common,readSettingFromModule); }; //Run at mission start (anyone besides JIPs) diff --git a/addons/vehicles/XEH_preInit.sqf b/addons/vehicles/XEH_preInit.sqf index 85fc9fe8d2..7070aab075 100644 --- a/addons/vehicles/XEH_preInit.sqf +++ b/addons/vehicles/XEH_preInit.sqf @@ -1,4 +1,8 @@ #include "script_component.hpp" +ADDON = false; + PREP(speedLimiter); PREP(startEngine); + +ADDON = true; diff --git a/addons/weaponselect/XEH_preInit.sqf b/addons/weaponselect/XEH_preInit.sqf index ec81c4834e..0dfb72f353 100644 --- a/addons/weaponselect/XEH_preInit.sqf +++ b/addons/weaponselect/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(countMagazinesForGrenadeMuzzle); PREP(displayGrenadeTypeAndNumber); PREP(findNextGrenadeMagazine); @@ -63,3 +65,5 @@ GVAR(AllMuzzles) = uiNamespace getVariable QGVAR(AllMuzzles); GVAR(FragMagazines) = uiNamespace getVariable QGVAR(FragMagazines); GVAR(NonFragMagazines) = uiNamespace getVariable QGVAR(NonFragMagazines); GVAR(AllMagazines) = uiNamespace getVariable QGVAR(AllMagazines); + +ADDON = true; diff --git a/addons/weather/config.cpp b/addons/weather/config.cpp index dc3faecf5f..f59267690f 100644 --- a/addons/weather/config.cpp +++ b/addons/weather/config.cpp @@ -14,11 +14,3 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "CfgWorlds.hpp" - -/*class ACE_Parameters_Numeric { - GVAR(XXXX) = 100; -}; - -class ACE_Parameters_Boolean { - GVAR(XXXX) = 0; -};*/ diff --git a/addons/winddeflection/CfgEventHandlers.hpp b/addons/winddeflection/CfgEventHandlers.hpp new file mode 100644 index 0000000000..4961d7dbc7 --- /dev/null +++ b/addons/winddeflection/CfgEventHandlers.hpp @@ -0,0 +1,11 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_preInit.sqf) ); + }; +}; + +class Extended_Fired_Eventhandlers { + class CaManBase { + fired = QUOTE( call FUNC(handleFired) ); + }; +}; \ No newline at end of file diff --git a/addons/winddeflection/CfgVehicles.h b/addons/winddeflection/CfgVehicles.h new file mode 100644 index 0000000000..e84727b94e --- /dev/null +++ b/addons/winddeflection/CfgVehicles.h @@ -0,0 +1,20 @@ +class CfgVehicles { + class Module_F; + class GVAR(Module): Module_F { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "Wind Deflection"; + function = FUNC(enableModule); + scope = 2; + isGlobal = 1; + icon = QUOTE(PATHTOF(data\module_icon.paa)); + class Arguments { + class EnableForAI { + displayName = "Enable for AI"; + description = "Should the module be enabled for AI"; + typeName = "BOOL"; + defaultValue = 0; + }; + }; + }; +}; diff --git a/addons/gui/README.md b/addons/winddeflection/README.md similarity index 57% rename from addons/gui/README.md rename to addons/winddeflection/README.md index a6fe74f6c2..c2908a6f85 100644 --- a/addons/gui/README.md +++ b/addons/winddeflection/README.md @@ -1,11 +1,11 @@ -ace_gui -======= - -to be scrapped. +ace_winddeflection +=============== +Wind deflection for projectiles/bullets. ## Maintainers The people responsible for merging changes to this component or answering potential questions. - [Glowbal](https://github.com/Glowbal) +- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file diff --git a/addons/gui/XEH_postInit.sqf b/addons/winddeflection/XEH_preInit.sqf similarity index 67% rename from addons/gui/XEH_postInit.sqf rename to addons/winddeflection/XEH_preInit.sqf index 4172145202..05a606fbc2 100644 --- a/addons/gui/XEH_postInit.sqf +++ b/addons/winddeflection/XEH_preInit.sqf @@ -1,5 +1,5 @@ /** - * XEH_postInit.sqf + * XEH_preInit.sqf * @Descr: N/A * @Author: Glowbal * @@ -9,3 +9,6 @@ */ #include "script_component.hpp" + +PREP(handleFired); +PREP(initalizeModule); diff --git a/addons/winddeflection/config.cpp b/addons/winddeflection/config.cpp new file mode 100644 index 0000000000..0e721846ad --- /dev/null +++ b/addons/winddeflection/config.cpp @@ -0,0 +1,31 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ACE_common", "ACE_weather"}; + versionDesc = "ACE Wind Deflection"; + version = VERSION; + author[] = {$STR_ACE_Common_ACETeam, "Glowbal", "Ruthberg"}; + authorUrl = "http://csemod.com"; + }; +}; + +class CfgAddons { + class PreloadAddons { + class ADDON { + list[] = {QUOTE(ADDON)}; + }; + }; +}; + +class ACE_Settings { + class GVAR(EnableForAI) { + value = 0; + typeName = "BOOL"; + isClientSetable = 0; + }; +}; +#include "CfgVehicles.h" \ No newline at end of file diff --git a/addons/winddeflection/data/module_icon.paa b/addons/winddeflection/data/module_icon.paa new file mode 100644 index 0000000000..f386713736 Binary files /dev/null and b/addons/winddeflection/data/module_icon.paa differ diff --git a/addons/winddeflection/functions/fnc_handleFired.sqf b/addons/winddeflection/functions/fnc_handleFired.sqf new file mode 100644 index 0000000000..19677287dc --- /dev/null +++ b/addons/winddeflection/functions/fnc_handleFired.sqf @@ -0,0 +1,64 @@ +/** + * fnc HandleFired. + * Handles wind deflection for projectiles. + * Is expected to be triggered by the fired eventhandler from BI. + * + * Params: + * 1. unit: Object - Object the event handler is assigned to + * 2. weapon: String - Fired weapon + * 3. muzzle: String - Muzzle that was used + * 4. mode: String - Current mode of the fired weapon + * 5. ammo: String - Ammo used + * 6. magazine: String - magazine name which was used + * 7. projectile: Object - Object of the projectile that was shot (Arma 2: OA and onwards) + * + * Author: Glowbal, Ruthberg + * + */ + +#include "script_component.hpp" + +private ["_unit", "_weapon", "_ammo", "_bullet", "_airFriction", "_index"]; +_unit = _this select 0; + +if (_unit distance ACE_player > 3000) exitWith {false}; // Large enough distance to not simulate any wind deflection. +if (!GVAR(EnableForAI) && !([_unit] call EFUNC(common,isPlayer))) exitWith {false}; +_bullet = _this select 6; + +if (_bullet isKindOf "BulletBase") then { + [{ + private ["_bullet", "_airFriction", "_args", "_deltaT", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueVelocity", "_dragRef", "_drag", "_accelRef", "_accel"]; + + _args = _this select 0; + _bullet = _args select 0; + _airFriction = _args select 1; + _time = _args select 2; + + if (!alive _bullet) exitwith { + [_this select 1] call cba_fnc_removePerFrameHandler; + }; + + _deltaT = time - _time; + _args set[2, time]; + + _bulletVelocity = velocity _bullet; + _bulletSpeed = vectorMagnitude _bulletVelocity; + + if (vectorMagnitude ACE_wind > 0) then { + _trueVelocity = _bulletVelocity vectorDiff ACE_wind; + _trueSpeed = vectorMagnitude _trueVelocity; + + _dragRef = _deltaT * _airFriction * _bulletSpeed * _bulletSpeed; + _accelRef = (vectorNormalized _bulletVelocity) vectorMultiply (_dragRef); + _bulletVelocity = _bulletVelocity vectorDiff _accelRef; + + _drag = _deltaT * _airFriction * _trueSpeed; + _accel = _trueVelocity vectorMultiply (_drag); + _bulletVelocity = _bulletVelocity vectorAdd _accel; + }; + _bullet setVelocity _bulletVelocity; + // TODO expand with advanced ballistics functionality. + + }, 0, [_bullet, getNumber(configFile >> "cfgAmmo" >> (_this select 4) >> "airFriction"), time]] call CBA_fnc_addPerFrameHandler; +}; +true; \ No newline at end of file diff --git a/addons/winddeflection/functions/fnc_initalizeModule.sqf b/addons/winddeflection/functions/fnc_initalizeModule.sqf new file mode 100644 index 0000000000..2833ecc54c --- /dev/null +++ b/addons/winddeflection/functions/fnc_initalizeModule.sqf @@ -0,0 +1,19 @@ +/** + * fnc_initalizeModule.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +#include "script_component.hpp" + +if (!hasInterface) exitwith {}; // No need for this module on HC or dedicated server. + +private ["_logic"]; +_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +if (!isNull _logic) then { + [_logic, QGVAR(EnableForAI), "EnableForAI" ] call EFUNC(common,readSettingFromModule); +}; \ No newline at end of file diff --git a/addons/winddeflection/functions/script_component.hpp b/addons/winddeflection/functions/script_component.hpp new file mode 100644 index 0000000000..278930e4e7 --- /dev/null +++ b/addons/winddeflection/functions/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT windDeflection +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_WINDDEFLECTION + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_WINDDEFLECTION + #define DEBUG_SETTINGS DEBUG_SETTINGS_WINDDEFLECTION +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/winddeflection/script_component.hpp b/addons/winddeflection/script_component.hpp new file mode 100644 index 0000000000..047b7980e5 --- /dev/null +++ b/addons/winddeflection/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT winddeflection +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_WINDDEFLECTION + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_WINDDEFLECTION + #define DEBUG_SETTINGS DEBUG_SETTINGS_WINDDEFLECTION +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/TO_MERGE/cse/sys_ballistics/basicBallistics/stringtable.xml b/addons/winddeflection/stringtable.xml similarity index 74% rename from TO_MERGE/cse/sys_ballistics/basicBallistics/stringtable.xml rename to addons/winddeflection/stringtable.xml index a834816ddb..409ebf7523 100644 --- a/TO_MERGE/cse/sys_ballistics/basicBallistics/stringtable.xml +++ b/addons/winddeflection/stringtable.xml @@ -1,32 +1,32 @@  - - + + - + Wind Information Wind Information Informacje o wietrze Información del viento - + Direction: %1 Direction: %1 Kierunek: %1 Dirección: %1 - + Speed: %1 m/s Speed: %1 m/s Prędkość: %1 Velocidad: %1 m/s - + Weather Information Weather Information Informacje o pogodzie Información Meteorológica - + Humidity: %1% Humidity: %1% Wilgotność: %1