Merge branch 'master' into disarmingTest

This commit is contained in:
PabstMirror 2015-02-11 16:53:01 -06:00
commit 444f88eb05
215 changed files with 4157 additions and 2965 deletions

View File

@ -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"

View File

@ -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";};
};

View File

@ -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";
};

View File

@ -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];

View File

@ -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;
};

View File

@ -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};
};
};

View File

@ -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;

View File

@ -1 +1 @@
z\ace\Addons\laser
z\ace\Addons\attach

View File

@ -1,5 +1,5 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
};
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
};
};

View File

@ -1,10 +1,10 @@
class CfgMagazines {
class CA_Magazine;
class B_IR_Grenade: CA_Magazine {
ACE_Attachable = 1;
};
class SmokeShell;
class Chemlight_green: SmokeShell {
ACE_Attachable = 1;
};
class CA_Magazine;
class B_IR_Grenade: CA_Magazine {
ACE_Attachable = 1;
};
class SmokeShell;
class Chemlight_green: SmokeShell {
ACE_Attachable = 1;
};
};

View File

@ -1,104 +1,147 @@
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
name = #ITEM; \
count = COUNT; \
};
#define MACRO_ATTACHTOVEHICLE \
class ACE_Actions { \
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,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;
};
};
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 NATO_Box_Base;
class EAST_Box_Base;
class IND_Box_Base;
class FIA_Box_Base_F;
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 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 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 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 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)
};
};
};

View File

@ -1,16 +1,16 @@
class CfgWeapons {
class ACE_ItemCore;
class InventoryItem_Base_F;
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 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;
};
};
};
};

View File

@ -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)

View File

@ -7,5 +7,7 @@ PREP(canAttach);
PREP(canDetach);
PREP(detach);
PREP(openAttachUI);
PREP(placeApprove);
PREP(placeCancel);
ADDON = true;

View File

@ -1,15 +1,15 @@
#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_common", "ace_interaction"};
author[] = {"KoffeinFlummi", "eRazeri", "CAA-Picard"};
authorUrl = "https://github.com/KoffeinFlummi/";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"

View File

@ -1,62 +1,88 @@
/*
* Author: eRazeri and CAA-Picard
* Attach an item to the unit
*
* Arguments:
* 0: unit doing the attach (player) <OBJECT>
* 1: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 2: Name of the attachable item <STRING>
*
* 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
_selfAttachPosition = [_unit, [-0.05,0,0.12], "rightshoulder"];
_itemVehClass = "";
_onAtachText = "";
Return Value:
none
*/
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 {};
};
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 (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "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 ["ACE_AttachedObjects", [_attachedItem], true];
_attachToVehicle setVariable ["ACE_AttachedItemNames", [_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;
//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) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)];
_unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)];
};

View File

@ -1,21 +1,25 @@
#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) <OBJECT>
* 1: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 2: Name of the attachable item <STRING>
*
* Return Value:
* Boolean <BOOL>
*
* Example:
* Nothing
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_item"];
PARAMS_3(_unit,_attachToVehicle,_item);
_unit = _this select 0;
_item = _this select 1;
_attachLimit = if (_unit == _attachToVehicle) then {1} else {10};
_attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []];
canStand _unit && {_unit getVariable [QGVAR(ItemName), ""] == ""} && {_item in (magazines _unit + items _unit + [""])}
canStand _unit && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_item in ((magazines _unit) + (items _unit) + [""])}

View File

@ -1,19 +1,39 @@
#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) <STRING>
* 1: vehicle that it will be detached from (player or vehicle) <OBJECT>
*
* Return Value:
* Boolean <BOOL>
*
* Example:
* Nothing
*
* Public: No
*/
#include "script_component.hpp"
private "_unit";
private ["_attachedObjects", "_inRange", "_unitPos", "_objectPos"];
_unit = _this select 0;
PARAMS_2(_unit,_attachToVehicle);
canStand _unit && {_unit getVariable [QGVAR(ItemName), ""] != ""}
_attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []];
_inRange = false;
if (_unit == _attachToVehicle) then {
_inRange = (count _attachedObjects) > 0;
} else {
//Scan if unit is within range (using 2d distance)
_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}

View File

