fcs per turrets

This commit is contained in:
commy2 2015-02-03 23:03:43 +01:00
parent 4185299efd
commit 47d5befd12
14 changed files with 746 additions and 430 deletions

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

@ -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 \ #define MACRO_RANGEFINDER \
class CA_Distance; \ class CA_Distance; \
class ACE_CA_Distance: CA_Distance { \ class ACE_CA_Distance: CA_Distance { \
@ -17,12 +18,12 @@ class RscInGameUI {
class RscUnitInfo; class RscUnitInfo;
class RscUnitInfo_AH64D_gunner { class RscUnitInfo_AH64D_gunner {
onLoad = ""; onLoad = "";
controls[] = {"CA_Distance", "ACE_CA_Distance"}; controls[] = {"CA_Distance","ACE_CA_Distance"};
MACRO_RANGEFINDER MACRO_RANGEFINDER
}; };
class RscWeaponRangeFinder { class RscWeaponRangeFinder {
onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; 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 MACRO_RANGEFINDER
}; };
@ -56,17 +57,17 @@ class RscInGameUI {
}; };
class RscWeaponRangeFinderAbramsCom { class RscWeaponRangeFinderAbramsCom {
onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; 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 MACRO_RANGEFINDER
}; };
class RscWeaponRangeFinderAbramsGun { class RscWeaponRangeFinderAbramsGun {
onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; 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 MACRO_RANGEFINDER
}; };
class RscWeaponRangeFinderStrykerMGSGun { class RscWeaponRangeFinderStrykerMGSGun {
onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; 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 MACRO_RANGEFINDER
}; };
class RscOptics_crows: RscUnitInfo { class RscOptics_crows: RscUnitInfo {
@ -88,7 +89,7 @@ class RscInGameUI {
class RscWeaponRangeZeroing: RscUnitInfo { 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"""; 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 MACRO_RANGEFINDER
}; };
class RscOptics_sos: RscUnitInfo { 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([vehicle _player] call FUNC(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([vehicle _player] call FUNC(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

@ -4,76 +4,4 @@ GVAR(enabled) = True;
GVAR(time) = 0; GVAR(time) = 0;
GVAR(position) = [0,0,0]; GVAR(position) = [0,0,0];
// Add keybinds #include "initKeybinds.sqf"
["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;

View File

@ -14,329 +14,9 @@ class CfgPatches {
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
class CfgVehicles { #include "CfgAmmo.hpp"
class All { #include "CfgMagazines.hpp"
class Turrets; #include "CfgVehicles.hpp"
}; #include "CfgWeapons.hpp"
class AllVehicles: All { #include "CfgOptics.hpp"
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>

View File

@ -18,8 +18,8 @@ private ["_vehicle", "_delta", "_min", "_max", "_distance"];
_vehicle = _this select 0; _vehicle = _this select 0;
_delta = _this select 1; _delta = _this select 1;
_min = getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> QGVAR(MinDistance)); _min = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MinDistance));
_max = getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> QGVAR(MaxDistance)); _max = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MaxDistance));
_distance = _vehicle getVariable [QGVAR(Distance), _min]; _distance = _vehicle getVariable [QGVAR(Distance), _min];
_distance = _distance + _delta; _distance = _distance + _delta;

View File

@ -13,4 +13,4 @@
#include "script_component.hpp" #include "script_component.hpp"
ACE_player == gunner vehicle ACE_player ACE_player == gunner vehicle ACE_player
&& (count ((vehicle ACE_player) getVariable [QGVAR(Magazines), []]) > 1) && {count ((vehicle ACE_player) getVariable [QGVAR(Magazines), []]) > 1}

View File

@ -13,5 +13,5 @@
#include "script_component.hpp" #include "script_component.hpp"
ACE_player == gunner vehicle ACE_player ACE_player == gunner vehicle ACE_player
&& {getNumber (configFile >> "CfgVehicles" >> typeOf (vehicle ACE_player) >> QGVAR(Enabled)) == 1} && {getNumber (configFile >> "CfgVehicles" >> typeOf vehicle ACE_player >> QGVAR(Enabled)) == 1}
&& {cameraView == "GUNNER"} && {cameraView == "GUNNER"}

View File

@ -12,7 +12,7 @@
#include "script_component.hpp" #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", "_distance", "_magazines"];
_vehicle = _this select 0; _vehicle = _this select 0;
_distance = call FUNC(getRange); _distance = call FUNC(getRange);
@ -21,12 +21,14 @@ _magazines = magazines _vehicle;
if (_distance == 0) then { if (_distance == 0) then {
_distance = [ _distance = [
getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(DistanceInterval)), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(DistanceInterval)), // @todo turret
getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MaxDistance)), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MaxDistance)),
getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MinDistance)) getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MinDistance))
] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
}; };
private ["_weaponDirection", "_angleTarget"];
_weaponDirection = _vehicle weaponDirection currentWeapon _vehicle; _weaponDirection = _vehicle weaponDirection currentWeapon _vehicle;
_angleTarget = asin (_weaponDirection select 2); _angleTarget = asin (_weaponDirection select 2);
@ -38,6 +40,8 @@ if (!(isNil QGVAR(backgroundCalculation)) and {!(scriptDone GVAR(backgroundCalcu
terminate GVAR(backgroundCalculation); terminate GVAR(backgroundCalculation);
}; };
private "_movingAzimuth";
// MOVING TARGETS // MOVING TARGETS
_movingAzimuth = 0; _movingAzimuth = 0;
if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then {
@ -53,8 +57,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)) ((_posTarget select 2) - (GVAR(position) select 2)) / (time - GVAR(time))
]; ];
private ["_magazineType", "_ammoType", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep"];
// estimate time to target // estimate time to target
_magazineType = currentMagazine _vehicle; _magazineType = currentMagazine _vehicle; // @todo turret magazine
_ammoType = getText (configFile >> "CfgMagazines" >> _magazineType >> "ammo"); _ammoType = getText (configFile >> "CfgMagazines" >> _magazineType >> "ammo");
_initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazineType >> "initSpeed"); _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazineType >> "initSpeed");
_airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction");
@ -62,10 +68,13 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then {
_simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "simulationStep"); _simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "simulationStep");
if (_simulationStep != 0) then { if (_simulationStep != 0) then {
private ["_posX", "_velocityX", "_velocityY", "_timeToTarget"];
_posX = 0; _posX = 0;
_velocityX = _initSpeed; _velocityX = _initSpeed;
_velocityY = 0; _velocityY = 0;
_timeToTarget = 0; _timeToTarget = 0;
for "_i" from 1 to ((floor (_timeToLive / _simulationStep)) + 1) do { for "_i" from 1 to ((floor (_timeToLive / _simulationStep)) + 1) do {
_posX = _posX + _velocityX * _simulationStep; _posX = _posX + _velocityX * _simulationStep;
if (_posX >= _distance) exitWith { // bullet passed the target if (_posX >= _distance) exitWith { // bullet passed the target
@ -76,12 +85,15 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then {
_velocityY = _velocityY + _velocityY * _velocityMagnitude * _airFriction * _simulationStep - 9.81 * _simulationStep; _velocityY = _velocityY + _velocityY * _velocityMagnitude * _airFriction * _simulationStep - 9.81 * _simulationStep;
}; };
private ["_posArrival", "_dirArrival"];
// calculate offsets // calculate offsets
_posArrival = [ _posArrival = [
(_posTarget select 0) + (_velocityTarget select 0) * _timeToTarget, (_posTarget select 0) + (_velocityTarget select 0) * _timeToTarget,
(_posTarget select 1) + (_velocityTarget select 1) * _timeToTarget, (_posTarget select 1) + (_velocityTarget select 1) * _timeToTarget,
(_posTarget select 2) + (_velocityTarget select 2) * _timeToTarget (_posTarget select 2) + (_velocityTarget select 2) * _timeToTarget
]; ];
_dirArrival = [ _dirArrival = [
((_posArrival select 0) - (getPos _vehicle select 0)) / (_posArrival distance (getPos _vehicle)), ((_posArrival select 0) - (getPos _vehicle select 0)) / (_posArrival distance (getPos _vehicle)),
((_posArrival select 1) - (getPos _vehicle select 1)) / (_posArrival distance (getPos _vehicle)), ((_posArrival select 1) - (getPos _vehicle select 1)) / (_posArrival distance (getPos _vehicle)),
@ -96,9 +108,12 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then {
GVAR(enabled) = false; GVAR(enabled) = false;
GVAR(time) = -1; GVAR(time) = -1;
private ["_viewDiff", "_FCSAzimuth", "_FCSMagazines", "_FCSElevation"];
// CALCULATE AZIMUTH CORRECTION // CALCULATE AZIMUTH CORRECTION
_viewDiff = _vehicle getVariable QGVAR(ViewDiff); _viewDiff = _vehicle getVariable QGVAR(ViewDiff);
_FCSAzimuth = _movingAzimuth; _FCSAzimuth = _movingAzimuth;
if (_viewDiff != 0) then { if (_viewDiff != 0) then {
_FCSAzimuth = (atan (_distance / _viewDiff) - (abs _viewDiff / _viewDiff) * 90) + _movingAzimuth; _FCSAzimuth = (atan (_distance / _viewDiff) - (abs _viewDiff / _viewDiff) * 90) + _movingAzimuth;
}; };
@ -108,9 +123,14 @@ _FCSMagazines = [];
_FCSElevation = []; _FCSElevation = [];
{ {
private "_ammoType";
_ammoType = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); _ammoType = getText (configFile >> "CfgMagazines" >> _x >> "ammo");
if !(getText (configFile >> "CfgAmmo" >> _ammoType >> "simulation") == "shotMissile") then { if !(getText (configFile >> "CfgAmmo" >> _ammoType >> "simulation") == "shotMissile") then {
_maxElev = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret" >> "maxElev"); private ["_maxElev", "_initSpeed", "_airFriction", "_offset"];
_maxElev = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret" >> "maxElev"); // @todo turret
_initSpeed = getNumber (configFile >> "CfgMagazines" >> _x >> "initSpeed"); _initSpeed = getNumber (configFile >> "CfgMagazines" >> _x >> "initSpeed");
_airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction");

View File

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

View File

@ -12,25 +12,33 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; private "_vehicle";
if (getNumber (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> QGVAR(Enabled)) == 1) then { _vehicle = _this select 0;
(_this select 0) addEventHandler ["Fired", {_this call FUNC(firedEH)}];
(_this select 0) setVariable [QGVAR(Distance), 0, true]; if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(Enabled)) == 1) then { // @todo for all turrets
(_this select 0) setVariable [QGVAR(Magazines), [], true]; _vehicle addEventHandler ["Fired", {_this call FUNC(firedEH)}];
(_this select 0) setVariable [QGVAR(Elevation), [], true];
(_this select 0) setVariable [QGVAR(Azimuth), 0, true]; _vehicle setVariable [QGVAR(Distance), 0, true];
_vehicle setVariable [QGVAR(Magazines), [], true];
_vehicle setVariable [QGVAR(Elevation), [], true];
_vehicle setVariable [QGVAR(Azimuth), 0, true];
// calculate offset between gunner camera and muzzle position // calculate offset between gunner camera and muzzle position
if !((_this select 0) isKindOf "Air") then { if !(_vehicle isKindOf "Air") then {
_gunBeg = getText (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> "Turrets" >> "MainTurret" >> "gunBeg"); private ["_turretConfig", "_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"];
_gunnerView = getText (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> "Turrets" >> "MainTurret" >> "memoryPointGunnerOptics");
_gunBegPos = ((_this select 0) selectionPosition _gunBeg) select 0; _turretConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret";
_gunnerViewPos = ((_this select 0) selectionPosition _gunnerView) select 0;
_gunBeg = getText (_turretConfig >> "gunBeg"); // @todo player turret path
_gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); // @todo player turret path
_gunBegPos = (_vehicle selectionPosition _gunBeg) select 0;
_gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0;
_viewDiff = _gunBegPos - _gunnerViewPos; _viewDiff = _gunBegPos - _gunnerViewPos;
(_this select 0) setVariable [QGVAR(ViewDiff), _viewDiff, true];
_vehicle setVariable [QGVAR(ViewDiff), _viewDiff, true];
} else { } else {
(_this select 0) setVariable [QGVAR(ViewDiff), 0, true]; _vehicle setVariable [QGVAR(ViewDiff), 0, true];
}; };
}; };

View File

@ -0,0 +1,73 @@
["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;