@ -1,63 +1,86 @@
/*
* Author: eRazeri and CAA-Picard
* Detach an item from a unit
*
* Arguments:
* 0: unit doing the attaching (player) <STRING>
* 1: vehicle that it will be detached from (player or vehicle) <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* Nothing
*
* Public: No
*/
#include "script_component.hpp"
/*
Author: eRazeri and CAA-Picard
private ["_itemName", "_count", "_attachedItem", "_fnc_detachDelay"];
Detach an item from a unit
PARAMS_2(_unit,_attachToVehicle);
Arguments:
unit
_attachedObjectsArray = _attachToVehicle getVariable ["ACE_AttachedObjects", []];
_attachedItemsArray = _attachToVehicle getVariable ["ACE_AttachedItemNames", []];
Return Value:
none
*/
_attachedObject = objNull;
_attachedIndex = -1;
_itemName = "";
private ["_unit", "_itemName", "_count", "_attachedItem", "_fnc_detachDelay"];
_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 = _attachedItemsArray select _forEachIndex;
_attachedIndex = _forEachIndex;
};
} forEach _attachedObjectsArray;
// 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);
[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);
// Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle
detach _attachedObject;
_attachedObject 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, [_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];
_attachedObjectsArray deleteAt _attachedIndex;
_attachedItemsArray deleteAt _attachedIndex;
_attachToVehicle setVariable ["ACE_AttachedObjects", _attachedObjectsArray, true];
_attachToVehicle setVariable ["ACE_AttachedItemNames", _attachedItemsArray, 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 {};
};
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);
};
};

View File

@ -1,63 +1,67 @@
/*
* Author: Garth de Wet (LH)
* Opens the UI for attaching objects.
*
* Arguments:
* 0: unit <STRING>
* 1: target <OBJECT>
*
* 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);
_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);

View File

@ -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 ["ACE_AttachedObjects", []];
_currentObjects pushBack _attachedObject;
_attachToVehicle setVariable ["ACE_AttachedObjects", _currentObjects, true];
_currentItemNames = _attachToVehicle getVariable ["ACE_AttachedItemNames", []];
_currentItemNames pushBack _itemClassname;
_attachToVehicle setVariable ["ACE_AttachedItemNames", _currentItemNames, true];
[_placementText] call EFUNC(common,displayTextStructured);

View File

@ -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;

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-12 -->
<!-- Edited with tabler - 2015-01-31 -->
<Project name="ACE">
<Package name="Attach">
<Key ID="STR_ACE_Attach_AttachDetach">
@ -146,5 +146,34 @@
<Hungarian>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ó.</Hungarian>
<Russian>ИК строб позволяет сигнализировать свое местоположение через пульсирующий маяк, видимый только через ПНВ.</Russian>
</Key>
<Key ID="STR_ACE_Attach_PlaceAction">
<English>Place</English>
<German>Platzieren</German>
<Spanish>Colocar</Spanish>
<Polish>Umieść</Polish>
<French>Placer</French>
<Czech>Položit</Czech>
<Portuguese>Colocar</Portuguese>
<Italian>Posiziona</Italian>
<Hungarian>Elhelyez</Hungarian>
</Key>
<Key ID="STR_ACE_Attach_CancelAction">
<English>Cancel</English>
<German>Abbrechen</German>
<Spanish>Cancelar</Spanish>
<Polish>Anuluj</Polish>
<French>Annuler</French>
<Czech>Zrušit</Czech>
<Portuguese>Cancelar</Portuguese>
<Italian>Annulla</Italian>
<Hungarian>Mégse</Hungarian>
</Key>
<Key ID="STR_ACE_Attach_Failed">
<English>Attach Failed</English>
<French>Échec du Attacher</French>
<German>Befestigen Fehlgeschlagen</German>
<Russian>Присоединить Ошибка</Russian>
<Spanish>Error en Acoplar</Spanish>
</Key>
</Package>
</Project>

View File

@ -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;
};
};

View File

@ -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 {

View File

@ -11,6 +11,7 @@ PREP(addCustomEventHandler);
PREP(addLineToDebugDraw);
PREP(addMapMarkerCreatedEventHandler);
PREP(addScrollWheelEventHandler);
PREP(addSetting);
PREP(adminKick);
PREP(ambientBrightness);
PREP(applyForceWalkStatus);
@ -48,6 +49,7 @@ PREP(getConfigGunner);
PREP(getDefaultAnim);
PREP(getDoorTurrets);
PREP(getForceWalkStatus);
PREP(getGunner);
PREP(getHitPoints);
PREP(getHitPointsWithSelections);
PREP(getInPosition);
@ -55,6 +57,7 @@ PREP(getMarkerType);
PREP(getName);
PREP(getNumberFromMissionSQM);
PREP(getPitchBankYaw);
PREP(getSettingData);
PREP(getStringFromMissionSQM);
PREP(getTargetAzimuthAndInclination);
PREP(getTargetDistance);
@ -85,6 +88,8 @@ PREP(isInBuilding);
PREP(isPlayer);
PREP(isTurnedOut);
PREP(letterToCode);
PREP(loadSettingsFromProfile);
PREP(loadSettingsOnServer);
PREP(map);
PREP(moduleCheckPBOs);
PREP(moduleLSDVehicles);
@ -97,8 +102,7 @@ PREP(player);
PREP(playerSide);
PREP(progressBar);
PREP(queueAnimation);
PREP(readBooleanParameterFromModule);
PREP(readNumericParameterFromModule);
PREP(readSettingFromModule);
PREP(removeActionEventHandler);
PREP(removeActionMenuEventHandler);
PREP(removeCameraEventHandler);
@ -115,6 +119,8 @@ PREP(setName);
PREP(setParameter);
PREP(setPitchBankYaw);
PREP(setVariableJIP);
PREP(setSetting);
PREP(setSettingFromConfig);
PREP(stringToColoredText);
PREP(subString);
PREP(toBin);
@ -162,7 +168,10 @@ PREP(hashListSelect);
PREP(hashListSet);
PREP(hashListPush);
// Load settings
if (isServer) then {
call FUNC(loadSettingsOnServer);
};
ACE_player = player;
@ -183,7 +192,6 @@ if (hasInterface) then {
}, 0, []] call cba_fnc_addPerFrameHandler;
};
PREP(stringCompare);
PREP(string_removeWhiteSpace);
PREP(isHC);

View File

@ -57,10 +57,42 @@ 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;
};
};

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
};

View File

@ -0,0 +1,102 @@
/*
* 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);
_value = getNumber (_optionEntry >> "value");
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];
};
};

View File

@ -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);
};

View File

@ -1,21 +1,18 @@
/*
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;

View File

@ -1,21 +1,18 @@
/*
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;

View File

@ -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";
};
};

View File

@ -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 <OBJECT>
* 1: Explosive <OBJECT>
* 2: Magazine classname <STRING>
* 3: Extra variables <ARRAY>
*
* 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;

View File

@ -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 <OBJECT>
*
* Return Value:
* Able to defuse <BOOL>
*
* 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;

View File

@ -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 <OBJECT>
*
* Return Value:
* Able to detonate <BOOL>
*
* Example:
* if ([player] call ACE_Explosives_fnc_canDetonate) then { hint "Can Detonate"; };
*
* Public: Yes
*/
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;

View File

@ -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 <OBJECT>
* 1: Explosive <OBJECT>
*
* 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;

View File

@ -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 <OBJECT>
* 1: Max range (-1 to ignore) <NUMBER>
* 2: Explosive <ARRAY>
* 0: Explosive <OBJECT>
* 1: Fuse time <NUMBER>
*
* 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

View File

@ -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 <OBJECT>
*
* Return Value:
* Configs of all detonators <ARRAY>
*
* Example:
* _detonators = [player] call ACE_Explosives_fnc_getDetonators;
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_items", "_result", "_config"];
_unit = _this select 0;

View File

@ -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 <OBJECT>
* 1: Trigger classname - filter (optional) <STRING>
*
* Return Value:
* Explosives <ARRAY>
*
* 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;

View File

@ -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 <NUMBER>
*
* Return Value:
* Handled <BOOL>
*
* 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};

View File

@ -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 <OBJECT>
*
* Return Value:
* The unit has explosives <BOOL>
*
* Example:
* _hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives;
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_result", "_magazines"];
_result = false;

View File

@ -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 <OBJECT>
*
* Return Value:
* Configs of all detonators <ARRAY>
*
* Example:
* _hasPlacedExplosives = [player] call ACE_Explosives_fnc_hasPlacedExplosives;
*
* Public: Yes
*/
#include "script_component.hpp"
(count (_this call FUNC(getPlacedExplosives)) > 0)

View File

@ -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.";

View File

@ -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 <OBJECT>
* 1: Trigger classname <STRING>
*
* 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);

View File

@ -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 <OBJECT>
*
* 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;

View File

@ -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 <STRING>
*
* Return Value:
* None
*
* Example:
* ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_openTimerSetUI;
*
* Public: No
*/
#include "script_component.hpp"
private ["_mag"];
_mag = _this select 0;

View File

@ -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 <OBJECT>
*
* 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;

View File

@ -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 <STRING>
*
* 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;

View File

@ -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 <OBJECT>
* 1: Position to place explosive <POSITION>
* 2: Rotation <NUMBER>
* 3: Magazine class <STRING>
* 4: Config of trigger <CONFIG>
* 5: Variables required for the trigger type <ARRAY>
* 6: Should direction be set <BOOL>
*
* Return Value:
* Placed explosive <OBJECT>
*
* 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;

View File

@ -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);

View File

@ -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);

View File

@ -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 <STRING>
* 1: Trigger mode <STRING>
*
* Return Value:
* None
*
* Example:
* ["SatchelCharge_Remote_Mag","Timer"] call ACE_Explosives_fnc_selectTrigger;
*
* Public: No
*/
#include "script_component.hpp"
private ["_magazine","_trigger"];
closeDialog 0;

View File

@ -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 <OBJECT>
* 1: Direction <NUMBER>
* 2: Pitch <NUMBER>
*
* 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);

View File

@ -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 <OBJECT>
* 1: Classname of explosive to place. (CfgMagazine class) <STRING>
* 2: Trigger Config <CONFIG>
* 3: Timer (optional) <NUMBER>
*
* 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;

View File

@ -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 <OBJECT>
* 1: Target explosive <OBJECT>
*
* 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;

View File

@ -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 <OBJECT>
* 1: Time till detonate <NUMBER>
*
* 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);
}, _explosive, _delay, 0] call EFUNC(common,waitAndExecute);

View File

@ -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 <STRING>
*
* Return Value:
* Supported triggers as CfgACE_Triggers config entries <ARRAY>
*
* Example:
* _supports = ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType
*
* Public: Yes
*/
#include "script_component.hpp"
private "_result";
_result = [];

32
addons/fcs/CfgAmmo.hpp Normal file
View File

@ -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;
};
};

View File

@ -1,19 +1,67 @@
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));
};
};
class Car {
class ADDON {
clientInit = QUOTE(_this call FUNC(vehicleInit));
};
};
class Helicopter {
class ADDON {
clientInit = QUOTE(_this call FUNC(vehicleInit));
};
};
class Plane {
class ADDON {
clientInit = QUOTE(_this call FUNC(vehicleInit));
};
};
class Ship_F {
class ADDON {
clientInit = 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));
};
};
};

View File

@ -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";
};
};

View File

@ -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 {

516
addons/fcs/CfgVehicles.hpp Normal file
View File

@ -0,0 +1,516 @@
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 B_Heli_Light_01_F: Heli_Light_01_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;
};
};

24
addons/fcs/CfgWeapons.hpp Normal file
View File

@ -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";
};
};

View File

@ -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"

View File

@ -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 <CfgOptics.hpp>
#include "CfgOptics.hpp"

View File

@ -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);

View File

@ -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), [vehicle ACE_player] call EFUNC(common,getTurretIndex)], []]) > 1

View File

@ -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"}

View File

@ -12,38 +12,46 @@
#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);
if (ACE_player != _gunner) 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 {
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_Airburst") == 1) then {
_this spawn {
_vehicle = _this select 0;
_projectile = _this select 6;
_distance = _vehicle getVariable [QGVAR(Distance), currentZeroing _vehicle];
_distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle];
if (_distance < 50) exitWith {};
if (_distance > 1500) exitWith {};

View File

@ -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),

View File

@ -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 setVariable [format ["%1_%2", QGVAR(Distance), _turret], _distance, true];
_vehicle setVariable [format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines, true];
_vehicle setVariable [format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation, true];
_vehicle setVariable [format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth, true];
[format ["%1: %2", localize "STR_ACE_FCS_ZeroedTo", _distance]] call EFUNC(common,displayTextStructured);

View File

@ -12,7 +12,7 @@
#include "script_component.hpp"
private ["_vehicle"];
private "_vehicle";
_vehicle = _this select 0;

View File

@ -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;

View File

@ -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;

View File

@ -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 <ARRAY>
* 1: pfh_id <NUMBER>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_params,_pfhId);

View File

@ -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);
};

View File

@ -1,3 +1,18 @@
/*
* Author: Garth 'L-H' de Wet
* Initialises Goggles.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* None
*
* Public: No
*/
#include "script_component.hpp"
ADDON = false;

View File

@ -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";
};
};

View File

@ -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 <BOOL>
*
* 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];

View File

@ -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));

View File

@ -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 <STRING>
*
* 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");

View File

@ -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);

View File

@ -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";

View File

@ -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 <OBJECT>
* 1: Weapon <STRING>
*
* 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);

View File

@ -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. <BOOL>
*
* 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")

View File

@ -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 <NUMBER>
*
* Return Value:
* The rating [0-3] <NUMBER>
*
* Example:
* _rating = 0.05 call ace_goggles_fnc_getExplosionIndex;
*
* Public: No
*/
private ["_effectIndex"];
_effectIndex = switch true do {

View File

@ -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 <STRING>
*
* Return Value:
* Whether diving goggles are worn <BOOL>
*
* 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;

View File

@ -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 <OBJECT>
*
* Return Value:
* Whether goggles are visible <BOOL>
*
* 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

View File

@ -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 <OBJECT>
* 1: Radius to check for helicopter Default: 15 (optional) <NUMBER>
*
* Return Value:
* <ARRAY>:
* 0: In rotorwash <BOOL>
* 1: Amount of rotor wash. <NUMBER>
*
* 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;

View File

@ -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);

View File

@ -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 {};

Some files were not shown because too many files have changed in this diff Show More