diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..f6f23b8d1b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + diff --git a/TO_MERGE/cse/sys_misc/functions/fn_moduleAmbianceSoundLoop.sqf b/TO_MERGE/cse/sys_misc/functions/fn_moduleAmbianceSoundLoop.sqf deleted file mode 100644 index 4b4d93d453..0000000000 --- a/TO_MERGE/cse/sys_misc/functions/fn_moduleAmbianceSoundLoop.sqf +++ /dev/null @@ -1,98 +0,0 @@ -/** - * fn_moduleAmbianceSoundLoop.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -private ["_logic", "_units", "_activated","_ambianceSounds", "_soundFiles", "_minimalDistance","_maximalDistance", "_minimalDistance", "_maxDelayBetweenSounds", "_allUnits", "_newPos", "_targetUnit", "_soundToPlay", "_soundPath", "_unparsedSounds", "_list", "_splittedList", "_nilCheckPassedList"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; -_units = [_this,1,[],[[]]] call BIS_fnc_param; -_activated = [_this,2,true,[true]] call BIS_fnc_param; - -if (_activated && isServer) then { - _ambianceSounds = []; - _unparsedSounds = _logic getvariable ["soundFiles", ""]; - _minimalDistance = (_logic getvariable ["minimalDistance", 400]) max 1; - _maximalDistance = (_logic getvariable ["maximalDistance", 10]) max _minimalDistance; - _minDelayBetweensounds = (_logic getvariable ["minimalDelay", 10]) max 1; - _maxDelayBetweenSounds = (_logic getvariable ["maximalDelay", 170]) max _minDelayBetweensounds; - _volume = (_logic getvariable ["soundVolume", 30]) max 1; - _followPlayers = _logic getvariable ["followPlayers", false]; - - _splittedList = [_unparsedSounds, ","] call BIS_fnc_splitString; - - _nilCheckPassedList = ""; - { - _x = [_x] call cse_fnc_string_removeWhiteSpace; - _splittedList set [_foreachIndex, _x]; - }foreach _splittedList; - - _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; - { - if (isclass (missionConfigFile >> "CfgSounds" >> _x)) then { - _ambianceSounds pushback (_soundPath + (getArray(missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0)); - } else { - if (isclass (configFile >> "CfgSounds" >> _x)) then { - _ambianceSounds pushback ((getArray(configFile >> "CfgSounds" >> _x >> "sound") select 0)); - }; - }; - }foreach _splittedList; - - if (count _ambianceSounds == 0) exitwith { - [format["No Ambiance sounds available"]] call cse_fnc_debug; - }; - { - if !([".", _x, true] call BIS_fnc_inString) then { - [format["Ambiance soundfile does not contain a file extension %1", _x]] call cse_fnc_debug; - _ambianceSounds set [_foreachIndex, _x + ".wss"]; - }; - }foreach _ambianceSounds; - [format["Ambiance sounds %1", _ambianceSounds]] call cse_fnc_debug; - - while {alive _logic} do { - _allUnits = switch (true) do { - case isMultiplayer: {playableUnits}; - case isDedicated: {[_logic]}; - default {[player]}; - }; - - if (count _allUnits > 0) then { - _targetUnit = _allUnits select (round(random((count _allUnits)-1))); - - _newPos = (getPos _targetUnit); - if (!_followPlayers) then { - _newPos = getPos _logic; - }; - - if (random(1) >= 0.5) then { - if (random(1) >= 0.5) then { - _newPos set [0, (_newPos select 0) + (_minimalDistance + random(_maximalDistance))]; - } else { - _newPos set [0, (_newPos select 0) - (_minimalDistance + random(_maximalDistance))]; - }; - } else { - if (random(1) >= 0.5) then { - _newPos set [1, (_newPos select 1) + (_minimalDistance + random(_maximalDistance))]; - } else { - _newPos set [1, (_newPos select 1) - (_minimalDistance + random(_maximalDistance))]; - }; - }; - - if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then { - - _soundToPlay = _ambianceSounds select (round(random((count _ambianceSounds)-1))); - playSound3D [_soundToPlay, _targetUnit, false, _newPos, _volume, 1, 1000]; - - [format["Played a sound %1", _soundToPlay]] call cse_fnc_debug; - - sleep (_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds; - }; - }; - }; -}; - -true; \ No newline at end of file diff --git a/addons/aircraft/CfgMagazines.hpp b/addons/aircraft/CfgMagazines.hpp index 7328eda091..0c306f8f04 100644 --- a/addons/aircraft/CfgMagazines.hpp +++ b/addons/aircraft/CfgMagazines.hpp @@ -1,202 +1,15 @@ class CfgMagazines { + // shoot helper object to tripple rof class VehicleMagazine; - class 24Rnd_PG_missiles; - - class 12Rnd_PG_missiles: 24Rnd_PG_missiles { - count = 12; - displayName = "$STR_A3_CfgMagazines_12Rnd_PG_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_12Rnd_PG_missiles_dns"; - descriptionShort = "$STR_A3_CfgMagazines_12Rnd_PG_missiles1"; - }; - class 12Rnd_missiles: VehicleMagazine { - scope = 2; - count = 12; - ammo = "M_AT"; - displayName = "$STR_A3_CfgMagazines_24Rnd_PuG_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_24Rnd_PuG_missiles_dns"; - descriptionShort = "$STR_A3_CfgMagazines_24Rnd_PuG_missiles0"; - initSpeed = 44; - maxLeadSpeed = 800; - nameSound = "rockets"; - sound[] = {"A3\sounds_f\weapons\rockets\explosion_missile_01",1,1,1200}; - reloadSound[] = {"",0.000316228,1}; - }; - - //minigun magazines, muzzle velocities and tracercounts - class 200Rnd_65x39_Belt: VehicleMagazine {}; - class 2000Rnd_65x39_Belt: 200Rnd_65x39_Belt {}; - class 2000Rnd_65x39_Belt_Tracer_Red: 2000Rnd_65x39_Belt { - }; - class 2000Rnd_65x39_Belt_Green: 2000Rnd_65x39_Belt {}; - class 2000Rnd_65x39_Belt_Tracer_Green: 2000Rnd_65x39_Belt_Green { - tracersEvery = 1; - }; - class 2000Rnd_65x39_Belt_Yellow: 2000Rnd_65x39_Belt { - tracersEvery = 1; - }; - class 2000Rnd_65x39_Belt_Tracer_Yellow: 2000Rnd_65x39_Belt_Yellow { - tracersEvery = 1; - }; - - class 5000Rnd_762x51_Belt: 2000Rnd_65x39_Belt { - tracersEvery = 1; - count = 5000; - }; - class 5000Rnd_762x51_Yellow_Belt: 5000Rnd_762x51_Belt {}; - class 4000Rnd_762x51_M134 : 5000Rnd_762x51_Belt { - count = 4000; - tracersEvery = 1; - }; - class 2000Rnd_762x51_M134 : 4000Rnd_762x51_M134 { - count = 2000; - tracersEvery = 1; - }; - - class 2Rnd_AAA_missiles: VehicleMagazine { - scope = 2; - displayName = "$STR_A3_CfgMagazines_2Rnd_AAA_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_2Rnd_AAA_missiles_dns"; - ammo = "M_Air_AA"; - count = 2; - maxLeadSpeed = 950; - nameSound = "missiles"; - }; - class 2Rnd_AAA_missiles_MI02: 2Rnd_AAA_missiles { - ammo = "M_Air_AA_MI02"; - }; - class 4Rnd_AAA_missiles: 2Rnd_AAA_missiles { - displayName = "$STR_A3_CfgMagazines_4Rnd_AAA_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_4Rnd_AAA_missiles_dns"; - count = 4; - }; - class 4Rnd_AAA_missiles_MI02: 4Rnd_AAA_missiles { - ammo = "M_Air_AA_MI02"; - }; - - class 4Rnd_GAA_missiles: VehicleMagazine { - scope = 2; - displayName = "$STR_A3_CfgMagazines_4Rnd_GAA_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_4Rnd_GAA_missiles_dns"; - count = 4; - ammo = "M_Zephyr"; - maxLeadSpeed = 950; - nameSound = "missiles"; - }; - - class 300Rnd_20mm_shells: VehicleMagazine { - scope = 2; - displayName = "$STR_A3_CfgMagazines_300Rnd_20mm_shells0"; - displayNameShort = "$STR_A3_CfgMagazines_300Rnd_20mm_shells_dns"; - ammo = "B_20mm"; - count = 300; - deflecting = 3; - maxLeadSpeed = 300; - tracersEvery = 5; - nameSound = "cannon"; - }; - class 1000Rnd_Gatling_30mm_Plane_CAS_01_F: VehicleMagazine { - scope = 2; - displayNameShort = ""; ammo = "ACE_Gatling_30mm_HE_Plane_CAS_01_Deploy"; count = 1170; - //count = 390; - //initSpeed = 3852; - maxLeadSpeed = 300; - nameSound = "cannon"; - tracersEvery = 1; - }; - - class 2Rnd_Missile_AA_04_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_4RND_AAA_MISSILES_DNS"; - ammo = "Missile_AA_04_F"; - count = 2; - maxLeadSpeed = 220; - nameSound = "missiles"; - }; - class 6Rnd_Missile_AGM_02_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_38RND_80MM_ROCKETS_DNS"; - ammo = "Missile_AGM_02_F"; - count = 6; - maxLeadSpeed = 450; - nameSound = "missiles"; - }; - class 2Rnd_Missile_AGM_02_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_38RND_80MM_ROCKETS_DNS"; - ammo = "Missile_AGM_02_F"; - count = 2; - maxLeadSpeed = 450; - nameSound = "missiles"; - }; - - class 7Rnd_Rocket_04_HE_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_40RND_20MM_G_BELT_DNS"; - ammo = "Rocket_04_HE_F"; - count = 7; - maxLeadSpeed = 200; - nameSound = "rockets"; - }; - class 7Rnd_Rocket_04_AP_F: 7Rnd_Rocket_04_HE_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_TITAN_AP_DNS"; - ammo = "Rocket_04_AP_F"; - }; - - class 4Rnd_Bomb_04_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGVEHICLES_BOMB0"; - ammo = "Bomb_04_F"; - count = 4; - maxLeadSpeed = 1000; - nameSound = "cannon"; - }; - - class 500Rnd_Cannon_30mm_Plane_CAS_02_F: 1000Rnd_Gatling_30mm_Plane_CAS_01_F { - displayNameShort = ""; - ammo = "Cannon_30mm_HE_Plane_CAS_02_F"; - count = 500; - }; - - class 2Rnd_Missile_AA_03_F: 2Rnd_Missile_AA_04_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_4RND_AAA_MISSILES_DNS"; - ammo = "Missile_AA_03_F"; - count = 2; - }; - class 4Rnd_Missile_AGM_01_F: 6Rnd_Missile_AGM_02_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_38RND_80MM_ROCKETS_DNS"; - ammo = "Missile_AGM_01_F"; - count = 4; - }; - - class 20Rnd_Rocket_03_HE_F: 7Rnd_Rocket_04_HE_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_40RND_20MM_G_BELT_DNS"; - ammo = "Rocket_03_HE_F"; - count = 20; - }; - class 20Rnd_Rocket_03_AP_F: 7Rnd_Rocket_04_AP_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_TITAN_AP_DNS"; - ammo = "Rocket_03_AP_F"; - count = 20; - }; - - class 2Rnd_Bomb_03_F: 4Rnd_Bomb_04_F { - displayNameShort = "$STR_A3_CFGVEHICLES_BOMB0"; - ammo = "Bomb_03_F"; - count = 2; }; + // an extended magazine for the comanche + class 300Rnd_20mm_shells; class ACE_500Rnd_20mm_shells_Comanche: 300Rnd_20mm_shells { - displayName = "20mm"; - displayNameShort = "20mm"; - ammo = "B_20mm"; count = 500; - deflecting = 3; - initSpeed = 1030; - maxLeadSpeed = 300; - tracersEvery = 5; }; }; diff --git a/addons/aircraft/CfgVehicles.hpp b/addons/aircraft/CfgVehicles.hpp index bea27c85ff..5f419506c0 100644 --- a/addons/aircraft/CfgVehicles.hpp +++ b/addons/aircraft/CfgVehicles.hpp @@ -8,12 +8,9 @@ class CfgVehicles { class NewTurret { class Turrets; }; - class CargoTurret; }; - class Air: AllVehicles { - class AnimationSources; - }; + class Air: AllVehicles {}; class Helicopter: Air { class Turrets { @@ -33,6 +30,7 @@ class CfgVehicles { class Turrets: Turrets { class CopilotTurret; }; + class AnimationSources; }; class Helicopter_Base_H: Helicopter_Base_F { @@ -46,7 +44,7 @@ class CfgVehicles { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -60,11 +58,6 @@ class CfgVehicles { class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F { /*class Turrets: Turrets { class CopilotTurret: CopilotTurret {}; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; - class CargoTurret_03: CargoTurret_02 {}; - class CargoTurret_04: CargoTurret_01 {}; };*/ }; @@ -72,7 +65,7 @@ class CfgVehicles { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -86,7 +79,8 @@ class CfgVehicles { driverCanEject = 1; lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; - magazines[] = {"2000Rnd_762x51_Belt_T_Green", "12Rnd_PG_missiles", "168Rnd_CMFlare_Chaff_Magazine"}; + magazines[] = {"2000Rnd_762x51_Belt_T_Green","12Rnd_PG_missiles","168Rnd_CMFlare_Chaff_Magazine"}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -105,36 +99,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; - class AnimationSources: AnimationSources { - class HitGlass1 { - source = "Hit"; - hitpoint = "HitGlass1"; - raw = 1; - }; - class HitGlass2: HitGlass1 { - hitpoint = "HitGlass2"; - }; - class HitGlass3: HitGlass1 { - hitpoint = "HitGlass3"; - }; - class HitGlass4: HitGlass1 { - hitpoint = "HitGlass4"; - }; - class Gatling { - source = "revolving"; - weapon = "ACE_gatling_20mm_Comanche"; - }; - class Hide { - source = "user"; - animPeriod = 0; - initPhase = 0; - }; - class Muzzle_flash { - source = "ammorandom"; - weapon = "ACE_gatling_20mm_Comanche"; - }; - }; + class Turrets: Turrets { class MainTurret: MainTurret { canEject = 1; @@ -143,6 +108,15 @@ class CfgVehicles { magazines[] = {"ACE_500Rnd_20mm_shells_Comanche","4Rnd_AAA_missiles","24Rnd_PG_missiles"}; }; }; + + class AnimationSources: AnimationSources { + class Gatling { + weapon = "ACE_gatling_20mm_Comanche"; + }; + class Muzzle_flash { + weapon = "ACE_gatling_20mm_Comanche"; + }; + }; }; class B_Heli_Attack_01_F: Heli_Attack_01_base_F {}; @@ -151,6 +125,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class MainTurret: MainTurret { canEject = 1; @@ -162,6 +137,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -176,6 +152,7 @@ class CfgVehicles { canEject = 1; }; }; + /*class UserActions { class DoorL1_Open { available = 1; @@ -197,16 +174,14 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; showHMD = 1; }; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; + /*class UserActions: UserActions { class DoorL1_Open { available = 1; @@ -248,9 +223,9 @@ class CfgVehicles { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; weapons[] = {"M134_minigun","missiles_DAR","CMFlareLauncher"}; magazines[] = {"5000Rnd_762x51_Yellow_Belt","24Rnd_missiles","168Rnd_CMFlare_Chaff_Magazine"}; + class Turrets: Turrets { class MainTurret: MainTurret { canEject = 1; @@ -270,36 +245,37 @@ class CfgVehicles { class I_Heli_light_03_F: I_Heli_light_03_base_F { class Turrets: Turrets { class MainTurret: MainTurret {}; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; }; - class I_Heli_light_03_unarmed_base_F: I_Heli_light_03_base_F { - //class MFD {}; - }; + class I_Heli_light_03_unarmed_base_F: I_Heli_light_03_base_F {}; + class I_Heli_light_03_unarmed_F: I_Heli_light_03_unarmed_base_F {}; class Plane_CAS_01_base_F: Plane_Base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; - //class MFD {}; + class Turrets; + #include }; class Plane_CAS_02_base_F: Plane_Base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; + class Turrets; + #include }; class Plane_Fighter_03_base_F: Plane_Base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; + class Turrets; + #include }; @@ -310,34 +286,34 @@ class CfgVehicles { }; class UAV_02_base_F: UAV { + weapons[] = {}; + magazines[] = {}; + class Turrets { class MainTurret; }; - weapons[] = {}; - magazines[] = {}; }; class UAV_02_CAS_base_F: UAV_02_base_F { + weapons[] = {}; + magazines[] = {}; + /*class Turrets: Turrets { class MainTurret: MainTurret {}; };*/ - weapons[] = {}; - magazines[] = {}; }; class B_Heli_Transport_03_base_F: Helicopter_Base_H { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; }; //class MainTurret: MainTurret {}; class RightDoorGun: MainTurret {}; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; }; @@ -348,9 +324,6 @@ class CfgVehicles { }; //class MainTurret: MainTurret {}; //class RightDoorGun: MainTurret {}; - - //class CargoTurret_01: CargoTurret {}; - //class CargoTurret_02: CargoTurret_01 {}; }; }; @@ -358,6 +331,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -376,15 +350,6 @@ class CfgVehicles { class LoadmasterTurret: LoadmasterTurret { canEject = 1; }; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; - class CargoTurret_03: CargoTurret_01 {}; - class CargoTurret_04: CargoTurret_01 {}; - class CargoTurret_05: CargoTurret_01 {}; - class CargoTurret_06: CargoTurret_05 {}; - class CargoTurret_07: CargoTurret_05 {}; - class CargoTurret_08: CargoTurret_05 {}; }; }; @@ -396,9 +361,6 @@ class CfgVehicles { class LoadmasterTurret: LoadmasterTurret { canEject = 1; }; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; }; }; diff --git a/addons/aircraft/CfgWeapons.hpp b/addons/aircraft/CfgWeapons.hpp index 321df4a3af..c5f22fc3a2 100644 --- a/addons/aircraft/CfgWeapons.hpp +++ b/addons/aircraft/CfgWeapons.hpp @@ -4,15 +4,10 @@ class Mode_Burst; class Mode_FullAuto; class CfgWeapons { - class MGunCore; - class MGun: MGunCore {}; - - class LMG_RCWS: MGun {}; - // Manual Switching Of Flare Mode class SmokeLauncher; class CMFlareLauncher: SmokeLauncher { - modes[] = {"Single", "Burst", "AIBurst"}; + modes[] = {"Single","Burst","AIBurst"}; class Single: Mode_SemiAuto { reloadTime = 0.1; }; @@ -21,13 +16,15 @@ class CfgWeapons { }; }; + // bigger mag for comanche class CannonCore; class gatling_20mm: CannonCore { - magazines[] = {"2000Rnd_20mm_shells","1000Rnd_20mm_shells","300Rnd_20mm_shells","ACE_500Rnd_20mm_shells_Comanche"}; + magazines[] += {"ACE_500Rnd_20mm_shells_Comanche"}; + // buff gatling rof class manual: CannonCore { - reloadTime = 0.023; - dispersion = 0.006; + reloadTime = 0.023; //0.04; + dispersion = 0.006; //0.0022; }; class close: manual {}; class short: close {}; @@ -36,21 +33,14 @@ class CfgWeapons { }; class ACE_gatling_20mm_Comanche: gatling_20mm { - displayName = "XM301"; - class close: close { - reloadTime = 0.04; - dispersion = 0.0022; - }; - class far: far { - reloadTime = 0.04; - dispersion = 0.0022; - }; + displayName = "$STR_ACE_Aircraft_gatling_20mm_Name"; + class manual: manual { reloadTime = 0.04; dispersion = 0.0022; - displayName = "XM301"; + displayName = "$STR_ACE_Aircraft_gatling_20mm_Name"; }; - class medium: medium { + class close: close { reloadTime = 0.04; dispersion = 0.0022; }; @@ -58,38 +48,53 @@ class CfgWeapons { reloadTime = 0.04; dispersion = 0.0022; }; + class medium: medium { + reloadTime = 0.04; + dispersion = 0.0022; + }; + class far: far { + reloadTime = 0.04; + dispersion = 0.0022; + }; }; + // buff gatling rof + class MGunCore; + class MGun: MGunCore {}; + + class LMG_RCWS: MGun {}; + class LMG_Minigun: LMG_RCWS { - magazines[] = {"1000Rnd_65x39_Belt","1000Rnd_65x39_Belt_Green","1000Rnd_65x39_Belt_Tracer_Green","1000Rnd_65x39_Belt_Tracer_Red","1000Rnd_65x39_Belt_Tracer_Yellow","1000Rnd_65x39_Belt_Yellow","2000Rnd_65x39_Belt","2000Rnd_65x39_Belt_Green","2000Rnd_65x39_Belt_Tracer_Green","2000Rnd_65x39_Belt_Tracer_Green_Splash","2000Rnd_65x39_Belt_Tracer_Red","2000Rnd_65x39_Belt_Tracer_Yellow","2000Rnd_65x39_Belt_Tracer_Yellow_Splash","2000Rnd_65x39_Belt_Yellow","2000Rnd_762x51_Belt_T_Green","2000Rnd_762x51_Belt_T_Red","2000Rnd_762x51_Belt_T_Yellow","200Rnd_65x39_Belt","200Rnd_65x39_Belt_Tracer_Green","200Rnd_65x39_Belt_Tracer_Red","200Rnd_65x39_Belt_Tracer_Yellow","5000Rnd_762x51_Belt","5000Rnd_762x51_Yellow_Belt"}; class manual: MGun { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.075; //0.015; + dispersion = 0.00093; //0.006; }; class close: manual {}; class short: close {}; class medium: close {}; class far: close {}; }; + class LMG_Minigun_heli: LMG_Minigun { showAimCursorInternal = 0; class manual: manual { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.015; //0.033; Note: This is a way to fast ROF (requires over 60 FPS) @todo + dispersion = 0.006; //0.0087; }; class close: manual {}; class short: close {}; class medium: close {}; class far: close {}; }; + class M134_minigun: MGunCore { class LowROF: Mode_FullAuto { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.015; //0.03; same as above @todo + dispersion = 0.006; //0.0023; }; class HighROF: LowROF { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.015; //0.03; + dispersion = 0.006; //0.0023; }; class close: HighROF {}; class short: close {}; @@ -100,19 +105,10 @@ class CfgWeapons { class Gatling_30mm_Plane_CAS_01_F: CannonCore { autoFire = 1; burst = 1; - reloadTime = 0.0154; class LowROF: Mode_FullAuto { autoFire = 0; - //burst = 65; - burst = 22; - //reloadTime = 0.0154; - reloadTime = 0.0462; - //sound[] = {"A3\Sounds_F_epc\weapons\cas_02_cannon",1.77828,1,3800}; - sound[] = {"A3\Sounds_F_EPC\Weapons\gau_03_burst",2.51189,1,4500,{25704,32159}}; - weaponSoundEffect = "DefaultRifle"; - dispersion = 0.005; - soundContinuous = 1; - textureType = "burst"; + burst = 22; //65; + reloadTime = 0.0462; //0.0154; //0.034; multiplier = 3; }; class close: LowROF {}; @@ -121,120 +117,4 @@ class CfgWeapons { class medium: close {}; class far: close {}; }; - - class RocketPods; - class Missile_AA_04_Plane_CAS_01_F: RocketPods { - holdsterAnimValue = 2; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - autoFire = 0; - cursor = "EmptyCursor"; - cursorAim = "missile"; - nameSound = "MissileLauncher"; - textureType = "fullAuto"; - weaponLockDelay = 3; - minRange = 300; - minRangeProbab = 0.25; - midRange = 2500; - midRangeProbab = 0.9; - maxRange = 9000; - maxRangeProbab = 0.01; - }; - - class MissileLauncher; - class Missile_AGM_02_Plane_CAS_01_F: MissileLauncher { - holdsterAnimValue = 3; - magazineReloadTime = 30; - reloadTime = 0.001; - textureType = "semi"; - weaponLockDelay = 3; - weaponSoundEffect = "DefaultRifle"; - }; - - class Rocket_04_HE_Plane_CAS_01_F: RocketPods { - holdsterAnimValue = 4; - canLock = 1; - modes[] = {"Far_AI","Medium_AI","Close_AI","Burst"}; - weaponLockDelay = 0; - class Far_AI: RocketPods { - canLock = 1; - weaponLockDelay = 0; - showToPlayer = 0; - minRange = 800; - minRangeProbab = 0.31; - midRange = 2500; - midRangeProbab = 0.71; - maxRange = 3200; - maxRangeProbab = 0.1; - burst = 1; - reloadTime = 0.001; - autoFire = 0; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - }; - class Medium_AI: Far_AI {}; - class Close_AI: Far_AI {}; - class Burst: RocketPods { - burst = 1; - reloadTime = 0.002; - minRange = 300; - minRangeProbab = 0.25; - midRange = 400; - midRangeProbab = 0.7; - maxRange = 1300; - maxRangeProbab = 0.1; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - autoFire = 0; - soundContinuous = 0; - textureType = "fullAuto"; - weaponSoundEffect = "DefaultRifle"; - }; - }; - - class Rocket_04_AP_Plane_CAS_01_F: Rocket_04_HE_Plane_CAS_01_F { - holdsterAnimValue = 5; - }; - - class Bomb_04_Plane_CAS_01_F: RocketPods { - holdsterAnimValue = 6; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - missileLockCone = 180; - nameSound = ""; - textureType = "fullAuto"; - weaponLockDelay = 1; - }; - - class Cannon_30mm_Plane_CAS_02_F: CannonCore { - scope = 1; - holdsterAnimValue = 1; - ballisticsComputer = 2; - canLock = 1; - modes[] = {"LowROF","close","near","short","medium","far"}; - nameSound = "cannon"; - shotFromTurret = 0; - muzzlePos = "Cannon_muzzleflash"; - muzzleEnd = "Cannon_barrel_end"; - selectionFireAnim = "Cannon_muzzleflash"; - autoFire = 1; - burst = 5; - reloadTime = 0.04; - class GunParticles { - class Effect { - effectName = "MachineGun2"; - positionName = "Cannon_barrel_start"; - directionName = "Cannon_barrel_end"; - }; - }; - class LowROF: Mode_FullAuto { - dispersion = 0.0055; - reloadTime = 0.04; - }; - class close: LowROF {}; - class near: close {}; - class short: close {}; - class medium: close {}; - class far: close {}; - }; }; diff --git a/addons/aircraft/config.cpp b/addons/aircraft/config.cpp index 93e4eb8efe..86135c4bc9 100644 --- a/addons/aircraft/config.cpp +++ b/addons/aircraft/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"KoffeinFlummi","Crusty"}; + author[] = {"KoffeinFlummi","Crusty","commy2"}; authorUrl = "https://github.com/KoffeinFlummi/"; VERSION_CONFIG; }; diff --git a/addons/aircraft/config/config.cpp b/addons/aircraft/config/config.cpp deleted file mode 100644 index 7ac4cf3bad..0000000000 --- a/addons/aircraft/config/config.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "script_component.hpp" - -class CfgPatches { - class DOUBLES(ADDON,heli1) { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {QUOTE(ADDON)}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2/"; - VERSION_CONFIG; - }; -}; diff --git a/addons/aircraft/config/script_component.hpp b/addons/aircraft/config/script_component.hpp deleted file mode 100644 index 7368add67c..0000000000 --- a/addons/aircraft/config/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\aircraft\script_component.hpp" \ No newline at end of file diff --git a/addons/aircraft/stringtable.xml b/addons/aircraft/stringtable.xml index da013cac5e..4d1c49fff6 100644 --- a/addons/aircraft/stringtable.xml +++ b/addons/aircraft/stringtable.xml @@ -14,6 +14,18 @@ Rajada Raffica + + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + Open Cargo Door Laderampe öffnen @@ -35,4 +47,4 @@ Закрыть грузовой отсек - \ No newline at end of file + diff --git a/addons/attach/CfgEventHandlers.hpp b/addons/attach/CfgEventHandlers.hpp index 4c2b8b16ca..f0a9f14d91 100644 --- a/addons/attach/CfgEventHandlers.hpp +++ b/addons/attach/CfgEventHandlers.hpp @@ -1,5 +1,6 @@ + class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; -}; \ No newline at end of file +}; diff --git a/addons/attach/CfgMagazines.hpp b/addons/attach/CfgMagazines.hpp index 282d36b964..d63b8db36b 100644 --- a/addons/attach/CfgMagazines.hpp +++ b/addons/attach/CfgMagazines.hpp @@ -1,10 +1,12 @@ + class CfgMagazines { class CA_Magazine; class B_IR_Grenade: CA_Magazine { ACE_Attachable = 1; }; + class SmokeShell; class Chemlight_green: SmokeShell { ACE_Attachable = 1; }; -}; \ No newline at end of file +}; diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index bc1f52988a..1cd65127a6 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -1,7 +1,3 @@ -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; #define MACRO_ATTACHTOVEHICLE \ class ACE_Actions { \ @@ -32,16 +28,20 @@ class CfgVehicles { 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 @@ -83,19 +83,22 @@ class CfgVehicles { simulation = "nvmarker"; class NVGMarker { - diffuse[] = {0,0,0}; - ambient[] = {0,0,0}; - brightness = 0.004; + diffuse[] = {0.006, 0.006, 0.006, 1}; + ambient[] = {0.005, 0.005, 0.005, 1}; + brightness = 0.2; name = "pozicni blik"; - drawLight = 1; - drawLightSize = 0.005; + drawLightSize = 0.2; drawLightCenterSize = 0.003; activeLight = 0; blinking=1; + blinkingStartsOn=1; + blinkingPattern[] = {2,2}; + blinkingPatternGuarantee = false; dayLight = 0; onlyInNvg = 1; useFlare = 0; }; + side = 7;//-1=NO_SIDE yellow box,3=CIV grey box,4=NEUTRAL yellow box,6=FRIENDLY green box,7=LOGIC no radar signature accuracy = 1000; cost = 0; @@ -111,37 +114,36 @@ class CfgVehicles { }; 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) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; + class EAST_Box_Base; class Box_East_Support_F: EAST_Box_Base { class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; + class IND_Box_Base; class Box_IND_Support_F: IND_Box_Base { class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; + class FIA_Box_Base_F; class Box_FIA_Support_F: FIA_Box_Base_F { class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; class ACE_Box_Misc: Box_NATO_Support_F { class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; -}; \ No newline at end of file +}; diff --git a/addons/attach/CfgWeapons.hpp b/addons/attach/CfgWeapons.hpp index 8174f67b38..4ad34832c5 100644 --- a/addons/attach/CfgWeapons.hpp +++ b/addons/attach/CfgWeapons.hpp @@ -1,16 +1,19 @@ + class CfgWeapons { class ACE_ItemCore; class InventoryItem_Base_F; class ACE_IR_Strobe_Item: ACE_ItemCore { + ACE_attachable = 1; + author = "$STR_ACE_Common_ACETeam"; + scope = 2; displayName = "$STR_ACE_IrStrobe_Name"; descriptionShort = "$STR_ACE_IrStrobe_Description"; model = "\A3\weapons_F\ammo\mag_univ.p3d"; picture = PATHTOF(UI\irstrobe_item.paa); - scope = 2; - ACE_attachable = 1; + class ItemInfo: InventoryItem_Base_F { mass = 1; }; }; -}; \ No newline at end of file +}; diff --git a/addons/attach/config.cpp b/addons/attach/config.cpp index 9accc9f253..dd7e1add3b 100644 --- a/addons/attach/config.cpp +++ b/addons/attach/config.cpp @@ -5,17 +5,14 @@ class CfgPatches { units[] = {}; weapons[] = {"ACE_IR_Strobe_Item"}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common", "ace_interaction"}; - author[] = {"KoffeinFlummi", "eRazeri", "CAA-Picard"}; + requiredAddons[] = {"ace_interaction"}; + author[] = {"KoffeinFlummi","eRazeri","CAA-Picard"}; authorUrl = "https://github.com/KoffeinFlummi/"; VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" - -#include "CfgVehicles.hpp" - -#include "CfgWeapons.hpp" - #include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 9fd0cf7952..3aa06bacc2 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -20,31 +20,33 @@ PARAMS_3(_unit,_attachToVehicle,_itemName); //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");}; +if !([_unit, _attachToVehicle, _itemName] call FUNC(canAttach)) exitWith {ERROR("Tried to attach, but check failed");}; + +private ["_itemVehClass", "_onAtachText", "_selfAttachPosition"]; -_selfAttachPosition = [_unit, [-0.05,0,0.12], "rightshoulder"]; _itemVehClass = ""; _onAtachText = ""; +_selfAttachPosition = [_unit, [-0.05, 0, 0.12], "rightshoulder"]; -switch true do { -case (_itemName == "ACE_IR_Strobe_Item"): { +switch (true) do { + case (_itemName == "ACE_IR_Strobe_Item"): { _itemVehClass = "ACE_IR_Strobe_Effect"; _onAtachText = localize "STR_ACE_Attach_IrStrobe_Attached"; - _selfAttachPosition = [_unit,[0,-0.11,0.16],"pilot"]; //makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri + //_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"): { + case (_itemName == "B_IR_Grenade"): { _itemVehClass = "B_IRStrobe"; _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; }; -case (_itemName == "O_IR_Grenade"): { + case (_itemName == "O_IR_Grenade"): { _itemVehClass = "O_IRStrobe"; _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; }; -case (_itemName == "I_IR_Grenade"): { + 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"}): { + case (toLower _itemName in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]): { _itemVehClass = _itemName; _onAtachText = localize "STR_ACE_Attach_Chemlight_Attached"; }; @@ -57,8 +59,8 @@ if (_unit == _attachToVehicle) then { //Self Attachment _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]; + _attachToVehicle setVariable [QGVAR(Objects), [_attachedItem], true]; + _attachToVehicle setVariable [QGVAR(ItemNames), [_itemName], true]; } else { GVAR(setupObject) = _itemVehClass createVehicleLocal [0,0,-10000]; GVAR(setupObject) enableSimulationGlobal false; @@ -72,17 +74,17 @@ if (_unit == _attachToVehicle) then { //Self Attachment 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 { + 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; + }] call BIS_fnc_addStackedEventHandler; // @todo replace with CBA PFH //had to delay the mouseHint, not sure why [{[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint)}, [], 0, 0] call EFUNC(common,waitAndExecute); - _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) 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)]; + _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) && {!isNull (GVAR(setupObject))}}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; + _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) && {!isNull (GVAR(setupObject))}}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; }; diff --git a/addons/attach/functions/fnc_canAttach.sqf b/addons/attach/functions/fnc_canAttach.sqf index ac646ef700..1c33f7b112 100644 --- a/addons/attach/functions/fnc_canAttach.sqf +++ b/addons/attach/functions/fnc_canAttach.sqf @@ -19,7 +19,9 @@ PARAMS_3(_unit,_attachToVehicle,_item); -_attachLimit = if (_unit == _attachToVehicle) then {1} else {10}; -_attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; +private ["_attachLimit", "_attachedObjects"]; -canStand _unit && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_item in ((magazines _unit) + (items _unit) + [""])} +_attachLimit = [10, 1] select (_unit == _attachToVehicle); +_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; + +canStand _unit && {alive _attachToVehicle} && {count _attachedObjects < _attachLimit} && {_item in (itemsWithMagazines _unit + [""])} diff --git a/addons/attach/functions/fnc_canDetach.sqf b/addons/attach/functions/fnc_canDetach.sqf index d099d2035e..ad2f68776c 100644 --- a/addons/attach/functions/fnc_canDetach.sqf +++ b/addons/attach/functions/fnc_canDetach.sqf @@ -16,24 +16,25 @@ */ #include "script_component.hpp" -private ["_attachedObjects", "_inRange", "_unitPos", "_objectPos"]; - PARAMS_2(_unit,_attachToVehicle); -_attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; +private ["_attachedObjects", "_inRange"]; + +_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; _inRange = false; if (_unit == _attachToVehicle) then { - _inRange = (count _attachedObjects) > 0; + _inRange = count _attachedObjects > 0; } else { //Scan if unit is within range (using 2d distance) + private ["_unitPos", "_objectPos"]; _unitPos = getPos _unit; _unitPos set [2,0]; { _objectPos = getPos _x; _objectPos set [2, 0]; - if ((_objectPos distance _unitPos) < 4) exitWith {_inRange = true}; + if (_objectPos distance _unitPos < 4) exitWith {_inRange = true}; } forEach _attachedObjects; }; -(canStand _unit) && _inRange && {alive _attachToVehicle} +canStand _unit && {_inRange} && {alive _attachToVehicle} diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index b18cec09bd..8fb9e3cc9c 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -16,12 +16,14 @@ */ #include "script_component.hpp" -private ["_itemName", "_count", "_attachedItem", "_fnc_detachDelay"]; - PARAMS_2(_unit,_attachToVehicle); -_attachedObjectsArray = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; -_attachedItemsArray = _attachToVehicle getVariable ["ACE_AttachedItemNames", []]; +private ["_attachedObjects", "_attachedItems"]; + +_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; +_attachedItems = _attachToVehicle getVariable [QGVAR(ItemNames), []]; + +private ["_attachedObject", "_attachedIndex", "_itemName", "_minDistance", "_unitPos", "_objectPos"]; _attachedObject = objNull; _attachedIndex = -1; @@ -34,53 +36,51 @@ _unitPos set [2,0]; { _objectPos = getPos _x; _objectPos set [2, 0]; - if ((_objectPos distance _unitPos) < _minDistance) then { - _minDistance = (_objectPos distance _unitPos); + if (_objectPos distance _unitPos < _minDistance) then { + _minDistance = _objectPos distance _unitPos; _attachedObject = _x; - _itemName = _attachedItemsArray select _forEachIndex; + _itemName = _attachedItems select _forEachIndex; _attachedIndex = _forEachIndex; }; -} forEach _attachedObjectsArray; +} forEach _attachedObjects; // Check if unit has an attached item -if ((isNull _attachedObject) || {_itemName == ""}) exitWith {ERROR("Could not find attached object")}; +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 { +// Exit if can't add the item +if !(_unit canAdd _itemName) exitWith { [localize "STR_ACE_Attach_Inventory_Full"] call EFUNC(common,displayTextStructured); }; -if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") then { +// Add item to inventory +_unit addItem _itemName; + +if (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) then { // Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle detach _attachedObject; - _attachedObject setPos [getPos _unit select 0, getPos _unit select 1, ((getPos _unit select 2) - 1000)]; + _attachedObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]); // Delete attached item after 0.5 seconds - _fnc_detachDelay = { - deleteVehicle (_this select 0); - }; - [_fnc_detachDelay, [_attachedObject], 0.5, 0] call EFUNC(common,waitAndExecute); + [{deleteVehicle (_this select 0)}, [_attachedObject], 0.5, 0] call EFUNC(common,waitAndExecute); } else { // Delete attached item deleteVehicle _attachedObject; }; // Reset unit variables -_attachedObjectsArray deleteAt _attachedIndex; -_attachedItemsArray deleteAt _attachedIndex; -_attachToVehicle setVariable ["ACE_AttachedObjects", _attachedObjectsArray, true]; -_attachToVehicle setVariable ["ACE_AttachedItemNames", _attachedItemsArray, true]; +_attachedObjects deleteAt _attachedIndex; +_attachedItems deleteAt _attachedIndex; +_attachToVehicle setVariable [QGVAR(Objects), _attachedObjects, true]; +_attachToVehicle setVariable [QGVAR(ItemNames), _attachedItems, true]; // Display message -switch true do { -case (_itemName == "ACE_IR_Strobe_Item") : { +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") : { + case (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "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"}) : { + case (toLower _itemName in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]) : { [localize "STR_ACE_Attach_Chemlight_Detached"] call EFUNC(common,displayTextStructured); }; }; diff --git a/addons/attach/functions/fnc_openAttachUI.sqf b/addons/attach/functions/fnc_openAttachUI.sqf index 6521e43fbe..5533956bb6 100644 --- a/addons/attach/functions/fnc_openAttachUI.sqf +++ b/addons/attach/functions/fnc_openAttachUI.sqf @@ -55,13 +55,13 @@ _attachables = items _unit; } forEach _attachables; [ -_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)}; -} + _actions, + { + [ACE_player, GVAR(attachTarget), _this] call FUNC(attach); + call EFUNC(interaction,hideMenu); + }, + { + call EFUNC(interaction,hideMenu); + if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; + } ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index ceb48de9b5..c6277e2961 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -100,11 +100,11 @@ _attachedObject attachTo [_attachToVehicle, _endPosTestOffset]; _placer removeItem _itemClassname; //Add Object to ACE_AttachedObjects and ACE_AttachedItemNames -_currentObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; +_currentObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; _currentObjects pushBack _attachedObject; -_attachToVehicle setVariable ["ACE_AttachedObjects", _currentObjects, true]; -_currentItemNames = _attachToVehicle getVariable ["ACE_AttachedItemNames", []]; +_attachToVehicle setVariable [QGVAR(Objects), _currentObjects, true]; +_currentItemNames = _attachToVehicle getVariable [QGVAR(ItemNames), []]; _currentItemNames pushBack _itemClassname; -_attachToVehicle setVariable ["ACE_AttachedItemNames", _currentItemNames, true]; +_attachToVehicle setVariable [QGVAR(ItemNames), _currentItemNames, true]; [_placementText] call EFUNC(common,displayTextStructured); diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index 21577c55d3..13c468184b 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -176,4 +176,4 @@ Error en Acoplar - \ No newline at end of file + diff --git a/addons/backblast/$PBOPREFIX$ b/addons/backblast/$PBOPREFIX$ deleted file mode 100644 index c5ed230994..0000000000 --- a/addons/backblast/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\backblast \ No newline at end of file diff --git a/addons/backblast/CfgEventHandlers.hpp b/addons/backblast/CfgEventHandlers.hpp deleted file mode 100644 index a336a5dd41..0000000000 --- a/addons/backblast/CfgEventHandlers.hpp +++ /dev/null @@ -1,17 +0,0 @@ - -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit) ); - }; -}; - -class Extended_FiredNear_EventHandlers { - class CAManBase { - class GVAR(LauncherBackblast) { - FiredNear = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_Backblast_Damage') > 0}) then {_this call FUNC(launcherBackblast)} ); - }; - class GVAR(TankDangerZone) { - FiredNear = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_DangerZone_Damage') > 0}) then {_this call FUNC(tankDangerZone)} ); - }; - }; -}; diff --git a/addons/backblast/CfgWeapons.hpp b/addons/backblast/CfgWeapons.hpp deleted file mode 100644 index fcb4bde0c5..0000000000 --- a/addons/backblast/CfgWeapons.hpp +++ /dev/null @@ -1,44 +0,0 @@ -class CfgWeapons { - - class LauncherCore; - class Launcher: LauncherCore { - ACE_Backblast_Angle = 60; - ACE_Backblast_Range = 10; - ACE_Backblast_Damage = 0.7; - }; - class Launcher_Base_F: Launcher {}; - - class launch_Titan_base: Launcher_Base_F { - ACE_Backblast_Angle = 40; - ACE_Backblast_Range = 8; - ACE_Backblast_Damage = 0.5; - }; - class launch_Titan_short_base: launch_Titan_base { - ACE_Backblast_Angle = 40; - ACE_Backblast_Range = 8; - ACE_Backblast_Damage = 0.5; - }; - - class launch_NLAW_F: Launcher_Base_F { - ACE_Backblast_Angle = 40; - ACE_Backblast_Range = 5; - ACE_Backblast_Damage = 0.6; - }; - class launch_RPG32_F: Launcher_Base_F { - ACE_Backblast_Angle = 60; - ACE_Backblast_Range = 15; - ACE_Backblast_Damage = 0.7; - }; - - class CannonCore; - class cannon_120mm: CannonCore { - ACE_DangerZone_Angle = 90; - ACE_DangerZone_Range = 50; - ACE_DangerZone_Damage = 0.85; - }; - class mortar_155mm_AMOS: CannonCore { - ACE_DangerZone_Angle = 90; - ACE_DangerZone_Range = 60; - ACE_DangerZone_Damage = 1; - }; -}; diff --git a/addons/backblast/functions/fnc_getDistance.sqf b/addons/backblast/functions/fnc_getDistance.sqf deleted file mode 100644 index 83b290e2b0..0000000000 --- a/addons/backblast/functions/fnc_getDistance.sqf +++ /dev/null @@ -1,31 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_position", "_direction", "_maxDistance", "_distance", "_iteration", "_laser", "_line"]; - -_position = + _this select 0; -_direction = + _this select 1; -_maxDistance = _this select 2; - -_distance = _maxDistance; -_iteration = _distance; -_laser = []; -_line = [_position, _laser]; - -while { - _iteration > 0.1 -} do { - _iteration = _iteration / 2; - - _laser set [0, (_position select 0) - _distance * (_direction select 0)]; - _laser set [1, (_position select 1) - _distance * (_direction select 1)]; - _laser set [2, (_position select 2) - _distance * (_direction select 2)]; - - _intersections = { - _x isKindOf "Static" || {_x isKindOf "AllVehicles"} - } count (lineIntersectsWith _line); - - _distance = _distance + ([1, -1] select (_intersections > 0)) * _iteration; -}; - -if (_distance > _maxDistance) then {999} else {_distance} diff --git a/addons/backblast/functions/fnc_launcherBackblast.sqf b/addons/backblast/functions/fnc_launcherBackblast.sqf deleted file mode 100644 index b2cde50c5d..0000000000 --- a/addons/backblast/functions/fnc_launcherBackblast.sqf +++ /dev/null @@ -1,72 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -_unit = _this select 0; -_firer = _this select 1; -_distance = _this select 2; -_weapon = _this select 3; - -if (vehicle _unit != _unit || {!([_firer] call EFUNC(common,isPlayer))}) exitWith {}; - -_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Angle") / 2; -_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Range"); -_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Damage"); - -_position = eyePos _firer; -_direction = _firer weaponDirection currentWeapon _firer; - -if (_unit == _firer) then { - _distance = [_position, _direction, _backblastRange] call FUNC(getDistance); - hint format ["%1", _distance]; - if (_distance < _backblastRange) then { - _alpha = sqrt (1 - _distance / _backblastRange); - _beta = sqrt 0.5; - - _damage = 2 * _alpha * _beta * _backblastDamage; - [_damage * 100] call BIS_fnc_bloodEffect; - - // TODO: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - } else { - _unit setDamage (damage _unit + _damage); - }; - - }; -} else { - _direction = [0, 0, 0] vectorDiff _direction; - - _azimuth = (_direction select 0) atan2 (_direction select 1); - _inclination = asin (_direction select 2); - - _relativePosition = eyePos _unit; - _relativeDirection = _relativePosition vectorDiff _position; - - _relativeAzimuth = (_relativeDirection select 0) atan2 (_relativeDirection select 1); - _relativeInclination = asin (_relativeDirection select 2); - - _angle = sqrt ((_relativeAzimuth - _azimuth) ^ 2 + (_relativeInclination - _inclination) ^ 2); - _distance = vectorMagnitude _relativeDirection; - - _line = [_position, _relativePosition]; - - if (_angle < _backblastAngle && {_distance < _backblastRange} && {!lineIntersects _line} && {!terrainIntersectASL _line}) then { - _alpha = sqrt (1 - _distance / _backblastRange); - _beta = sqrt (1 - _angle / _backblastAngle); - - _damage = 2 * _alpha * _beta * _backblastDamage; - if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; - - // TODO: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - _unit spawn { - sleep 0.5; - [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); - }; - } else { - _unit setDamage (damage _unit + _damage); - }; - - }; -}; diff --git a/addons/backblast/functions/fnc_tankDangerZone.sqf b/addons/backblast/functions/fnc_tankDangerZone.sqf deleted file mode 100644 index 0371ec9620..0000000000 --- a/addons/backblast/functions/fnc_tankDangerZone.sqf +++ /dev/null @@ -1,54 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -#define BARREL_MUZZLE "usti hlavne" - -_unit = _this select 0; -_vehicle = vehicle (_this select 1); -_distance = _this select 2; -_weapon = _this select 3; - -if (vehicle _unit != _unit || {!([gunner _firer] call EFUNC(common,isPlayer))}) exitWith {}; - -_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Angle") / 2; -_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Range"); -_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Damage"); - -_position = ATLToASL (_vehicle modelToWorld (_vehicle selectionPosition BARREL_MUZZLE)); -_direction = _vehicle weaponDirection _weapon; - -if (_unit != _vehicle) then { - _azimuth = (_direction select 0) atan2 (_direction select 1); - _inclination = asin (_direction select 2); - - _relativePosition = eyePos _unit; - _relativeDirection = _relativePosition vectorDiff _position; - - _relativeAzimuth = (_relativeDirection select 0) atan2 (_relativeDirection select 1); - _relativeInclination = asin (_relativeDirection select 2); - - _angle = sqrt ((_relativeAzimuth - _azimuth) ^ 2 + (_relativeInclination - _inclination) ^ 2); - _distance = vectorMagnitude _relativeDirection; - - _line = [_position, _relativePosition]; - - if (_angle < _dangerZoneAngle && {_distance < _dangerZoneRange} && {!lineIntersects (_line + [_vehicle])} && {!terrainIntersectASL _line}) then { - _alpha = sqrt (1 - _distance / _dangerZoneRange); - _beta = sqrt (1 - _angle / _dangerZoneAngle); - - _damage = 2 * _alpha * _beta * _dangerZoneDamage; - if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; - - // TODO: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - _unit spawn { - sleep 0.5; - [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); - }; - } else { - _unit setDamage (damage _unit + _damage); - }; - - }; -}; diff --git a/addons/backblast/functions/script_component.hpp b/addons/backblast/functions/script_component.hpp deleted file mode 100644 index 817131570f..0000000000 --- a/addons/backblast/functions/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\backblast\script_component.hpp" \ No newline at end of file diff --git a/addons/backblast/script_component.hpp b/addons/backblast/script_component.hpp deleted file mode 100644 index 9f2a71f2d5..0000000000 --- a/addons/backblast/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT backblast -#include "\z\ace\Addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_BACKBLAST - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_BACKBLAST - #define DEBUG_SETTINGS DEBUG_SETTINGS_BACKBLAST -#endif - -#include "\z\ace\Addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf index e6a5a0e568..56065a43fc 100644 --- a/addons/captives/functions/fnc_canStopEscorting.sqf +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -19,22 +19,10 @@ PARAMS_1(_unit); DEFAULT_PARAM(1,_target,objNull); -private ["_isAttached"]; - if (isNull _target) then { _target = _unit getVariable [QGVAR(escortedUnit), objNull]; }; -if (isNull _target) exitWith { - ERROR("Null Target (no ACE_escortedUnit)"); - false -}; +if (isNull _target) exitWith {false}; -_isAttached = _target in (attachedObjects _unit); - -if (_isAttached && (!(_target getVariable [QGVAR(isHandcuffed), false]))) exitWith { - ERROR("Attached But Not Captive"); - false -}; - -_isAttached +(_target in (attachedObjects _unit)) && {_target getVariable [QGVAR(isHandcuffed), false]} diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index b9c5d7e4ce..522df03d4f 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -38,7 +38,7 @@ class Extended_Respawn_EventHandlers { respawn = QUOTE(_this call FUNC(setName)); }; class GVAR(RESETDefaults) { - respawn = QUOTE(_this call FUNC(resetAllDefaults_F)); + respawn = QUOTE(_this call FUNC(resetAllDefaults)); }; }; }; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 079d0cf686..62fbd7404f 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -15,13 +15,17 @@ PREP(addSetting); PREP(adminKick); PREP(ambientBrightness); PREP(applyForceWalkStatus); +PREP(beingCarried); PREP(binarizeNumber); PREP(blurScreen); PREP(callCustomEventHandlers); PREP(callCustomEventHandlersGlobal); PREP(canGetInPosition); +PREP(canInteract); PREP(canInteractWith); PREP(canUseWeapon); +PREP(carriedByObj); +PREP(carryObj); PREP(changeProjectileDirection); PREP(checkPBOs); PREP(claim); @@ -31,6 +35,10 @@ PREP(codeToString); PREP(convertKeyCode); PREP(createOrthonormalReference); PREP(currentChannel); +PREP(debug); +PREP(debugModule); +PREP(defineVariable); +PREP(disableAI); PREP(disableUserInput); PREP(displayIcon); PREP(displayText); @@ -44,12 +52,21 @@ PREP(execRemoteFnc); PREP(executePersistent); PREP(filter); PREP(fixLoweredRifleAnimation); +PREP(getAllDefinedSetVariables); PREP(getAllGear); PREP(getCaptivityStatus); +PREP(getCarriedBy); +PREP(getCarriedObj); PREP(getConfigCommander); PREP(getConfigGunner); +PREP(getDeathAnim); PREP(getDefaultAnim); +PREP(getDefinedVariable); +PREP(getDefinedVariableDefault); +PREP(getDefinedVariableInfo); PREP(getDoorTurrets); +PREP(getFirstObjectIntersection); +PREP(getFirstTerrainIntersection); PREP(getForceWalkStatus); PREP(getGunner); PREP(getHitPoints); @@ -58,6 +75,7 @@ PREP(getInPosition); PREP(getMarkerType); PREP(getName); PREP(getNumberFromMissionSQM); +PREP(getNumberMagazinesIn); PREP(getPitchBankYaw); PREP(getSettingData); PREP(getStringFromMissionSQM); @@ -76,29 +94,43 @@ PREP(getUavControlPosition); PREP(getVehicleCargo); PREP(getVehicleCodriver); PREP(getVehicleCrew); +PREP(getVersion); PREP(getWeaponAzimuthAndInclination); PREP(getWeaponIndex); PREP(getWeaponType); PREP(getWindDirection); PREP(goKneeling); PREP(hadamardProduct); +PREP(hasItem); +PREP(hasMagazine); +PREP(inheritsFrom); +PREP(insertionSort); PREP(interpolateFromArray); PREP(inTransitionAnim); +PREP(inWater); +PREP(isArrested); PREP(isAutoWind); +PREP(isAwake); PREP(isEngineer); PREP(isEOD); PREP(isInBuilding); +PREP(isModLoaded); PREP(isPlayer); PREP(isTurnedOut); PREP(letterToCode); +PREP(limitMovementSpeed); +PREP(loadPerson); +PREP(loadPersonLocal); PREP(loadSettingsFromProfile); PREP(loadSettingsOnServer); PREP(map); PREP(moduleCheckPBOs); PREP(moduleLSDVehicles); +PREP(moveToTempGroup); PREP(muteUnit); PREP(numberToDigits); PREP(numberToDigitsString); +PREP(onAnswerRequest); PREP(onLoadRscDisplayChannel); PREP(owned); PREP(player); @@ -106,33 +138,53 @@ PREP(playerSide); PREP(progressBar); PREP(queueAnimation); PREP(readSettingFromModule); +PREP(receiveRequest); PREP(removeActionEventHandler); PREP(removeActionMenuEventHandler); PREP(removeCameraEventHandler); PREP(removeCustomEventHandler); PREP(removeMapMarkerCreatedEventHandler); PREP(removeScrollWheelEventHandler); +PREP(requestCallback); +PREP(resetAllDefaults); PREP(restoreVariablesJIP); PREP(revertKeyCodeLocalized); PREP(sanitizeString); +PREP(sendRequest); PREP(serverLog); +PREP(setArrestState); +PREP(setCanInteract); PREP(setCaptivityStatus); +PREP(setCarriedBy); +PREP(setDefinedVariable); +PREP(setDisableUserInputStatus); PREP(setForceWalkStatus); +PREP(setHearingCapability); PREP(setName); PREP(setParameter); PREP(setPitchBankYaw); -PREP(setVariableJIP); -PREP(setVariablePublic); +PREP(setProne); PREP(setSetting); PREP(setSettingFromConfig); +PREP(setVariableJIP); +PREP(setVariablePublic); +PREP(setVolume); +PREP(sortAlphabeticallyBy); +PREP(stringCompare); PREP(stringToColoredText); +PREP(stringRemoveWhiteSpace); PREP(subString); +PREP(switchToGroupSide); +PREP(throttledPublicVariable); PREP(toBin); PREP(toBitmask); PREP(toHex); PREP(toNumber); -PREP(throttledPublicVariable); +PREP(uniqueElementsOnly); +PREP(unloadPerson); PREP(unmuteUnit); +PREP(useItem); +PREP(useMagazine); PREP(waitAndExecute); // ACE_Debug @@ -197,74 +249,6 @@ if (hasInterface) then { }, 0, []] call cba_fnc_addPerFrameHandler; }; -PREP(stringCompare); -PREP(string_removeWhiteSpace); -PREP(isHC); -PREP(sendRequest_f); -PREP(requestCallback); -PREP(receiveRequest); -PREP(onAnswerRequest); -PREP(debug); -PREP(debugModule); -PREP(defineVariable); -PREP(setDefinedVariable); -PREP(getDefinedVariable); -PREP(getAllDefinedSetVariables); -PREP(getDefinedVariableInfo); -PREP(getDefinedVariableDefault); -PREP(getDeathAnim); -PREP(insertionSort); -PREP(uniqueElementsOnly); -PREP(sortAlphabeticallyBy); -PREP(hasMagazine); -PREP(useMagazine); -PREP(findMagazine); -PREP(hasItem); -PREP(useItem); -PREP(findItem); -PREP(getNumberMagazinesIn); -PREP(setCanInteract); -PREP(getCanInteract); -PREP(canInteract); -PREP(resetAllDefaults_f); -PREP(broadcastSound3D_f); - -PREP(isAwake); -PREP(setProne); - -PREP(setDisableUserInputStatus); - -PREP(dropWeapon_f); -PREP(inWater_f); -PREP(setVolume_f); -PREP(closeAllDialogs_f); -PREP(disableAI_f); -PREP(switchToGroupSide_f); -PREP(getFirstObjectIntersection); -PREP(getFirstTerrainIntersection); -PREP(setHearingCapability); -PREP(revealObject_f); -PREP(getWeaponItems_f); -PREP(isModLoaded_f); -PREP(inheritsFrom); -PREP(getVersion); -PREP(carryObj); -PREP(carriedByObj); -PREP(getCarriedObj); -PREP(getCarriedBy); -PREP(beingCarried); -PREP(setCarriedBy); - - -PREP(moveToTempGroup); - - -PREP(limitMovementSpeed); -PREP(setArrestState); -PREP(isArrested); -PREP(loadPerson_F); -PREP(loadPersonLocal_F); -PREP(unloadPerson_F); - - ADDON = true; + +isHC = !(hasInterface || isDedicated); diff --git a/addons/common/functions/fnc_broadcastSound3D_f.sqf b/addons/common/functions/fnc_broadcastSound3D_f.sqf deleted file mode 100644 index 93f95bb431..0000000000 --- a/addons/common/functions/fnc_broadcastSound3D_f.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/** - * fn_broadcastSound3D_f.sqf - * @Descr: Plays a sound in 3D - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, sound STRING] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -if (isDedicated) exitwith{}; -_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; -_sound = [_this, 1, "",[""]] call BIS_fnc_Param; -_unit say3D _sound; \ No newline at end of file diff --git a/addons/common/functions/fnc_closeAllDialogs_f.sqf b/addons/common/functions/fnc_closeAllDialogs_f.sqf deleted file mode 100644 index b5ce1bc280..0000000000 --- a/addons/common/functions/fnc_closeAllDialogs_f.sqf +++ /dev/null @@ -1,14 +0,0 @@ -/** - * fn_closeAllDialogs_f.sqf - * @Descr: Close all dialogs - * @Author: Glowbal - * - * @Arguments: [] - * @Return: void - * @PublicAPI: true - */ -#include "script_component.hpp" - -while {dialog} do { - closeDialog 0; -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_disableAI_f.sqf b/addons/common/functions/fnc_disableAI.sqf similarity index 100% rename from addons/common/functions/fnc_disableAI_f.sqf rename to addons/common/functions/fnc_disableAI.sqf diff --git a/addons/common/functions/fnc_dropWeapon_f.sqf b/addons/common/functions/fnc_dropWeapon_f.sqf deleted file mode 100644 index bf1358b5e7..0000000000 --- a/addons/common/functions/fnc_dropWeapon_f.sqf +++ /dev/null @@ -1,39 +0,0 @@ -/** - * fn_dropWeapon_f.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" -private ["_unit","_currentWeapon","_currentAnimation", "_WeaponHolder"]; -_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; - -_currentWeapon = currentWeapon _unit; -_currentAnimation = animationState _unit; -_WeaponHolder = "GroundWeaponHolder" createVehicle position _unit; - -_unit removeWeapon _currentWeapon; -_weaponHolder addWeaponCargoGlobal [_currentWeapon, 1]; -//_unit action [ "DropWeapon", _WeaponHolder, _currentWeapon ]; -_WeaponHolder setPos (getPos _unit); -//_unit switchMove _currentAnimation; - -_primairyWeapon = primaryWeapon _unit; -_secondairyWeapon = secondaryWeapon _unit; -_handGunWeapon = handgunWeapon _unit; - -switch (_currentWeapon) do { - case _primairyWeapon: { - - }; - case _secondairyWeapon: { - - }; - case _handGunWeapon: { - - }; - default {}; -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_endRadioTransmission.sqf b/addons/common/functions/fnc_endRadioTransmission.sqf index 990d4e03d8..772a34a06b 100644 --- a/addons/common/functions/fnc_endRadioTransmission.sqf +++ b/addons/common/functions/fnc_endRadioTransmission.sqf @@ -14,17 +14,17 @@ // ACRE if (isClass (configFile >> "CfgPatches" >> "acre_main")) then { - [-1] call acre_core_fnc_handleMultiPttKeyPressUp; - [0] call acre_core_fnc_handleMultiPttKeyPressUp; - [1] call acre_core_fnc_handleMultiPttKeyPressUp; - [2] call acre_core_fnc_handleMultiPttKeyPressUp; + [-1] call acre_core_fnc_handleMultiPttKeyPressUp; + [0] call acre_core_fnc_handleMultiPttKeyPressUp; + [1] call acre_core_fnc_handleMultiPttKeyPressUp; + [2] call acre_core_fnc_handleMultiPttKeyPressUp; }; // TFAR if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then { - call TFAR_fnc_onSwTangentReleased; - call TFAR_fnc_onAdditionalSwTangentReleased; - call TFAR_fnc_onLRTangentReleased; - call TFAR_fnc_onAdditionalLRTangentReleased; - call TFAR_fnc_onDDTangentReleased; + call TFAR_fnc_onSwTangentReleased; + call TFAR_fnc_onAdditionalSwTangentReleased; + call TFAR_fnc_onLRTangentReleased; + call TFAR_fnc_onAdditionalLRTangentReleased; + call TFAR_fnc_onDDTangentReleased; }; diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf index 10c88d6bca..c298785c26 100644 --- a/addons/common/functions/fnc_exportConfig.sqf +++ b/addons/common/functions/fnc_exportConfig.sqf @@ -1,8 +1,8 @@ // by commy2 /* - usage: + usage: - (configFile >> "CfgAmmo") call FUNC(exportConfig); + (configFile >> "CfgAmmo") call FUNC(exportConfig); */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_findItem.sqf b/addons/common/functions/fnc_findItem.sqf deleted file mode 100644 index 5c4469ea7f..0000000000 --- a/addons/common/functions/fnc_findItem.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/** - * fn_findItem.sqf - * @Descr: - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: true - */ -#include "script_component.hpp" -private ["_unit","_magazine","_return"]; -_unit = _this select 0; -_item = _this select 1; - -if (_item in (uniformItems _unit)) exitwith {1}; -if (_item in (vestItems _unit)) exitwith {2}; -if (_item in (backpackItems _unit)) exitwith {3}; -if (_item in (assignedItems _unit)) exitwith {4}; -if (_item in (primaryWeaponItems _unit)) exitwith {5}; -if (_item in (secondaryWeaponItems _unit)) exitwith {6}; -if (_item in (handgunItems _unit)) exitwith {7}; -if (_item in (items _unit)) exitwith {8}; // in case it is in items but cannot be found in any other container (should never reach this) - -// If we cannot find the item, return 0. -0; \ No newline at end of file diff --git a/addons/common/functions/fnc_findMagazine.sqf b/addons/common/functions/fnc_findMagazine.sqf deleted file mode 100644 index 549d016e8d..0000000000 --- a/addons/common/functions/fnc_findMagazine.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/** - * fn_findMagazine.sqf - * @Descr: Find where the current magazines are. Order: uniform, vest, backpack, any. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, magazine STRING (Classname of magazine)] - * @Return: NUMBER 0 = none, 1 = in uniform, 2 = in vest, 3 = in backpack, 4 = found outside container - * @PublicAPI: true - */ -#include "script_component.hpp" -private ["_unit","_magazine"]; -_unit = _this select 0; -_magazine = _this select 1; - -if (_magazine in (getMagazineCargo uniformContainer _unit)) exitwith {1}; -if (_magazine in (getMagazineCargo vestContainer _unit)) exitwith {2}; -if (_magazine in (getMagazineCargo backpackContainer _unit)) exitwith {3}; -if (_magazine in (magazines _unit)) exitwith {4}; // in case it cannot be found in any other container. Most likely loaded in a weapon. - -// If we cannot find the item, return 0. -0; \ No newline at end of file diff --git a/addons/common/functions/fnc_getCanInteract.sqf b/addons/common/functions/fnc_getCanInteract.sqf deleted file mode 100644 index 87f572b93d..0000000000 --- a/addons/common/functions/fnc_getCanInteract.sqf +++ /dev/null @@ -1,12 +0,0 @@ -/** - * fn_getCanInteract.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" - -((_this select 0) getvariable [QGVAR(canInteract),0]) \ No newline at end of file diff --git a/addons/common/functions/fnc_getCustomResults_f.sqf b/addons/common/functions/fnc_getCustomResults_f.sqf deleted file mode 100644 index 4b68f85c9c..0000000000 --- a/addons/common/functions/fnc_getCustomResults_f.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/** - * fn_getCustomResults_f.sqf - * @Descr: Executes custom results eventhandlers, collects their output and returns this. - * @Author: Glowbal - * - * @Arguments: [arguments ANY, handle STRING] - * @Return: ARRAY Collection of all return values of all executed CustomResult handlers - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_arguments","_handle","_ehCfg","_eventHandlerCollection","_eventHandlerName","_cfg","_code","_classType", "_return"]; -_arguments = _this select 0; -_handle = _this select 1; - -_eventHandlerName = ("ace_f_custom_results_eventhandler_" + _handle); -_eventHandlerCollection = missionNamespace getvariable _eventHandlerName; -if (isnil "_eventHandlerCollection") then { - _eventHandlerCollection = []; - - // TODO Get a replacement for this - _cfg = (ConfigFile >> "Advanced_Combat_Environment" >> "CustomResults" >> _handle); - if (isClass _cfg) then { - _numberOfEH = count _cfg; - for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do { - _ehCfg = _cfg select _EHiterator; - if (isClass _ehCfg) then { - _classType = (ConfigName _ehCfg); - _code = (compile getText(_ehCfg >> "onCall")); - _eventHandlerCollection pushback [_classType, _code]; - true; - }; - }; - }; - missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection]; -}; - -_return = []; -{ - _return pushback (_arguments call (_x select 1)); - false; -}count _eventHandlerCollection; - -_return diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf index 0c82066e4b..71191083e0 100644 --- a/addons/common/functions/fnc_getGunner.sqf +++ b/addons/common/functions/fnc_getGunner.sqf @@ -20,9 +20,9 @@ private "_gunner"; _gunner = objNull; { - if (_weapon in (_vehicle weaponsTurret _x)) exitWith { - _gunner = _vehicle turretUnit _x; - }; + if (_weapon in (_vehicle weaponsTurret _x)) exitWith { + _gunner = _vehicle turretUnit _x; + }; } forEach allTurrets _vehicle; _gunner diff --git a/addons/common/functions/fnc_getHitPoints.sqf b/addons/common/functions/fnc_getHitPoints.sqf index a6d75e41b9..26b0b1b840 100644 --- a/addons/common/functions/fnc_getHitPoints.sqf +++ b/addons/common/functions/fnc_getHitPoints.sqf @@ -23,33 +23,33 @@ _hitpoints = []; private "_hitpointClasses"; _hitpointClasses = [_config >> "HitPoints"]; { - private "_class"; - _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; + private "_class"; + _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; - if (isClass _class) then { - _hitpointClasses pushBack _class; - }; + if (isClass _class) then { + _hitpointClasses pushBack _class; + }; } forEach allTurrets _vehicle; // iterate through all classes with hitpoints and their parents { - private "_class"; - _class = _x; + private "_class"; + _class = _x; - while {isClass _class} do { + while {isClass _class} do { - for "_i" from 0 to (count _class - 1) do { - private "_entry"; - _entry = configName (_class select _i); + for "_i" from 0 to (count _class - 1) do { + private "_entry"; + _entry = configName (_class select _i); - if (!(_entry in _hitpoints) && {!isNil {_vehicle getHitPointDamage _entry}}) then { - _hitpoints pushBack _entry; - }; - }; + if (!(_entry in _hitpoints) && {!isNil {_vehicle getHitPointDamage _entry}}) then { + _hitpoints pushBack _entry; + }; + }; - _class = inheritsFrom _class; - }; + _class = inheritsFrom _class; + }; } forEach _hitpointClasses; diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf index e9a7a8fac5..f0c9801382 100644 --- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf +++ b/addons/common/functions/fnc_getHitPointsWithSelections.sqf @@ -24,36 +24,36 @@ _selections = []; private "_hitpointClasses"; _hitpointClasses = [_config >> "HitPoints"]; { - private "_class"; - _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; + private "_class"; + _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; - if (isClass _class) then { - _hitpointClasses pushBack _class; - }; + if (isClass _class) then { + _hitpointClasses pushBack _class; + }; } forEach allTurrets _vehicle; // iterate through all classes with hitpoints and their parents { - private "_class"; - _class = _x; + private "_class"; + _class = _x; - while {isClass _class} do { + while {isClass _class} do { - for "_i" from 0 to (count _class - 1) do { - private ["_entry", "_selection"]; + for "_i" from 0 to (count _class - 1) do { + private ["_entry", "_selection"]; - _entry = configName (_class select _i); - _selection = getText (_class select _i >> "name"); + _entry = configName (_class select _i); + _selection = getText (_class select _i >> "name"); - if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { - _hitpoints pushBack _entry; - _selections pushBack _selection; - }; - }; + if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { + _hitpoints pushBack _entry; + _selections pushBack _selection; + }; + }; - _class = inheritsFrom _class; - }; + _class = inheritsFrom _class; + }; } forEach _hitpointClasses; diff --git a/addons/common/functions/fnc_getWeaponItems_f.sqf b/addons/common/functions/fnc_getWeaponItems_f.sqf deleted file mode 100644 index d18ce28a72..0000000000 --- a/addons/common/functions/fnc_getWeaponItems_f.sqf +++ /dev/null @@ -1,14 +0,0 @@ -/** - * fn_getWeaponItems_f.sqf - * @Descr: Get the weapon items from the unit. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" -private "_unit"; -_unit = _this select 0; - -[primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit]; \ No newline at end of file diff --git a/addons/common/functions/fnc_hashGet.sqf b/addons/common/functions/fnc_hashGet.sqf index 6147d06a73..7682b2f6a2 100644 --- a/addons/common/functions/fnc_hashGet.sqf +++ b/addons/common/functions/fnc_hashGet.sqf @@ -9,18 +9,18 @@ _key = _this select 1; ERRORDATA(2); _val = nil; try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index != -1) then { - _val = (_hash select 1) select _index; - if(IS_STRING(_val) && {_val == "ACREHASHREMOVEDONOTUSETHISVAL"}) then { - _val = nil; - }; - }; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index != -1) then { + _val = (_hash select 1) select _index; + if(IS_STRING(_val) && {_val == "ACREHASHREMOVEDONOTUSETHISVAL"}) then { + _val = nil; + }; + }; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; _val diff --git a/addons/common/functions/fnc_hashHasKey.sqf b/addons/common/functions/fnc_hashHasKey.sqf index d69ad2f3e8..8011e987fb 100644 --- a/addons/common/functions/fnc_hashHasKey.sqf +++ b/addons/common/functions/fnc_hashHasKey.sqf @@ -9,15 +9,15 @@ _key = _this select 1; ERRORDATA(2); _val = false; try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index != -1) then { - _val = true; - }; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index != -1) then { + _val = true; + }; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; _val diff --git a/addons/common/functions/fnc_hashListCreateHash.sqf b/addons/common/functions/fnc_hashListCreateHash.sqf index fef9c79b85..cdad5987cd 100644 --- a/addons/common/functions/fnc_hashListCreateHash.sqf +++ b/addons/common/functions/fnc_hashListCreateHash.sqf @@ -7,12 +7,12 @@ _hashList = _this select 0; ERRORDATA(1); _hashKeys = []; try { - if(VALIDHASH(_hashList)) then { - _hashKeys = (_hashList select 0); - } else { - ERROR("Input hashlist is not valid"); - }; + if(VALIDHASH(_hashList)) then { + _hashKeys = (_hashList select 0); + } else { + ERROR("Input hashlist is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; [_hashKeys, []]; diff --git a/addons/common/functions/fnc_hashListPush.sqf b/addons/common/functions/fnc_hashListPush.sqf index e783f7c324..afd092a1b9 100644 --- a/addons/common/functions/fnc_hashListPush.sqf +++ b/addons/common/functions/fnc_hashListPush.sqf @@ -7,11 +7,11 @@ _hashList = _this select 0; _value = _this select 1; ERRORDATA(2); try { - if(VALIDHASH(_hashList)) then { - [_hashList, (count (_hashList select 1)), _value] call FUNC(hashListSet); - } else { - ERROR("Input hashlist in push not valid"); - }; + if(VALIDHASH(_hashList)) then { + [_hashList, (count (_hashList select 1)), _value] call FUNC(hashListSet); + } else { + ERROR("Input hashlist in push not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; diff --git a/addons/common/functions/fnc_hashListSelect.sqf b/addons/common/functions/fnc_hashListSelect.sqf index e1ee0aae0f..0c552d072e 100644 --- a/addons/common/functions/fnc_hashListSelect.sqf +++ b/addons/common/functions/fnc_hashListSelect.sqf @@ -8,20 +8,20 @@ _index = _this select 1; ERRORDATA(2); _hash = nil; try { - if(VALIDHASH(_hashList)) then { - _keys = _hashList select 0; - _hashes = _hashList select 1; - if(_index < (count _hashes)) then { - _values = _hashes select _index; + if(VALIDHASH(_hashList)) then { + _keys = _hashList select 0; + _hashes = _hashList select 1; + if(_index < (count _hashes)) then { + _values = _hashes select _index; - _hash = [_keys, _values, 1]; - } else { - ERROR("Index of hashlist is out of range"); - }; - } else { - ERROR("Input hashlist is not valid"); - }; + _hash = [_keys, _values, 1]; + } else { + ERROR("Index of hashlist is out of range"); + }; + } else { + ERROR("Input hashlist is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; _hash; diff --git a/addons/common/functions/fnc_hashListSet.sqf b/addons/common/functions/fnc_hashListSet.sqf index 8b7239dffd..c384bc15c9 100644 --- a/addons/common/functions/fnc_hashListSet.sqf +++ b/addons/common/functions/fnc_hashListSet.sqf @@ -8,17 +8,17 @@ _index = _this select 1; _value = _this select 2; ERRORDATA(3); try { - if(VALIDHASH(_hashList)) then { - if(VALIDHASH(_value)) then { - _vals = _value select 1; - - (_hashList select 1) set[_index, _vals]; - } else { - ERROR("Set hash in hashlist is not valid"); - }; - } else { - ERROR("Input hashlist is not valid"); - }; + if(VALIDHASH(_hashList)) then { + if(VALIDHASH(_value)) then { + _vals = _value select 1; + + (_hashList select 1) set[_index, _vals]; + } else { + ERROR("Set hash in hashlist is not valid"); + }; + } else { + ERROR("Input hashlist is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; diff --git a/addons/common/functions/fnc_hashRem.sqf b/addons/common/functions/fnc_hashRem.sqf index 86898fb3df..000dbbefe0 100644 --- a/addons/common/functions/fnc_hashRem.sqf +++ b/addons/common/functions/fnc_hashRem.sqf @@ -8,23 +8,23 @@ _key = _this select 1; ERRORDATA(2); _val = nil; try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index != -1) then { - (_hash select 1) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; - // is this hash is not part of a hash list? - // if it is we need to leave the keys intact. - if((count _hash) == 2) then { - // if this is a standalone hash then we can clean it up - (_hash select 0) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; - _hash set[0, ((_hash select 0) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; - _hash set[1, ((_hash select 1) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; - }; - }; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index != -1) then { + (_hash select 1) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; + // is this hash is not part of a hash list? + // if it is we need to leave the keys intact. + if((count _hash) == 2) then { + // if this is a standalone hash then we can clean it up + (_hash select 0) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; + _hash set[0, ((_hash select 0) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; + _hash set[1, ((_hash select 1) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; + }; + }; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; true diff --git a/addons/common/functions/fnc_hashSet.sqf b/addons/common/functions/fnc_hashSet.sqf index 23438eaf83..0e374d5f12 100644 --- a/addons/common/functions/fnc_hashSet.sqf +++ b/addons/common/functions/fnc_hashSet.sqf @@ -9,19 +9,19 @@ _key = _this select 1; _val = _this select 2; ERRORDATA(3); try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index == -1) then { - _index = (_hash select 0) find "ACREHASHREMOVEDONOTUSETHISVAL"; - if(_index == -1) then { - _index = (count (_hash select 0)); - }; - (_hash select 0) set[_index, _key]; - }; - (_hash select 1) set[_index, _val]; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index == -1) then { + _index = (_hash select 0) find "ACREHASHREMOVEDONOTUSETHISVAL"; + if(_index == -1) then { + _index = (count (_hash select 0)); + }; + (_hash select 0) set[_index, _key]; + }; + (_hash select 1) set[_index, _val]; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; diff --git a/addons/common/functions/fnc_inWater_f.sqf b/addons/common/functions/fnc_inWater.sqf similarity index 100% rename from addons/common/functions/fnc_inWater_f.sqf rename to addons/common/functions/fnc_inWater.sqf diff --git a/addons/common/functions/fnc_isHC.sqf b/addons/common/functions/fnc_isHC.sqf deleted file mode 100644 index 82a9d49ba2..0000000000 --- a/addons/common/functions/fnc_isHC.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/** - * fn_isHC.sqf - * @Descr: Check if current locality is a headless client - * @Author: Glowbal - * - * @Arguments: [] - * @Return: BOOL True if locality is headless client OR is not in multiplayer - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_return"]; - -if (!isMultiplayer) then { - _return = true; -} else { - if (isServer && !isDedicated) then { - _return = true; - } else { - _return = !(hasInterface || isDedicated); - }; -}; -_return \ No newline at end of file diff --git a/addons/common/functions/fnc_isModLoaded_f.sqf b/addons/common/functions/fnc_isModLoaded.sqf similarity index 100% rename from addons/common/functions/fnc_isModLoaded_f.sqf rename to addons/common/functions/fnc_isModLoaded.sqf diff --git a/addons/common/functions/fnc_loadPerson_f.sqf b/addons/common/functions/fnc_loadPerson.sqf similarity index 86% rename from addons/common/functions/fnc_loadPerson_f.sqf rename to addons/common/functions/fnc_loadPerson.sqf index 5944879c62..0d2995db1b 100644 --- a/addons/common/functions/fnc_loadPerson_f.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -10,7 +10,7 @@ #include "script_component.hpp" -#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F)) +#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) private ["_caller", "_unit","_vehicle", "_loadcar", "_loadhelicopter", "_loadtank"]; _caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; @@ -34,9 +34,9 @@ if (_unit distance _loadcar <= 10) then { }; }; if (!isNull _vehicle) then { - [_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f); + [_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide); [_caller,objNull] call FUNC(carryObj); [_unit,objNull] call FUNC(carryObj); - [[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal_F)), _unit, false] call EFUNC(common,execRemoteFnc); + [[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal)), _unit, false] call EFUNC(common,execRemoteFnc); }; _vehicle \ No newline at end of file diff --git a/addons/common/functions/fnc_loadPersonLocal_f.sqf b/addons/common/functions/fnc_loadPersonLocal.sqf similarity index 83% rename from addons/common/functions/fnc_loadPersonLocal_f.sqf rename to addons/common/functions/fnc_loadPersonLocal.sqf index dbba09111a..6e31050cf9 100644 --- a/addons/common/functions/fnc_loadPersonLocal_f.sqf +++ b/addons/common/functions/fnc_loadPersonLocal.sqf @@ -16,13 +16,13 @@ _vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param; _caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param; if (!alive _unit) then { - _unit = [_unit,_caller] call FUNC(makeCopyOfBody_F); + _unit = [_unit,_caller] call FUNC(makeCopyOfBody); }; _unit moveInCargo _vehicle; -_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]]; +_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; _loaded pushback _unit; -_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true]; +_vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; if (!([_unit] call FUNC(isAwake))) then { _handle = [_unit,_vehicle] spawn { private ["_unit","_vehicle"]; diff --git a/addons/common/functions/fnc_moveToTempGroup.sqf b/addons/common/functions/fnc_moveToTempGroup.sqf index b146e67ef3..802bc2285d 100644 --- a/addons/common/functions/fnc_moveToTempGroup.sqf +++ b/addons/common/functions/fnc_moveToTempGroup.sqf @@ -18,12 +18,12 @@ if (_moveTo) then { _previousGroup = group _unit; _newGroup = createGroup (side _previousGroup); [_unit] joinSilent _newGroup; - _unit setvariable [QGVAR(previousGroup_F),_previousGroup]; + _unit setvariable [QGVAR(previousGroup),_previousGroup]; } else { - _previousGroup = _unit getvariable QGVAR(previousGroup_F); + _previousGroup = _unit getvariable QGVAR(previousGroup); if (!isnil "_previousGroup") then { _currentGroup = group _unit; - _unit setvariable [QGVAR(previousGroup_F),nil]; + _unit setvariable [QGVAR(previousGroup),nil]; [_unit] joinSilent _previousGroup; if (count units _currentGroup == 0) then { deleteGroup _currentGroup; diff --git a/addons/common/functions/fnc_queueAnimation.sqf b/addons/common/functions/fnc_queueAnimation.sqf index a489a46174..73f3dca109 100644 --- a/addons/common/functions/fnc_queueAnimation.sqf +++ b/addons/common/functions/fnc_queueAnimation.sqf @@ -4,7 +4,7 @@ terminate (missionNamespace getVariable [QGVAR(waitForAnimationHandle), scriptNull]); GVAR(waitForAnimationHandle) = _this spawn { - waitUntil {!([_this select 0] call FUNC(inTransitionAnim))}; + waitUntil {!([_this select 0] call FUNC(inTransitionAnim))}; - _this call FUNC(doAnimation); + _this call FUNC(doAnimation); }; diff --git a/addons/common/functions/fnc_resetAllDefaults_f.sqf b/addons/common/functions/fnc_resetAllDefaults.sqf similarity index 74% rename from addons/common/functions/fnc_resetAllDefaults_f.sqf rename to addons/common/functions/fnc_resetAllDefaults.sqf index c415b5b32c..63e6764d01 100644 --- a/addons/common/functions/fnc_resetAllDefaults_f.sqf +++ b/addons/common/functions/fnc_resetAllDefaults.sqf @@ -17,17 +17,17 @@ _unit setvariable ["ACE_isDead",nil,true]; _unit setvariable ["ACE_isUnconscious", nil, true]; if (isPlayer _unit) then { - [true] call FUNC(setVolume_f); - [false] call FUNC(disableKeyInput_f); - if (["ace_medical"] call FUNC(isModLoader_f)) then { + [true] call FUNC(setVolume); + [false] call FUNC(disableKeyInput); + if (["ace_medical"] call FUNC(isModLoader)) then { [false] call EFUNC(medical,effectBlackOut); }; - if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then { + if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { // clear all disable user input { [_X, false] call FUNC(setDisableUserInputStatus); - }foreach GVAR(DISABLE_USER_INPUT_COLLECTION_F); + }foreach GVAR(DISABLE_USER_INPUT_COLLECTION); }; }; diff --git a/addons/common/functions/fnc_revealObject_f.sqf b/addons/common/functions/fnc_revealObject_f.sqf deleted file mode 100644 index 9c5a34f59a..0000000000 --- a/addons/common/functions/fnc_revealObject_f.sqf +++ /dev/null @@ -1,15 +0,0 @@ -/** - * fnc_revealObject_f.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -if (hasInterface) then { - player reveal (_this select 0); -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_sendRequest_f.sqf b/addons/common/functions/fnc_sendRequest.sqf similarity index 100% rename from addons/common/functions/fnc_sendRequest_f.sqf rename to addons/common/functions/fnc_sendRequest.sqf diff --git a/addons/common/functions/fnc_setDisableUserInputStatus.sqf b/addons/common/functions/fnc_setDisableUserInputStatus.sqf index 2451cbe90f..2cf25b827a 100644 --- a/addons/common/functions/fnc_setDisableUserInputStatus.sqf +++ b/addons/common/functions/fnc_setDisableUserInputStatus.sqf @@ -13,16 +13,16 @@ _id = _this select 0; _disable = _this select 1; -if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then { - GVAR(DISABLE_USER_INPUT_COLLECTION_F) = []; +if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { + GVAR(DISABLE_USER_INPUT_COLLECTION) = []; }; if (_disable) then { - GVAR(DISABLE_USER_INPUT_COLLECTION_F) pushback _id; + GVAR(DISABLE_USER_INPUT_COLLECTION) pushback _id; [true] call FUNC(disableUserInput); } else { - GVAR(DISABLE_USER_INPUT_COLLECTION_F) = GVAR(DISABLE_USER_INPUT_COLLECTION_F) - [_id]; - if (GVAR(DISABLE_USER_INPUT_COLLECTION_F) isEqualTo []) then { + GVAR(DISABLE_USER_INPUT_COLLECTION) = GVAR(DISABLE_USER_INPUT_COLLECTION) - [_id]; + if (GVAR(DISABLE_USER_INPUT_COLLECTION) isEqualTo []) then { [false] call FUNC(disableUserInput); }; }; \ No newline at end of file diff --git a/addons/common/functions/fnc_setVolume_f.sqf b/addons/common/functions/fnc_setVolume.sqf similarity index 100% rename from addons/common/functions/fnc_setVolume_f.sqf rename to addons/common/functions/fnc_setVolume.sqf diff --git a/addons/common/functions/fnc_string_removeWhiteSpace.sqf b/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf similarity index 100% rename from addons/common/functions/fnc_string_removeWhiteSpace.sqf rename to addons/common/functions/fnc_stringRemoveWhiteSpace.sqf diff --git a/addons/common/functions/fnc_switchToGroupSide_f.sqf b/addons/common/functions/fnc_switchToGroupSide.sqf similarity index 92% rename from addons/common/functions/fnc_switchToGroupSide_f.sqf rename to addons/common/functions/fnc_switchToGroupSide.sqf index 97b043adbe..528d32853c 100644 --- a/addons/common/functions/fnc_switchToGroupSide_f.sqf +++ b/addons/common/functions/fnc_switchToGroupSide.sqf @@ -16,7 +16,7 @@ _switch = [_this, 1, false,[false]] call BIS_fnc_Param; _id = [_this, 2, "", [""]] call BIS_fnc_Param; _side = [_this, 3, side _unit,[west]] call BIS_fnc_Param; -_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo_F),[]]; +_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo),[]]; if (_switch) then { // go forward _previousGroup = group _unit; @@ -30,7 +30,7 @@ if (_switch) then { [_unit] joinSilent _newGroup; _previousGroupsList pushback [_previousGroup, _originalSide, _id, true]; - _unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true]; + _unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; } else { // go one back { @@ -60,5 +60,5 @@ if (_switch) then { }foreach _previousGroupsList; _previousGroupsList = _previousGroupsList - [objNull]; reverse _previousGroupsList; // we have to reverse again, to ensure the list is in the right order. - _unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true]; + _unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; }; diff --git a/addons/common/functions/fnc_unloadPerson_f.sqf b/addons/common/functions/fnc_unloadPerson.sqf similarity index 89% rename from addons/common/functions/fnc_unloadPerson_f.sqf rename to addons/common/functions/fnc_unloadPerson.sqf index 1aaaee84a1..33c0e9c0c2 100644 --- a/addons/common/functions/fnc_unloadPerson_f.sqf +++ b/addons/common/functions/fnc_unloadPerson.sqf @@ -10,7 +10,7 @@ #include "script_component.hpp" -#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F)) +#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) private ["_caller", "_unit","_vehicle", "_loaded"]; _caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; @@ -27,11 +27,11 @@ if (!alive _unit) then { _unit action ["Eject", vehicle _unit]; }; -[_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f); +[_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide); -_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]]; +_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; _loaded = _loaded - [_unit]; -_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true]; +_vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; if (!([_unit] call FUNC(isAwake))) then { _handle = [_unit,_vehicle] spawn { diff --git a/addons/explosives/CfgACE_Triggers.hpp b/addons/explosives/CfgACE_Triggers.hpp index 1b686d6092..789786bb4f 100644 --- a/addons/explosives/CfgACE_Triggers.hpp +++ b/addons/explosives/CfgACE_Triggers.hpp @@ -24,6 +24,12 @@ class CfgACE_Triggers { picture = PATHTOF(Data\UI\DeadmanSwitch.paa); requires[] = {"ACE_DeadManSwitch"}; }; + class Cellphone:Command { + displayName = $STR_ACE_Explosives_cellphone_displayName; + picture = PATHTOF(Data\UI\Cellphone_UI.paa); + onPlace = QUOTE(_this call FUNC(addCellphoneIED);false); + requires[] = {"ACE_Cellphone"}; + }; class PressurePlate { displayName = $STR_ACE_Explosives_PressurePlate; picture = PATHTOF(Data\UI\PressurePlate.paa); diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index 7cc1c8a8bd..51c85e607f 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -95,4 +95,33 @@ class CfgMagazines { }; }; }; + + class IEDUrbanBig_Remote_Mag: DemoCharge_Remote_Mag { + ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanBig"; + class ACE_Triggers { + SupportedTriggers[] = {"Command","DeadmanSwitch", "Cellphone"}; + class Command { + FuseTime = 0.5; + }; + class DeadmanSwitch:Command{}; + class Cellphone:Command{}; + }; + }; + class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag{ + ACE_SetupObject = "ACE_Explosives_Place_IEDLandBig"; + }; + class IEDUrbanSmall_Remote_Mag: DemoCharge_Remote_Mag { + ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanSmall"; + class ACE_Triggers { + SupportedTriggers[] = {"Command","DeadmanSwitch", "Cellphone"}; + class Command { + FuseTime = 0.5; + }; + class DeadmanSwitch:Command{}; + class Cellphone:Command{}; + }; + }; + class IEDLandSmall_Remote_Mag: IEDUrbanSmall_Remote_Mag { + ACE_SetupObject = "ACE_Explosives_Place_IEDLandSmall"; + }; }; diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 73477ddce5..983bc0972a 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -49,6 +49,15 @@ class CfgVehicles { priority = 0.8; hotkey = "F"; }; + class ACE_Cellphone { + displayName = $STR_ACE_Explosives_cellphone_displayName; + condition = "('ACE_Cellphone' in (items ace_player))"; + statement = "closeDialog 0;createDialog 'Rsc_ACE_PhoneInterface';"; + exceptions[] = {"ACE_Interaction_isNotSwimming"}; + showDisabled = 0; + icon = PATHTOF(Data\UI\Cellphone_UI.paa); + priority = 0.8; + }; }; }; }; @@ -105,6 +114,27 @@ class CfgVehicles { model = "\A3\Weapons_F\Explosives\mine_SLAM_directional"; }; + // IEDs + class ACE_Explosives_Place_IEDUrbanBig:ACE_Explosives_Place { + displayName = "IED Urban Big"; + model = "\A3\Weapons_F\Explosives\IED_urban_big"; + }; + + class ACE_Explosives_Place_IEDLandBig:ACE_Explosives_Place { + displayName = "IED Land Big"; + model = "\A3\Weapons_F\Explosives\IED_land_big"; + }; + + class ACE_Explosives_Place_IEDUrbanSmall:ACE_Explosives_Place { + displayName = "IED Urban Small"; + model = "\A3\Weapons_F\Explosives\IED_urban_small"; + }; + + class ACE_Explosives_Place_IEDLandSmall:ACE_Explosives_Place { + displayName = "IED Land Small"; + model = "\A3\Weapons_F\Explosives\IED_land_small"; + }; + class NATO_Box_Base; class EAST_Box_Base; class IND_Box_Base; @@ -133,6 +163,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_M26_Clacker,6) MACRO_ADDITEM(ACE_DefusalKit,12) MACRO_ADDITEM(ACE_Deadmanswitch,2) + MACRO_ADDITEM(ACE_Cellphone,3) }; }; @@ -142,6 +173,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_M26_Clacker,2) MACRO_ADDITEM(ACE_DefusalKit,2) MACRO_ADDITEM(ACE_Deadmanswitch,1) + MACRO_ADDITEM(ACE_Cellphone,2) }; }; @@ -151,6 +183,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_M26_Clacker,6) MACRO_ADDITEM(ACE_DefusalKit,12) MACRO_ADDITEM(ACE_Deadmanswitch,6) + MACRO_ADDITEM(ACE_Cellphone,10) }; }; diff --git a/addons/explosives/CfgWeapons.hpp b/addons/explosives/CfgWeapons.hpp index e239ed8841..fd142019e8 100644 --- a/addons/explosives/CfgWeapons.hpp +++ b/addons/explosives/CfgWeapons.hpp @@ -47,6 +47,20 @@ class CfgWeapons { ACE_Range = 100; ACE_Detonator = 1; + class ItemInfo: ACE_ExplosiveItem { + mass = 2; + uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; + }; + }; + class ACE_Cellphone: ACE_ItemCore { + scope = 2; + displayName = $STR_ACE_Explosives_cellphone_displayName; + descriptionShort = $STR_ACE_Explosives_cellphone_description; + picture = PATHTOF(Data\UI\Cellphone_UI.paa); + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + ACE_Range = 15000; + ACE_Detonator = 1; + class ItemInfo: ACE_ExplosiveItem { mass = 2; uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; diff --git a/addons/explosives/Data/Audio/Cellphone_Ring.wss b/addons/explosives/Data/Audio/Cellphone_Ring.wss new file mode 100644 index 0000000000..bafdf7596a Binary files /dev/null and b/addons/explosives/Data/Audio/Cellphone_Ring.wss differ diff --git a/addons/explosives/Data/Audio/DialTone.wss b/addons/explosives/Data/Audio/DialTone.wss new file mode 100644 index 0000000000..4ac52b1acf Binary files /dev/null and b/addons/explosives/Data/Audio/DialTone.wss differ diff --git a/addons/explosives/Data/UI/Cellphone_Background.paa b/addons/explosives/Data/UI/Cellphone_Background.paa new file mode 100644 index 0000000000..9cafe97af8 Binary files /dev/null and b/addons/explosives/Data/UI/Cellphone_Background.paa differ diff --git a/addons/explosives/Data/UI/Cellphone_UI.paa b/addons/explosives/Data/UI/Cellphone_UI.paa new file mode 100644 index 0000000000..38360ee4da Binary files /dev/null and b/addons/explosives/Data/UI/Cellphone_UI.paa differ diff --git a/addons/explosives/ExplosivesUI.hpp b/addons/explosives/ExplosivesUI.hpp index c6c76e573c..769b3dc167 100644 --- a/addons/explosives/ExplosivesUI.hpp +++ b/addons/explosives/ExplosivesUI.hpp @@ -4,16 +4,49 @@ #define GUI_GRID_H (0.04) #define ST_CENTER 0x02 +#define X_OFFSET 0.25 class RscText; class RscButton; - -#define X_OFFSET 0.25 - class RscXSliderH; class IGUIBack; +class RscPicture; +class RscEdit; -class Rsc_ACE_Timer_Slider:RscXSliderH{ +class Rsc_ACE_CallScreen_Edit:RscEdit { + canModify = 1; + colorBackground[] = {0,0,0,1}; + colorText[] = {0,0,0,1}; + colorDisabled[] = {1,1,1,0.25}; + colorSelection[] = { + "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])", + "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])", + "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", + 1 + }; + text = ""; + style = "0x00 + 0x40 + 0x200"; + shadow = 1; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) * 1)"; + x = 0.288594 * safezoneW + safezoneX; + w = 0.0825 * safezoneW; + h = 0.044 * safezoneH; +}; +class Rsc_ACE_HiddenButton:RscButton { + colorText[] = {0, 0, 0, 0}; + colorDisabled[] = {0, 0, 0, 0}; + colorBackground[] = {0, 0, 0, 0}; + colorBackgroundDisabled[] = {0, 0, 0, 0}; + colorBackgroundActive[] = {0, 0, 0, 0}; + colorFocused[] = {0, 0, 0, 0}; + colorShadow[] = {0, 0, 0, 0}; + colorBorder[] = {0, 0, 0, 0}; + w = 0.095589; + h = 0.039216; + shadow = 0; +}; + +class Rsc_ACE_Timer_Slider:RscXSliderH { x = 0.4; y = 0.2; w = 0.3; @@ -21,8 +54,7 @@ class Rsc_ACE_Timer_Slider:RscXSliderH{ colorBackground[] = {0,0,0,0.5}; }; -class RscACE_SelectTimeUI -{ +class RscACE_SelectTimeUI { idd = 8854; movingEnable = 0; class controls { @@ -72,3 +104,185 @@ class RscACE_SelectTimeUI }; }; }; + +class Rsc_ACE_NumKeyButton: Rsc_ACE_HiddenButton{}; +class Rsc_ACE_PhoneInterface { + idd = 8855; + movingEnable = 1; + onLoad = QUOTE(GVAR(IED_CurrentSpeedDial) = -1); + class controls { + class RscPicture_1200: RscPicture { + idc = 1200; + text = PATHTOF(Data\UI\Cellphone_Background.paa); + x = 0.231875 * safezoneW + safezoneX; + y = 0.104 * safezoneH + safezoneY; + w = 0.195937 * safezoneW; + h = 0.704 * safezoneH; + }; + class numkey_1: Rsc_ACE_NumKeyButton { + idc = 1600; + x = 0.278281 * safezoneW + safezoneX; + y = 0.533 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "1"; + action = "ctrlSetText [1400,((ctrlText 1400) + '1')];"; + }; + class numkey_2: Rsc_ACE_NumKeyButton { + idc = 1601; + x = 0.314375 * safezoneW + safezoneX; + y = 0.533 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "2"; + action = "ctrlSetText [1400,((ctrlText 1400) + '2')];"; + }; + class numkey_3: Rsc_ACE_NumKeyButton { + idc = 1602; + x = 0.350469 * safezoneW + safezoneX; + y = 0.533 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "3"; + action = "ctrlSetText [1400,((ctrlText 1400) + '3')];"; + }; + class numkey_4: Rsc_ACE_NumKeyButton { + idc = 1603; + x = 0.278281 * safezoneW + safezoneX; + y = 0.577 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "4"; + action = "ctrlSetText [1400,((ctrlText 1400) + '4')];"; + }; + class numkey_5: Rsc_ACE_NumKeyButton { + idc = 1604; + x = 0.314375 * safezoneW + safezoneX; + y = 0.577 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "5"; + action = "ctrlSetText [1400,((ctrlText 1400) + '5')];"; + }; + class numkey_6: Rsc_ACE_NumKeyButton { + idc = 1605; + x = 0.350469 * safezoneW + safezoneX; + y = 0.577 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "6"; + action = "ctrlSetText [1400,((ctrlText 1400) + '6')];"; + }; + class numkey_7: Rsc_ACE_NumKeyButton { + idc = 1606; + x = 0.278281 * safezoneW + safezoneX; + y = 0.621 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "7"; + action = "ctrlSetText [1400,((ctrlText 1400) + '7')];"; + }; + class numkey_8: Rsc_ACE_NumKeyButton { + idc = 1607; + x = 0.314375 * safezoneW + safezoneX; + y = 0.621 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "8"; + action = "ctrlSetText [1400,((ctrlText 1400) + '8')];"; + }; + class numkey_9: Rsc_ACE_NumKeyButton { + idc = 1608; + x = 0.350469 * safezoneW + safezoneX; + y = 0.621 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "9"; + action = "ctrlSetText [1400,((ctrlText 1400) + '9')];"; + }; + class numkey_0: Rsc_ACE_NumKeyButton { + idc = 1609; + x = 0.314375 * safezoneW + safezoneX; + y = 0.676 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "0"; + action = "ctrlSetText [1400,((ctrlText 1400) + '0')];"; + }; + class speedDialAdd: Rsc_ACE_NumKeyButton { + idc = 1610; + x = 0.278281 * safezoneW + safezoneX; + y = 0.676 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_AddToSpeedDial"; + action = QUOTE([ARR_2(ctrlText 1401,ctrlText 1400)] call FUNC(addToSpeedDial);); + }; + class clear: Rsc_ACE_HiddenButton { + idc = 1610; + x = 0.278281 * safezoneW + safezoneX; + y = 0.445 * safezoneH + safezoneY; + w = 0.020625 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Clear"; + action = QUOTE(ctrlSetText [ARR_2(1400,'')];[ctrlText 1401] call FUNC(removeFromSpeedDial);ctrlSetText [ARR_2(1401,'')];); + }; + class dial: Rsc_ACE_HiddenButton { + idc = 1611; + x = 0.309219 * safezoneW + safezoneX; + y = 0.445 * safezoneH + safezoneY; + w = 0.04125 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_Dial"; + action = QUOTE([ARR_2(ace_player,ctrlText 1400)] call FUNC(dialPhone);); + }; + class up: Rsc_ACE_HiddenButton { + idc = 1612; + x = 0.360781 * safezoneW + safezoneX; + y = 0.445 * safezoneH + safezoneY; + w = 0.020625 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_Up"; + action = QUOTE([true] call FUNC(setSpeedDial)); + }; + class down: Rsc_ACE_HiddenButton { + idc = 1613; + x = 0.345312 * safezoneW + safezoneX; + y = 0.485 * safezoneH + safezoneY; + w = 0.020625 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_Down"; + action = QUOTE([false] call FUNC(setSpeedDial)); + }; + class speedDial_Text: RscText { + idc = 1405; + y = 0.302 * safezoneH + safezoneY; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 22) * 1)"; + x = 0.288594 * safezoneW + safezoneX; + w = 0.0825 * safezoneW; + h = 0.044 * safezoneH; + text = "Name"; + }; + class speedDial_edit: Rsc_ACE_CallScreen_Edit { + idc = 1401; + y = 0.302 * safezoneH + safezoneY; + x = 0.318 * safezoneW + safezoneX; + w = 0.1; + }; + class numberEdit_Text: RscText { + idc = 1406; + y = 0.348 * safezoneH + safezoneY; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 22) * 1)"; + x = 0.288594 * safezoneW + safezoneX; + w = 0.0825 * safezoneW; + h = 0.044 * safezoneH; + text = "#"; + }; + class number_edit: Rsc_ACE_CallScreen_Edit { + canModify = 0; + idc = 1400; + y = 0.348 * safezoneH + safezoneY; + x = 0.3 * safezoneW + safezoneX; + }; + }; +}; diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 2ede878a37..e3b40308c3 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -18,6 +18,7 @@ if !(hasInterface) exitWith {}; GVAR(PlacedCount) = 0; GVAR(Setup) = objNull; GVAR(pfeh_running) = false; +GVAR(CurrentSpeedDial) = 0; [{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); player addEventHandler ["Killed", { diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index 801ded6615..3747151d16 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -17,11 +17,15 @@ ADDON = false; +PREP(addCellphoneIED); PREP(addClacker); +PREP(addToSpeedDial); PREP(canDefuse); PREP(canDetonate); PREP(defuseExplosive); PREP(detonateExplosive); +PREP(dialPhone); +PREP(dialingPhone); PREP(handleScrollWheel); @@ -30,6 +34,7 @@ PREP(hasPlacedExplosives); PREP(getDetonators); PREP(getPlacedExplosives); +PREP(getSpeedDialExplosive); PREP(openDetonateUI); PREP(openPlaceUI); @@ -41,10 +46,12 @@ PREP(place_Approve); PREP(place_Cancel); PREP(placeExplosive); +PREP(removeFromSpeedDial); PREP(selectTrigger); PREP(setupExplosive); PREP(setPosition); +PREP(setSpeedDial); PREP(startDefuse); PREP(startTimer); PREP(triggerType); diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index e4a079f107..da95d45e7e 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { units[] = {}; - weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch"}; + weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch", "ACE_Cellphone"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common", "ace_interaction"}; author[] = {"Garth 'L-H' de Wet"}; diff --git a/addons/explosives/functions/fnc_addCellphoneIED.sqf b/addons/explosives/functions/fnc_addCellphoneIED.sqf new file mode 100644 index 0000000000..84cb57cf4e --- /dev/null +++ b/addons/explosives/functions/fnc_addCellphoneIED.sqf @@ -0,0 +1,51 @@ +/* + * Author: Garth 'L-H' de Wet + * Adds an IED to the cellphone list + * + * Arguments: + * 0: Unit + * 1: Explosive + * 2: Magazine classname + * 3: Extra variables + * + * Return Value: + * None + * + * Example: + * Handled by PlaceExplosive. + * + * Public: No + */ +#include "script_component.hpp" +EXPLODE_4_PVT(_this,_unit,_explosive,_magazineClass,_extra); +// Config is the last item in the list of passed in items. +_config = (_this select 3) select (count (_this select 3) - 1); + +_requiredItems = getArray(_config >> "requires"); +_hasRequired = true; +_detonators = [_unit] call FUNC(getDetonators); +{ + if !(_x in _detonators) exitWith{ + _hasRequired = false; + }; +} count _requiredItems; +private ["_code", "_count", "_codeSet"]; +_codeSet = false; +while {!_codeSet} do { + _code = str(round (random 9999)); + _count = 4 - count (toArray _code); + while {_count > 0} do { + _code = "0" + _code; + _count = _count - 1; + }; + _codeSet = (count ([_code] call FUNC(getSpeedDialExplosive))) == 0; +}; +if (isNil QGVAR(CellphoneIEDs)) then { + GVAR(CellphoneIEDs) = []; +}; +_count = GVAR(CellphoneIEDs) pushBack [_explosive,_code,GetNumber(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> "Cellphone" >> "FuseTime")]; +_count = _count + 1; +publicVariable QGVAR(CellphoneIEDs); +_unit sideChat format ["IED %1 code: %2", _count,_code]; +if !(_hasRequired) exitWith {}; +[format ["IED %1", _count],_code] call FUNC(addToSpeedDial); diff --git a/addons/explosives/functions/fnc_addToSpeedDial.sqf b/addons/explosives/functions/fnc_addToSpeedDial.sqf new file mode 100644 index 0000000000..142996e4c3 --- /dev/null +++ b/addons/explosives/functions/fnc_addToSpeedDial.sqf @@ -0,0 +1,37 @@ +/* + * Author: Garth 'L-H' de Wet + * Sets the speed dial for the UI. + * + * Arguments: + * 0: Name of speed dial + * 1: Code to add to speed dial + * + * Return Value: + * None + * + * Example: + * ["My Speed Dial","2131"] call ACE_explosives_fnc_addToSpeedDial; + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_speedDial", "_found"]; +_speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; +_found = false; + +EXPLODE_2_PVT(_this,_name,_code); + +if ((_code) == "") ExitWith { + [_name] call FUNC(removeFromSpeedDial); +}; +{ + if ((_x select 0) == _name) exitWith { + _speedDial set [_foreachindex, _this]; + _found = true; + }; +} foreach _speedDial; +if (!_found) then { + _speedDial pushBack _this; +}; + +ace_player setVariable [QGVAR(SpeedDial), _speedDial]; diff --git a/addons/explosives/functions/fnc_dialPhone.sqf b/addons/explosives/functions/fnc_dialPhone.sqf new file mode 100644 index 0000000000..41b2a4a4f7 --- /dev/null +++ b/addons/explosives/functions/fnc_dialPhone.sqf @@ -0,0 +1,42 @@ +/* + * Author: Garth 'L-H' de Wet + * Dials the number passed and detonates the explosive. + * + * Arguments: + * 0: Unit to do dialing + * 1: Code to dial + * + * Return Value: + * None + * + * Example: + * [ace_player,"2131"] call ACE_explosives_fnc_dialPhone; + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_arr", "_ran", "_i","_speedDial"]; +EXPLODE_2_PVT(_this,_unit,_code); +if (_unit getVariable [QGVAR(Dialing),false]) exitWith {}; +if !(alive _unit) exitWith {}; +_unit setVariable [QGVAR(Dialing), true, true]; + +_ran = (ceil(random 8)) + 1; +_arr = []; +for [{_i=0}, {_i<_ran}, {_i=_i+1}] do { + _arr = _arr + ['.','..','...','']; +}; +if (_unit == ace_player) then { + ctrlSetText [1400,"Calling"]; + [FUNC(dialingPhone), 0.25, [_unit,4,_arr,_code]] call CALLSTACK(CBA_fnc_addPerFrameHandler); +} else { + private ["_explosive"]; + _explosive = [_code] call FUNC(getSpeedDialExplosive); + if ((count _explosive) > 0) then { + [{ + playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75]; + (_this select 0) setVariable [QGVAR(Dialing), false, true]; + }, [_unit,_explosive select 0], 0.25 * (count _arr - 4), 0] call EFUNC(common,waitAndExecute); + [_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2)] call FUNC(startTimer); + }; +}; diff --git a/addons/explosives/functions/fnc_dialingPhone.sqf b/addons/explosives/functions/fnc_dialingPhone.sqf new file mode 100644 index 0000000000..d3c429c9fc --- /dev/null +++ b/addons/explosives/functions/fnc_dialingPhone.sqf @@ -0,0 +1,44 @@ +/* + * Author: Garth 'L-H' de Wet + * Performs the dial tones and detonation of explosive. + * + * Arguments: + * 0: Unit to do dialing + * 1: Index + * 2: Dialing points + * 3: IED code + * + * Return Value: + * None + * + * Example: + * [FUNC(dialingPhone), 0.25, [_unit,4,_arr,_code]] call CALLSTACK(CBA_fnc_addPerFrameHandler); + * + * Public: No + */ +#include "script_component.hpp" +EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code); +if ((_i mod 4) == 0) then { + playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit ModelToWorld [0,0.2,2]), 15,1,2.5]; +}; +ctrlSetText [1400,format["Calling%1",_arr select (_i - 4)]]; + +private "_explosive"; +_explosive = [_code] call FUNC(getSpeedDialExplosive); + +if (_i >= (count _arr + 2)) then { + [_this select 1] call CALLSTACK(cba_fnc_removePerFrameHandler); + if ((count _explosive) > 0) then { + [_unit, -1, [_explosive select 0, _explosive select 2]] call FUNC(detonateExplosive); + }; + _unit setVariable [QGVAR(Dialing), false, true]; + if (_unit == ace_player) then { + ctrlSetText [1400,"Call Ended!"]; + }; +}; +if (_i == (count _arr)) then { + if ((count _explosive) > 0) then { + playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_explosive select 0),3.16228,1,75]; + }; +}; +(_this select 0) set [1, _i + 1]; diff --git a/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf b/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf new file mode 100644 index 0000000000..d6d5b57b3b --- /dev/null +++ b/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf @@ -0,0 +1,27 @@ +/* + * Author: Garth 'L-H' de Wet + * Gets the explosive from the speed dial entry. + * + * Arguments: + * 0: Speed dial entry + * + * Return Value: + * Associated explosive (or ObjNull) + * + * Example: + * ["2113"] call ace_explosives_fnc_getSpeedDialExplosive; + * + * Public: Yes + */ +#include "script_component.hpp" +EXPLODE_1_PVT(_this,_code); +private ["_explosive"]; +if (isNil QGVAR(CellphoneIEDs)) exitWith {[]}; +_explosive = []; +{ + if ((_x select 1) == _code) exitWith { + _explosive = _x; + }; + false +} count GVAR(CellphoneIEDs); +_explosive diff --git a/addons/explosives/functions/fnc_openPlaceUI.sqf b/addons/explosives/functions/fnc_openPlaceUI.sqf index 1bb78248d2..5ad79381b1 100644 --- a/addons/explosives/functions/fnc_openPlaceUI.sqf +++ b/addons/explosives/functions/fnc_openPlaceUI.sqf @@ -51,7 +51,7 @@ _actions = [localize "STR_ACE_Explosives_PlaceMenu", localize "STR_ACE_Explosive }, { call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [EGVAR(interaction,AutoCloseMenu), false]) then { + if !(profileNamespace getVariable [QUOTE(EGVAR(interaction,AutoCloseMenu)), false]) then { "ACE_Explosives" call EFUNC(interaction,openMenuSelf); }; } diff --git a/addons/explosives/functions/fnc_place_Approve.sqf b/addons/explosives/functions/fnc_place_Approve.sqf index 97528cb8f6..77cfbb92a1 100644 --- a/addons/explosives/functions/fnc_place_Approve.sqf +++ b/addons/explosives/functions/fnc_place_Approve.sqf @@ -28,79 +28,78 @@ _player = ACE_player; [_player, "DefaultAction", _player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler); [_player, "MenuBack", _player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); call EFUNC(interaction,hideMouseHint); -if ((_setup getVariable [QGVAR(Class), ""]) != "") then { - _dir = (getDir _setup); - if (_dir > 180) then { - _dir = _dir - 180; - } else { - _dir = 180 + _dir; - }; - _setup setVariable [QGVAR(Direction), _dir]; - _player setVariable [QGVAR(PlantingExplosive), true]; - _setup addEventHandler ["EpeContactStart", { - if (!((_this select 0) getVariable [QGVAR(Handled), false])) then { - private ["_player", "_pos", "_attachTo"]; +if ((_setup getVariable [QGVAR(Class), ""]) == "") exitWith { + deleteVehicle _setup; +}; +_dir = (getDir _setup); +if (_dir > 180) then { + _dir = _dir - 180; +} else { + _dir = 180 + _dir; +}; +_setup setVariable [QGVAR(Direction), _dir]; +_player setVariable [QGVAR(PlantingExplosive), true]; +_setup addEventHandler ["EpeContactStart", { + if (!((_this select 0) getVariable [QGVAR(Handled), false])) then { + private ["_player", "_pos", "_attachTo"]; + _player = ACE_player; + _player setVariable [QGVAR(PlantingExplosive), false]; + _pos = getPosATL (_this select 0); + (_this select 0) enableSimulationGlobal false; + if (surfaceIsWater _pos) then { + _pos = getPosASL (_this select 0); + (_this select 0) setPosASL _pos; + }else{ + (_this select 0) setPosATL _pos; + }; + (_this select 0) setVariable [QGVAR(Handled), true]; + _attachTo = objNull; + if (!isNull (_this select 1) && {(_this select 1) isKindOf "AllVehicles"}) then { + _attachTo = (_this select 1); + }; + [(_this select 0),_attachTo, _pos] spawn { // TODO: Change to scheduled delay execution + private ["_mag", "_setup", "_dir", "_player"]; + _setup = _this select 0; _player = ACE_player; - _pos = getPosATL (_this select 0); - (_this select 0) enableSimulationGlobal false; - if (surfaceIsWater _pos) then { - _pos = getPosASL (_this select 0); - (_this select 0) setPosASL _pos; - }else{ - (_this select 0) setPosATL _pos; - }; - (_this select 0) setVariable [QGVAR(Handled), true]; - _player setVariable [QGVAR(PlantingExplosive), false]; - _attachTo = objNull; - if (!isNull (_this select 1) && {(_this select 1) isKindOf "AllVehicles"}) then { - _attachTo = (_this select 1); - }; - [(_this select 0),_attachTo, _pos] spawn { // TODO: Change to scheduled delay execution - private ["_mag", "_setup", "_dir", "_player"]; - _setup = _this select 0; - _player = ACE_player; - _mag = _setup getVariable [QGVAR(Class), ""]; - _dir = _setup getVariable [QGVAR(Direction), 0]; + _mag = _setup getVariable [QGVAR(Class), ""]; + _dir = _setup getVariable [QGVAR(Direction), 0]; - sleep getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime"); - _explosive = [_player, _this select 2, _dir, _mag, _setup getVariable QGVAR(Trigger), - [_setup getVariable QGVAR(Timer)], isNull (_this select 1)] call FUNC(placeExplosive); - deleteVehicle _setup; - if (!isNull(_explosive)) then { - _player RemoveMagazine _mag; - if (!isNull (_this select 1)) then { - _explosive attachTo [(_this select 1)]; - _dir = _dir - (getDir (_this select 1)); - [[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); - }; + sleep getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime"); + _explosive = [_player, _this select 2, _dir, _mag, _setup getVariable QGVAR(Trigger), + [_setup getVariable QGVAR(Timer)], isNull (_this select 1)] call FUNC(placeExplosive); + deleteVehicle _setup; + if (!isNull(_explosive)) then { + _player RemoveMagazine _mag; + if (!isNull (_this select 1)) then { + _explosive attachTo [(_this select 1)]; + _dir = _dir - (getDir (_this select 1)); + [[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); }; }; }; - }]; - _setup enableSimulationGlobal true; - _player playActionNow "MedicOther"; - [_setup] spawn { // TODO: Change to scheduled delay execution - private ["_setup", "_player"]; - _setup = _this select 0; - _player = ACE_player; - sleep 5; + }; +}]; +_setup enableSimulationGlobal true; +_player playActionNow "MedicOther"; +[_setup] spawn { // TODO: Change to scheduled delay execution + private ["_setup", "_player"]; + _setup = _this select 0; + _player = ACE_player; + sleep 5; + _player setVariable [QGVAR(PlantingExplosive), false]; + if (!isNull _setup) then { + private ["_mag", "_dir", "_delayTime"]; + _mag = _setup getVariable [QGVAR(Class), ""]; + _dir = _setup getVariable [QGVAR(Direction), 0]; + _delayTime = (getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime")) - 5; + if (_delayTime > 0) then { + sleep _delayTime; + }; if (!isNull _setup) then { - private ["_mag", "_dir", "_delayTime"]; - _mag = _setup getVariable [QGVAR(Class), ""]; - _dir = _setup getVariable [QGVAR(Direction), 0]; - _delayTime = (getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime")) - 5; - if (_delayTime > 0) then { - sleep _delayTime; - }; - if (!isNull _setup) then { - [_player, GetPosATL _setup, _dir, _mag, _setup getVariable QGVAR(Trigger), - [_setup getVariable QGVAR(Timer)], true] call FUNC(placeExplosive); - deleteVehicle _setup; - _player RemoveMagazine _mag; - _player setVariable [QGVAR(PlantingExplosive), false]; - }; + [_player, GetPosATL _setup, _dir, _mag, _setup getVariable QGVAR(Trigger), + [_setup getVariable QGVAR(Timer)], true] call FUNC(placeExplosive); + deleteVehicle _setup; + _player RemoveMagazine _mag; }; }; -}else{ - deleteVehicle _setup; }; diff --git a/addons/explosives/functions/fnc_removeFromSpeedDial.sqf b/addons/explosives/functions/fnc_removeFromSpeedDial.sqf new file mode 100644 index 0000000000..c0a467e6f1 --- /dev/null +++ b/addons/explosives/functions/fnc_removeFromSpeedDial.sqf @@ -0,0 +1,26 @@ +/* + * Author: Garth 'L-H' de Wet + * Removes the specified speed dial from unit's speed dial. + * + * Arguments: + * 0: Speed dial name + * + * Return Value: + * None + * + * Example: + * ["IED 1"] call ACE_explosives_fnc_removeFromSpeedDial; + * + * Public: Yes + */ +#include "script_component.hpp" +private "_speedDial"; +_speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; +if (count _speedDial == 0) exitWith {}; +{ + if ((_x select 0) == (_this select 0)) exitWith { + _speedDial set [_foreachIndex, "x"]; + _speedDial = _speedDial - ["x"]; + ace_player setVariable [QGVAR(SpeedDial),_speedDial]; + }; +} foreach _speedDial; diff --git a/addons/explosives/functions/fnc_setSpeedDial.sqf b/addons/explosives/functions/fnc_setSpeedDial.sqf new file mode 100644 index 0000000000..adb2e6af03 --- /dev/null +++ b/addons/explosives/functions/fnc_setSpeedDial.sqf @@ -0,0 +1,26 @@ +/* + * Author: Garth 'L-H' de Wet + * Sets the speed dial for the UI. + * + * Arguments: + * 0: Whether to increase or decrease speed dial index + * + * Return Value: + * None + * + * Example: + * [true] call ACE_explosives_fnc_setSpeedDial; // increase + * [false] call ACE_explosives_fnc_setSpeedDial; // decrease + * + * Public: No + */ + #include "script_component.hpp" +private ["_speedDial", "_amount"]; +_speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; +if (count _speedDial == 0) exitWith {}; +_amount = if((_this select 0))then{1}else{-1}; + +GVAR(CurrentSpeedDial) = (GVAR(CurrentSpeedDial) + _amount + count _speedDial) mod (count _speedDial); + +ctrlSetText [1400,(_speedDial select GVAR(CurrentSpeedDial)) select 1]; +ctrlSetText [1401,(_speedDial select GVAR(CurrentSpeedDial)) select 0]; diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 38e2c90f3c..f17693d33e 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -25,7 +25,8 @@ private ["_gunner", "_turret"]; _gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); _turret = [_gunner] call EFUNC(common,getTurretIndex); -//if (ACE_player != _gunner) exitWith {}; // global +// Exit if the unit isn't a player +if !([_gunner] call EFUNC(common,isPlayer)) exitWith {}; private ["_FCSMagazines", "_FCSElevation", "_offset"]; diff --git a/addons/logistics_uavbattery/CfgSounds.hpp b/addons/logistics_uavbattery/CfgSounds.hpp new file mode 100644 index 0000000000..530c5b86a9 --- /dev/null +++ b/addons/logistics_uavbattery/CfgSounds.hpp @@ -0,0 +1,7 @@ +class CfgSounds { + class ACE_replaceUAVBattery { + name = "ACE_replaceUAVBattery"; + sound[]={QUOTE(PATHTOF(sounds\exchange_battery.ogg)),1,1}; + titles[]={}; + }; +}; diff --git a/addons/logistics_uavbattery/config.cpp b/addons/logistics_uavbattery/config.cpp index 046a2665d0..32d8c49978 100644 --- a/addons/logistics_uavbattery/config.cpp +++ b/addons/logistics_uavbattery/config.cpp @@ -15,3 +15,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "CfgSounds.hpp" diff --git a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf index 4256ddabf9..aaaac3077d 100644 --- a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf @@ -1,17 +1,19 @@ -/* fnc_refuel.sqf -* -* Author: marc_book (modified by PabstMirror) -* -* Tests if unit can refuel the target UAV -* -* Argument: -* 0: OBJECT - Player unit -* 1: OBJECT - UAV to test -* -* Return value: -* BOOL -*/ - +/* + * Author: marc_book + * Tests if unit can refuel the target UAV + * + * Arguments: + * 0: Player + * 1: UAV + * + * Return Value: + * Can the player rechange the UAV + * + * Example: + * [player, theUAV] call ace_logistics_uavbattery_fnc_canRefuelUAV + * + * Public: No + */ #include "script_component.hpp" PARAMS_2(_caller,_target); diff --git a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf index 9384044f00..a23969aa9f 100644 --- a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf @@ -1,17 +1,19 @@ -/* fnc_refuel.sqf -* -* Author: marc_book (modified by PabstMirror) -* -* Starts refueling/recharging the 'Dartar' UAVs -* -* Argument: -* 0: OBJECT - Player unit -* 1: OBJECT - UAV -* -* Return value: -* NOTHING -*/ - +/* + * Author: marc_book + * Starts refueling/recharging the 'Dartar' UAVs + * + * Arguments: + * 0: Player + * 1: UAV + * + * Return Value: + * Nothing + * + * Example: + * [player, theUAV] call ace_logistics_uavbattery_fnc_refuelUAV + * + * Public: No + */ #include "script_component.hpp" PARAMS_2(_caller,_target); @@ -21,6 +23,7 @@ if (!(_this call FUNC(canRefuelUAV))) exitWith {}; _onFinish = { EXPLODE_2_PVT((_this select 0),_caller,_target); _caller removeItem "ACE_UAVBattery"; + playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10]; ["VehicleSetFuel", [_target], [_target, 1]] call EFUNC(common,targetEvent); //setFuel is local }; diff --git a/addons/logistics_uavbattery/sounds/exchange_battery.ogg b/addons/logistics_uavbattery/sounds/exchange_battery.ogg new file mode 100644 index 0000000000..5a40ddb47a Binary files /dev/null and b/addons/logistics_uavbattery/sounds/exchange_battery.ogg differ diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 062df32ddf..6f5c1b5978 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -50,8 +50,8 @@ call FUNC(handleDisplayEffects); ["onUnconscious", FUNC(onUnconscious)] call ace_common_fnc_addEventHandler; ["carryObjectDropped", FUNC(onCarryObjectDropped)] call ace_common_fnc_addEventHandler; -if (isNil QGVAR(ENABLE_REVIVE_F)) then { - GVAR(ENABLE_REVIVE_F) = 0; +if (isNil QGVAR(ENABLE_REVIVE)) then { + GVAR(ENABLE_REVIVE) = 0; }; diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 57800cd5b7..144c877aeb 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -141,8 +141,8 @@ PREP(setUnconsciousState); PREP(isUnconscious); PREP(getUnconsciousCondition); PREP(registerUnconsciousCondition); -PREP(cleanUpCopyOfBody_F); -PREP(makeCopyOfBody_F); +PREP(cleanUpCopyOfBody); +PREP(makeCopyOfBody); PREP(canGoUnconsciousState); PREP(setDead); PREP(moduleBasicRevive); diff --git a/addons/medical/functions/fnc_actionCarryUnit.sqf b/addons/medical/functions/fnc_actionCarryUnit.sqf index 2dd1bb8f7f..984447f2f9 100644 --- a/addons/medical/functions/fnc_actionCarryUnit.sqf +++ b/addons/medical/functions/fnc_actionCarryUnit.sqf @@ -42,7 +42,7 @@ if (!alive _unit) exitwith { [_caller, false] call FUNC(treatmentMutex); [{ _this call FUNC(actionCarryUnit); - }, [_caller, ([_unit,_caller] call FUNC(makeCopyOfBody_F)), _killOnDrop], 0.25, 0.25] call EFUNC(common,waitAndExecute); + }, [_caller, ([_unit,_caller] call FUNC(makeCopyOfBody)), _killOnDrop], 0.25, 0.25] call EFUNC(common,waitAndExecute); }; if !([_caller,_unit] call EFUNC(common,carryObj)) exitwith { @@ -92,4 +92,4 @@ _caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; [(_this select 0), objNull,[0, 0, 0]] call EFUNC(common,carryObj); }, // on failure [_caller, _unit, _killOnDrop] // arguments -] call EFUNC(common,loadingBar); \ No newline at end of file +] call EFUNC(common,loadingBar); diff --git a/addons/medical/functions/fnc_actionDragUnit.sqf b/addons/medical/functions/fnc_actionDragUnit.sqf index d43b9a54dc..285fdfe419 100644 --- a/addons/medical/functions/fnc_actionDragUnit.sqf +++ b/addons/medical/functions/fnc_actionDragUnit.sqf @@ -40,7 +40,7 @@ if (!alive _unit) exitwith { [_caller, false] call FUNC(treatmentMutex); [{ _this call FUNC(actionDragUnit); - }, [_caller, ([_unit,_caller] call FUNC(makeCopyOfBody_F)), _killOnDrop], 0.25, 0.25] call EFUNC(common,waitAndExecute); + }, [_caller, ([_unit,_caller] call FUNC(makeCopyOfBody)), _killOnDrop], 0.25, 0.25] call EFUNC(common,waitAndExecute); }; if (primaryWeapon _caller == "") then { diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index cd20140bdb..afe70746d2 100644 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical/functions/fnc_actionLoadUnit.sqf @@ -22,7 +22,7 @@ if ([_unit] call cse_fnc_isAwake) exitwith { [_caller,objNull] call cse_fnc_carryObj; [_unit,objNull] call cse_fnc_carryObj; -_vehicle = [_caller, _unit] call EFUNC(common,loadPerson_F); +_vehicle = [_caller, _unit] call EFUNC(common,loadPerson); if (!isNull _vehicle) then { if (!isnil QGVAR(DROP_ADDACTION)) then { _caller removeAction GVAR(DROP_ADDACTION); diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index 8df95c24d9..fc43fe06d8 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -36,7 +36,7 @@ _bodyBagCreated setvariable [QEGVAR(common,nameOfBody), _nameOfUnit, true]; // reset the position to ensure it is on the correct one. _bodyBagCreated setPos _onPosition; -[[_bodyBagCreated], QEFUNC(common,revealObject_f), true] call BIS_fnc_MP; +[[_bodyBagCreated], QEFUNC(common,revealObject), true] call BIS_fnc_MP; _bodyBagCreated setvariable [QEGVAR(logistics,enableDrag), true, true]; diff --git a/addons/medical/functions/fnc_actionUnloadUnit.sqf b/addons/medical/functions/fnc_actionUnloadUnit.sqf index 6eefb4b138..0b6b6fe9de 100644 --- a/addons/medical/functions/fnc_actionUnloadUnit.sqf +++ b/addons/medical/functions/fnc_actionUnloadUnit.sqf @@ -19,7 +19,7 @@ _drag = [_this, 2, false, [false]] call BIS_fnc_Param; if (vehicle _unit == _unit) exitwith {}; if (([_unit] call cse_fnc_isAwake)) exitwith {}; -if ([_caller, _unit] call EFUNC(common,unloadPerson_F)) then { +if ([_caller, _unit] call EFUNC(common,unloadPerson)) then { if (_drag) then { if ((vehicle _caller) == _caller) then { [[_caller,_unit], QUOTE(FUNC(actionDragUnit)), _caller, false] call BIS_fnc_MP; diff --git a/addons/medical/functions/fnc_cleanUpCopyOfBody_f.sqf b/addons/medical/functions/fnc_cleanUpCopyOfBody.sqf similarity index 76% rename from addons/medical/functions/fnc_cleanUpCopyOfBody_f.sqf rename to addons/medical/functions/fnc_cleanUpCopyOfBody.sqf index b20169e9f5..292f332f91 100644 --- a/addons/medical/functions/fnc_cleanUpCopyOfBody_f.sqf +++ b/addons/medical/functions/fnc_cleanUpCopyOfBody.sqf @@ -13,12 +13,12 @@ private ["_unit", "_copy"]; _unit = _this select 0; -_copy = _unit getvariable QGVAR(copyOfBody_f); +_copy = _unit getvariable QGVAR(copyOfBody); if (isnil "_copy") exitwith {false}; [format["Cleaning up a copy of Body: %1 %2", _unit, _copy]] call EFUNC(common,debug); // lets clean it up -_unit setvariable [QGVAR(originalCopy_f), nil, true]; -_unit setvariable [QGVAR(copyOfBody_f), nil, true]; +_unit setvariable [QGVAR(originalCopy), nil, true]; +_unit setvariable [QGVAR(copyOfBody), nil, true]; if (!isNull _copy) then { deleteVehicle _copy; }; diff --git a/addons/medical/functions/fnc_getBloodVolumeChange.sqf b/addons/medical/functions/fnc_getBloodVolumeChange.sqf index 69b240b1d7..cfec53e157 100644 --- a/addons/medical/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/medical/functions/fnc_getBloodVolumeChange.sqf @@ -38,7 +38,7 @@ if (_bloodVolume < 100.0) then { _bloodVolumeChange = _bloodVolumeChange + BLOOD_CHANGE_PER_SECOND; _ivVolume = (_unit getvariable [QGVAR(salineIVVolume), 0]) + IV_CHANGE_PER_SECOND; _unit setvariable [QGVAR(salineIVVolume),_ivVolume]; - if ([QEGVAR(fieldRations,module)] call EFUNC(common,isModuleEnabled_F)) then { + if ([QEGVAR(fieldRations,module)] call EFUNC(common,isModuleEnabled)) then { if ([_unit] call EFUNC(fieldRations,canDrink)) then { _unit setvariable [QEGVAR(fieldRations,drinkStatus), (_unit getvariable [QEGVAR(fieldRations,drinkStatus), 100]) + 0.2]; }; diff --git a/addons/medical/functions/fnc_getUnconsciousCondition.sqf b/addons/medical/functions/fnc_getUnconsciousCondition.sqf index 097a5682ec..a322439742 100644 --- a/addons/medical/functions/fnc_getUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_getUnconsciousCondition.sqf @@ -13,8 +13,8 @@ private ["_unit","_return"]; _unit = _this select 0; -if (isnil QGVAR(unconsciousConditions_F)) then { - GVAR(unconsciousConditions_F) = []; +if (isnil QGVAR(unconsciousConditions)) then { + GVAR(unconsciousConditions) = []; }; _return = false; @@ -25,5 +25,5 @@ _return = false; }; }; if (_return) exitwith{}; -}foreach GVAR(unconsciousConditions_F); +}foreach GVAR(unconsciousConditions); _return \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleDropUnit.sqf b/addons/medical/functions/fnc_handleDropUnit.sqf index c82fe8ce79..45e1268d30 100644 --- a/addons/medical/functions/fnc_handleDropUnit.sqf +++ b/addons/medical/functions/fnc_handleDropUnit.sqf @@ -26,7 +26,7 @@ if ((isNull ([_caller] call EFUNC(common,getCarriedObj))) || !([_caller] call EF _caller removeWeapon "ACE_FakePrimaryWeapon"; }; - [_target, false] call EFUNC(common,disableAI_f); + [_target, false] call EFUNC(common,disableAI); _caller setvariable[QGVAR(onStartMovingUnitParams), nil]; // handle the drag & carry administration diff --git a/addons/medical/functions/fnc_handleTreatment_Action_fullHealLocal.sqf b/addons/medical/functions/fnc_handleTreatment_Action_fullHealLocal.sqf index 1d08a00e23..414c5c4a28 100644 --- a/addons/medical/functions/fnc_handleTreatment_Action_fullHealLocal.sqf +++ b/addons/medical/functions/fnc_handleTreatment_Action_fullHealLocal.sqf @@ -56,7 +56,7 @@ if (alive _unit) exitwith { _unit setDamage 0; // Resetting potential revive state - [_unit,QEGVAR(common,ENABLE_REVIVE_SETDEAD_F), 0] call EFUNC(common,setDefinedVariable); + [_unit,QEGVAR(common,ENABLE_REVIVE_SETDEAD), 0] call EFUNC(common,setDefinedVariable); [_unit,QEGVAR(common,ENABLE_REVIVE_COUNTER), 0] call EFUNC(common,setDefinedVariable); diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 7ced1ec393..cb2e77b342 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -93,7 +93,7 @@ if ((missionNamespace getvariable[QGVAR(setting_AdvancedLevel), 0]) > 0) exitwit // Check vitals for medical status // TODO check for in revive state instead of variable - if ((_unit getvariable[QEGVAR(common,ENABLE_REVIVE_SETDEAD_F),0]) == 0) then { + if ((_unit getvariable[QEGVAR(common,ENABLE_REVIVE_SETDEAD),0]) == 0) then { _bloodPressureL = _bloodPressure select 0; _bloodPressureH = _bloodPressure select 1; diff --git a/addons/medical/functions/fnc_makeCopyOfBody_f.sqf b/addons/medical/functions/fnc_makeCopyOfBody.sqf similarity index 100% rename from addons/medical/functions/fnc_makeCopyOfBody_f.sqf rename to addons/medical/functions/fnc_makeCopyOfBody.sqf diff --git a/addons/medical/functions/fnc_moduleBasicRevive.sqf b/addons/medical/functions/fnc_moduleBasicRevive.sqf index b02d873313..79da194024 100644 --- a/addons/medical/functions/fnc_moduleBasicRevive.sqf +++ b/addons/medical/functions/fnc_moduleBasicRevive.sqf @@ -15,10 +15,10 @@ _logic = _this select 0; GVAR(Module) = true; -[_logic, QGVAR(ENABLE_REVIVE_F), "enableFor" ] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(REVIVE_TIMER_MAX_F), "timer" ] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(ENABLE_REVIVE), "enableFor" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(REVIVE_TIMER_MAX), "timer" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(REVIVE_NUMBER_MAX), "amountOf" ] call EFUNC(common,readSettingFromModule); [ - {(((_this select 0) getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > 0)} + {(((_this select 0) getvariable[QGVAR(ENABLE_REVIVE_SETDEAD),0]) > 0)} ] call FUNC(registerUnconsciousCondition); diff --git a/addons/medical/functions/fnc_onKilled.sqf b/addons/medical/functions/fnc_onKilled.sqf index e3609a57e5..2b8dd987b6 100644 --- a/addons/medical/functions/fnc_onKilled.sqf +++ b/addons/medical/functions/fnc_onKilled.sqf @@ -6,7 +6,7 @@ if (!local _unit) exitwith {}; [_unit, QGVAR(amountOfPain),0,true] call EFUNC(common,setDefinedVariable); [_unit, QGVAR(heartRate),0,true] call EFUNC(common,setDefinedVariable); [_unit, QGVAR(bloodPressure), [0,0],true] call EFUNC(common,setDefinedVariable); -if (_unit getvariable[QEGVAR(common,unconscious_non_captive_f),false]) then { +if (_unit getvariable[QEGVAR(common,unconscious_non_captive),false]) then { _unit setCaptive false; - _unit setvariable[QEGVAR(common,unconscious_non_captive_f),nil]; + _unit setvariable[QEGVAR(common,unconscious_non_captive),nil]; }; \ No newline at end of file diff --git a/addons/medical/functions/fnc_onStartMovingUnit.sqf b/addons/medical/functions/fnc_onStartMovingUnit.sqf index 7fe3dd8d65..84678d5379 100644 --- a/addons/medical/functions/fnc_onStartMovingUnit.sqf +++ b/addons/medical/functions/fnc_onStartMovingUnit.sqf @@ -20,6 +20,6 @@ _dragging = _this select 3; _caller setvariable[QGVAR(onStartMovingUnitParams), [_caller, _target, _killOnDrop, _dragging]]; -[_target, true] call EFUNC(common,disableAI_f); +[_target, true] call EFUNC(common,disableAI); nil; \ No newline at end of file diff --git a/addons/medical/functions/fnc_registerUnconsciousCondition.sqf b/addons/medical/functions/fnc_registerUnconsciousCondition.sqf index f34d05b57d..1e0413e8d6 100644 --- a/addons/medical/functions/fnc_registerUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_registerUnconsciousCondition.sqf @@ -10,13 +10,13 @@ #include "script_component.hpp" -if (isnil QGVAR(unconsciousConditions_F)) then { - GVAR(unconsciousConditions_F) = []; +if (isnil QGVAR(unconsciousConditions)) then { + GVAR(unconsciousConditions) = []; }; if (typeName _this == typeName []) then { { if (typeName _x == typeName {}) then { - GVAR(unconsciousConditions_F) pushback _x; + GVAR(unconsciousConditions) pushback _x; }; }foreach _this; }; \ No newline at end of file diff --git a/addons/medical/functions/fnc_setDead.sqf b/addons/medical/functions/fnc_setDead.sqf index d43c1e1afc..2d91911a3c 100644 --- a/addons/medical/functions/fnc_setDead.sqf +++ b/addons/medical/functions/fnc_setDead.sqf @@ -24,11 +24,11 @@ if (!local _unit) exitwith { [[_unit, _force], QUOTE(FUNC(setDead)), _unit, false] call BIS_fnc_MP; }; -if (isnil QGVAR(ENABLE_REVIVE_F)) then { - GVAR(ENABLE_REVIVE_F) = 0; +if (isnil QGVAR(ENABLE_REVIVE)) then { + GVAR(ENABLE_REVIVE) = 0; }; -if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == 2)) && !_force && (alive (vehicle _unit))) exitwith { +if (((GVAR(ENABLE_REVIVE) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE) == 2)) && !_force && (alive (vehicle _unit))) exitwith { // enter revive state _unit setvariable ["ACE_inReviveState", true, true]; @@ -36,11 +36,11 @@ if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == [_unit] call FUNC(setUnconsciousState); // setting the revive default values - if (isnil QGVAR(REVIVE_TIMER_F)) then { - GVAR(REVIVE_TIMER_F) = 10; + if (isnil QGVAR(REVIVE_TIMER)) then { + GVAR(REVIVE_TIMER) = 10; }; - if (isnil QGVAR(REVIVE_NUMBER_MAX_F)) then { - GVAR(REVIVE_NUMBER_MAX_F) = -1; + if (isnil QGVAR(REVIVE_NUMBER_MAX)) then { + GVAR(REVIVE_NUMBER_MAX) = -1; }; [{ @@ -58,7 +58,7 @@ if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == }; _counter = _unit getvariable ["ACE_reviveCounterValue", 0]; - if (_counter >= GVAR(REVIVE_TIMER_F)) exitwith{ + if (_counter >= GVAR(REVIVE_TIMER)) exitwith{ if (isPlayer _unit) then { titleText ["You died..","PLAIN DOWN"]; }; diff --git a/addons/medical/functions/fnc_setUnconsciousState.sqf b/addons/medical/functions/fnc_setUnconsciousState.sqf index 3f53e629e9..7fbd3c7f8a 100644 --- a/addons/medical/functions/fnc_setUnconsciousState.sqf +++ b/addons/medical/functions/fnc_setUnconsciousState.sqf @@ -41,17 +41,17 @@ _originalPos = unitPos _unit; // Handle the on screen effects if (isPlayer _unit) then { - [] call EFUNC(common,closeAllDialogs_f); + [] call EFUNC(common,closeAllDialogs); [true] call FUNC(effectBlackOut); ["unconscious", true] call EFUNC(common,setDisableUserInputStatus); - [false] call EFUNC(common,setVolume_f); + [false] call EFUNC(common,setVolume); } else { _unit setUnitPos "DOWN"; - [_unit, true] call EFUNC(common,disableAI_F); + [_unit, true] call EFUNC(common,disableAI); }; // So the AI does not get stuck, we are moving the unit to a temp group on its own. -[_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide_f); +[_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); _captiveSwitch = [_unit, true] call EFUNC(common,setCaptiveSwitch); [_unit, [_unit] call EFUNC(common,getDeathAnim), 1, true] call EFUNC(common,doAnimation); @@ -110,15 +110,15 @@ _minWaitingTime = (round(random(10)+5)); _unit setUnconscious false; // Swhich the unit back to its original group - [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide_f); + [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); // Reset any visual and audio effects for players, or enable everything again for AI. if (isPlayer _unit) then { [false] call FUNC(effectBlackOut); - [true] call EFUNC(common,setVolume_f); + [true] call EFUNC(common,setVolume); ["unconscious", false] call EFUNC(common,setDisableUserInputStatus); } else { - [_unit, false] call EFUNC(common,disableAI_F); + [_unit, false] call EFUNC(common,disableAI); _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) }; diff --git a/addons/missionmodules/$PBOPREFIX$ b/addons/missionmodules/$PBOPREFIX$ new file mode 100644 index 0000000000..6e7c7ebfc1 --- /dev/null +++ b/addons/missionmodules/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\missionmodules \ No newline at end of file diff --git a/addons/missionmodules/CfgEventHandlers.hpp b/addons/missionmodules/CfgEventHandlers.hpp new file mode 100644 index 0000000000..f0a9f14d91 --- /dev/null +++ b/addons/missionmodules/CfgEventHandlers.hpp @@ -0,0 +1,6 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/missionmodules/CfgFactionClasses.hpp b/addons/missionmodules/CfgFactionClasses.hpp new file mode 100644 index 0000000000..792f4d31e3 --- /dev/null +++ b/addons/missionmodules/CfgFactionClasses.hpp @@ -0,0 +1,6 @@ +class CfgFactionClasses { + class NO_CATEGORY; + class ACE_missionModules: NO_CATEGORY { + displayName = "ACE Mission Modules"; + }; +}; \ No newline at end of file diff --git a/addons/missionmodules/CfgVehicles.hpp b/addons/missionmodules/CfgVehicles.hpp new file mode 100644 index 0000000000..92c379efb2 --- /dev/null +++ b/addons/missionmodules/CfgVehicles.hpp @@ -0,0 +1,68 @@ +class CfgVehicles { + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits { + }; + }; + + // TODO make a curator variant for this + class ACE_moduleAmbianceSound: Module_F { + scope = 2; + displayName = "Ambiance Sounds [ACE]"; + icon = QUOTE(PATHTOF(data\moduleSound.paa)); + category = "ACE_missionModules"; + function = QUOTE(FUNC(moduleAmbianceSound)); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = "Glowbal"; + class Arguments { + class soundFiles { + displayName = "Sounds"; + description = "Classnames of the ambiance sounds played. Seperated by ','. "; + typeName = "STRING"; + defaultValue = ""; + }; + class minimalDistance { + displayName = "Minimal Distance"; + description = "Minimal Distance"; + typeName = "NUMBER"; + defaultValue = 400; + }; + class maximalDistance { + displayName = "Maximal Distance"; + description = "Maximal Distance"; + typeName = "NUMBER"; + defaultValue = 900; + }; + class minimalDelay { + displayName = "Minimal Delay"; + description = "Minimal Delay between sounds played"; + typeName = "NUMBER"; + defaultValue = 10; + }; + class maximalDelay { + displayName = "Maximal Delay"; + description = "Maximal Delay between sounds played"; + typeName = "NUMBER"; + defaultValue = 170; + }; + class followPlayers { + displayName = "Follow Players"; + description = "Follow players. If set to false, loop will play sounds only nearby logic position."; + typeName = "BOOL"; + defaultValue = 0; + }; + class soundVolume { + displayName = "Volume"; + description = "The volume of the sounds played"; + typeName = "NUMBER"; + defaultValue = 1; + }; + }; + class ModuleDescription { + description = "Ambiance sounds loop (synced across MP)"; + sync[] = {}; + }; + }; +}; diff --git a/addons/missionmodules/XEH_preInit.sqf b/addons/missionmodules/XEH_preInit.sqf new file mode 100644 index 0000000000..cadbbabdd1 --- /dev/null +++ b/addons/missionmodules/XEH_preInit.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(moduleAmbianceSound); + +ADDON = true; diff --git a/addons/missionmodules/config.cpp b/addons/missionmodules/config.cpp new file mode 100644 index 0000000000..0867b486c6 --- /dev/null +++ b/addons/missionmodules/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"cse_moduleAmbianceSound"}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"Glowbal"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgFactionClasses.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/missionmodules/data/moduleSound.paa b/addons/missionmodules/data/moduleSound.paa new file mode 100644 index 0000000000..bfe3b80327 Binary files /dev/null and b/addons/missionmodules/data/moduleSound.paa differ diff --git a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf new file mode 100644 index 0000000000..943d795b7a --- /dev/null +++ b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf @@ -0,0 +1,123 @@ +/* + * Author: Glowbal + * Plays synchronized ambiance sounds while the module is alive. + * + * Arguments: + * 0: Logic + * 1: Units + * 2: Activated + * + * Return Value: + * Nothing + * + * Example: + * N/A + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_logic", "_units", "_activated","_ambianceSounds", "_soundFiles", "_minimalDistance","_maximalDistance", "_minimalDistance", "_maxDelayBetweenSounds", "_allUnits", "_newPos", "_targetUnit", "_soundToPlay", "_soundPath", "_unparsedSounds", "_list", "_splittedList", "_nilCheckPassedList"]; +_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +_units = [_this,1,[],[[]]] call BIS_fnc_param; +_activated = [_this,2,true,[true]] call BIS_fnc_param; + +// We only play this on the locality of the logic, since the sounds are broadcasted across the network +if (_activated && local _logic) then { + _ambianceSounds = []; + _unparsedSounds = _logic getvariable ["soundFiles", ""]; + _minimalDistance = (_logic getvariable ["minimalDistance", 400]) max 1; + _maximalDistance = (_logic getvariable ["maximalDistance", 10]) max _minimalDistance; + _minDelayBetweensounds = (_logic getvariable ["minimalDelay", 10]) max 1; + _maxDelayBetweenSounds = (_logic getvariable ["maximalDelay", 170]) max _minDelayBetweensounds; + _volume = (_logic getvariable ["soundVolume", 30]) max 1; + _followPlayers = _logic getvariable ["followPlayers", false]; + + _splittedList = [_unparsedSounds, ","] call BIS_fnc_splitString; + + _nilCheckPassedList = ""; + { + _x = [_x] call EFUNC(common,string_removeWhiteSpace); + _splittedList set [_foreachIndex, _x]; + }foreach _splittedList; + + _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; + { + if (isclass (missionConfigFile >> "CfgSounds" >> _x)) then { + _ambianceSounds pushback (_soundPath + (getArray(missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0)); + } else { + if (isclass (configFile >> "CfgSounds" >> _x)) then { + _ambianceSounds pushback ((getArray(configFile >> "CfgSounds" >> _x >> "sound") select 0)); + }; + }; + }foreach _splittedList; + + if (count _ambianceSounds == 0) exitwith {}; + { + if !([".", _x, true] call BIS_fnc_inString) then { + _ambianceSounds set [_foreachIndex, _x + ".wss"]; + }; + }foreach _ambianceSounds; + + [{ + private ["_args", "_logic", "_ambianceSounds", "_minimalDistance", "_maximalDistance", "_minDelayBetweensounds", "_maxDelayBetweenSounds", "_volume", "_followPlayers","_lastTimePlayed", "_newPos"]; + _args = _this select 0; + _logic = _args select 0; + _minDelayBetweensounds = _args select 4; + _maxDelayBetweenSounds = _args select 5; + _lastTimePlayed = _args select 8; + + if (!alive _logic) exitwith { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; + + if (time - _lastTimePlayed >= ((_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds)) then { + _ambianceSounds = _args select 1; + _minimalDistance = _args select 2; + _maximalDistance = _args select 3; + + _volume = _args select 6; + _followPlayers = _args select 7; + + // Find all players in session. + _allUnits = if (isMultiplayer) then {playableUnits} else {[ACE_player]}; + + // Check if there are enough players to even start playing this sound. + if (count _allUnits > 0) then { + + // Select a target unit at random. + _targetUnit = _allUnits select (round(random((count _allUnits)-1))); + + // find the position from which we are going to play this sound from. + _newPos = (getPos _targetUnit); + if (!_followPlayers) then { + _newPos = getPos _logic; + }; + + // Randomize this position. + if (random(1) >= 0.5) then { + if (random(1) >= 0.5) then { + _newPos set [0, (_newPos select 0) + (_minimalDistance + random(_maximalDistance))]; + } else { + _newPos set [0, (_newPos select 0) - (_minimalDistance + random(_maximalDistance))]; + }; + } else { + if (random(1) >= 0.5) then { + _newPos set [1, (_newPos select 1) + (_minimalDistance + random(_maximalDistance))]; + } else { + _newPos set [1, (_newPos select 1) - (_minimalDistance + random(_maximalDistance))]; + }; + }; + + // If no unit is to close to this position, we will play the sound. + if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then { + playSound3D [_ambianceSounds select (round(random((count _ambianceSounds)-1))), ObjNull, false, _newPos, _volume, 1, 1000]; + _args set [8, time]; + }; + }; + }; + }, 0.1, [_logic, _ambianceSounds, _minimalDistance, _maximalDistance, _minDelayBetweensounds, _maxDelayBetweenSounds, _volume, _followPlayers, time] ] call cba_fnc_addPerFrameHandler; +}; + +true; diff --git a/addons/missionmodules/functions/script_component.hpp b/addons/missionmodules/functions/script_component.hpp new file mode 100644 index 0000000000..42d34d4801 --- /dev/null +++ b/addons/missionmodules/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\missionmodules\script_component.hpp" \ No newline at end of file diff --git a/addons/missionmodules/script_component.hpp b/addons/missionmodules/script_component.hpp new file mode 100644 index 0000000000..a567966c7b --- /dev/null +++ b/addons/missionmodules/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT missionModules +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_MISSIONMODULES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MISSIONMODULES + #define DEBUG_SETTINGS DEBUG_SETTINGS_MISSIONMODULES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/overpressure/$PBOPREFIX$ b/addons/overpressure/$PBOPREFIX$ new file mode 100644 index 0000000000..fc5a82e0f7 --- /dev/null +++ b/addons/overpressure/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\overpressure \ No newline at end of file diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp new file mode 100644 index 0000000000..40c3b32a57 --- /dev/null +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -0,0 +1,46 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +class Extended_FiredBIS_EventHandlers { + class CAManBase { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireLauncherBackblast)}); + }; + }; + + class Tank { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Car { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Helicopter { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Plane { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Ship_F { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; +}; diff --git a/addons/overpressure/CfgWeapons.hpp b/addons/overpressure/CfgWeapons.hpp new file mode 100644 index 0000000000..5880795ee2 --- /dev/null +++ b/addons/overpressure/CfgWeapons.hpp @@ -0,0 +1,49 @@ + +class CfgWeapons { + + class LauncherCore; + class Launcher: LauncherCore { + GVAR(angle) = 60; + GVAR(range) = 10; + GVAR(damage) = 0.7; + }; + + class Launcher_Base_F: Launcher {}; + + class launch_Titan_base: Launcher_Base_F { + GVAR(angle) = 40; + GVAR(range) = 8; + GVAR(damage) = 0.5; + }; + + class launch_Titan_short_base: launch_Titan_base { + GVAR(angle) = 40; + GVAR(range) = 8; + GVAR(damage) = 0.5; + }; + + class launch_NLAW_F: Launcher_Base_F { + GVAR(angle) = 40; + GVAR(range) = 5; + GVAR(damage) = 0.6; + }; + + class launch_RPG32_F: Launcher_Base_F { + GVAR(angle) = 60; + GVAR(range) = 15; + GVAR(damage) = 0.7; + }; + + class CannonCore; + class cannon_120mm: CannonCore { + GVAR(angle) = 90; + GVAR(range) = 50; + GVAR(damage) = 0.85; + }; + + class mortar_155mm_AMOS: CannonCore { + GVAR(angle) = 90; + GVAR(range) = 60; + GVAR(damage) = 1; + }; +}; diff --git a/addons/backblast/README.md b/addons/overpressure/README.md similarity index 94% rename from addons/backblast/README.md rename to addons/overpressure/README.md index 857776693a..3d3f242e40 100644 --- a/addons/backblast/README.md +++ b/addons/overpressure/README.md @@ -1,4 +1,4 @@ -ace_backblast +ace_overpressure ============= Adds backblast to AT launchers and overpressure zones to tank cannons. diff --git a/addons/overpressure/XEH_postInit.sqf b/addons/overpressure/XEH_postInit.sqf new file mode 100644 index 0000000000..33c2e679c9 --- /dev/null +++ b/addons/overpressure/XEH_postInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +["overpressure", FUNC(overpressureDamage)] call EFUNC(common,addEventHandler); diff --git a/addons/backblast/XEH_preInit.sqf b/addons/overpressure/XEH_preInit.sqf similarity index 50% rename from addons/backblast/XEH_preInit.sqf rename to addons/overpressure/XEH_preInit.sqf index ec4edb75bc..5eefc5eae4 100644 --- a/addons/backblast/XEH_preInit.sqf +++ b/addons/overpressure/XEH_preInit.sqf @@ -2,8 +2,9 @@ ADDON = false; +PREP(fireLauncherBackblast); +PREP(fireOverpressureZone); PREP(getDistance); -PREP(launcherBackblast); -PREP(tankDangerZone); +PREP(overpressureDamage); ADDON = true; diff --git a/addons/backblast/config.cpp b/addons/overpressure/config.cpp similarity index 85% rename from addons/backblast/config.cpp rename to addons/overpressure/config.cpp index 88de936cf9..4f866beedc 100644 --- a/addons/backblast/config.cpp +++ b/addons/overpressure/config.cpp @@ -6,12 +6,11 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi"}; + author[] = {"commy2","KoffeinFlummi","CAA-Picard"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" - #include "CfgWeapons.hpp" diff --git a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf new file mode 100644 index 0000000000..f42ffd23ed --- /dev/null +++ b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf @@ -0,0 +1,97 @@ +/* + * Author: commy2 and CAA-Picard + * + * Handle fire of local launchers + * + * Argument: + * 0: Unit that fired (Object) + * 1: Weapon fired (String) + * 2: Muzzle (String) + * 3: Mode (String) + * 4: Ammo (String) + * 5: Magazine (String) + * 6: Projectile (Object) + * + * Return value: + * None + */ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +// Prevent AI from causing backblast damage +if !([_firer] call EFUNC(common,isPlayer)) exitWith {}; + +private ["_position", "_direction"]; + +_position = getPosASL _projectile; +_direction = [0, 0, 0] vectorDiff (vectorDir _projectile); + +private ["_backblastAngle", "_backblastRange", "_backblastDamage"]; + +_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); + +// Damage to others +private "_affected"; +_affected = getPos _projectile nearEntities ["CAManBase", _backblastRange]; + +// Let each client handle their own affected units +["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); + +// Damage to the firer +private "_distance"; +_distance = [_position, _direction, _backblastRange] call FUNC(getDistance); + +TRACE_1("Distance",_distance); + +if (_distance < _backblastRange) then { + private ["_alpha", "_beta", "_damage"]; + + _alpha = sqrt (1 - _distance / _backblastRange); + _beta = sqrt 0.5; + + _damage = 2 * _alpha * _beta * _backblastDamage; + [_damage * 100] call BIS_fnc_bloodEffect; + + // TODO: Sort this interaction with medical + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { + [_firer, "HitBody", ([_firer, "", ((_firer getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); + } else { + _firer setDamage (damage _firer + _damage); + }; +}; + +// Draw debug lines +#ifdef DEBUG_MODE_FULL + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + private "_ref"; + _ref = _direction call EFUNC(common,createOrthonormalReference); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + [ _position, + _position vectorAdd (_direction vectorMultiply (_distance min _backblastRange)), + [1,0,0,1] + ] call EFUNC(common,addLineToDebugDraw); +#endif diff --git a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf new file mode 100644 index 0000000000..cc4918275d --- /dev/null +++ b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf @@ -0,0 +1,70 @@ +/* + * Author: commy2 and CAA-Picard + * + * Handle fire of local vehicle weapons creating overpressure zones + * + * Argument: + * 0: Unit that fired (Object) + * 1: Weapon fired (String) + * 2: Muzzle (String) + * 3: Mode (String) + * 4: Ammo (String) + * 5: Magazine (String) + * 6: Projectile (Object) + * + * Return value: + * None + */ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +// Prevent AI from causing overpressure damage +if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets? + +private ["_position", "_direction"]; + +_position = getPosASL _projectile; +_direction = vectorDir _projectile; + +private ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; + +_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); + +// Damage to others +private "_affected"; +_affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; + +// Let each client handle their own affected units +["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); + +// Draw debug lines +#ifdef DEBUG_MODE_FULL + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange), + [1,0,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + private "_ref"; + _ref = _direction call EFUNC(common,createOrthonormalReference); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + +#endif diff --git a/addons/overpressure/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf new file mode 100644 index 0000000000..6ffa60f7af --- /dev/null +++ b/addons/overpressure/functions/fnc_getDistance.sqf @@ -0,0 +1,40 @@ +/* + * Author: commy2 and CAA-Picard + * + * Calculate the distance to the first intersection of a line + * + * Argument: + * 0: Pos ASL of origin (Array) + * 1: Direction (Array) + * 2: Max distance to search (Number) + * + * Return value: + * Distance to intersection (+- 0.1 m) + */ +#include "script_component.hpp" + +EXPLODE_3_PVT(_this,_posASL,_direction,_maxDistance); + +private ["_distance", "_interval", "_line", "_intersections"]; + +_distance = _maxDistance; +_interval = _distance; +_line = [_posASL, []]; + +while { + _interval > 0.1 +} do { + _interval = _interval / 2; + + _line set [1, _posASL vectorAdd (_direction vectorMultiply _distance)]; + + _intersections = { + _x isKindOf "Static" || {_x isKindOf "AllVehicles"} + } count (lineIntersectsWith _line); + + _distance = _distance + ([1, -1] select (_intersections > 0 || {terrainIntersectASL _line})) * _interval; + + if (_distance > _maxDistance) exitWith {_distance = 999}; +}; + +_distance diff --git a/addons/overpressure/functions/fnc_overpressureDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf new file mode 100644 index 0000000000..c19fed1c04 --- /dev/null +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -0,0 +1,70 @@ +/* + * Author: commy2 and CAA-Picard + * + * Calculate and apply backblast damage to potentially affected local units + * + * Argument: + * 0: Unit that fired (Object) + * 1: Pos ASL of the projectile (Array) + * 2: Direction of the projectile (Array) + * 3: Weapon fired (String) + * + * Return value: + * None + */ +#include "script_component.hpp" + +EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon); + +private ["_overpressureAngle", "_overpressureRange", "_overpressureDamage"]; + +_overpressureAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_overpressureRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_overpressureDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); + +TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon); + +private "_pos"; +_pos = _posASL; +if (!surfaceIsWater _pos) then { + _pos = ASLtoATL _pos; +}; + +{ + if (local _x && {_x != _firer} && {vehicle _x == _x}) then { + private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"]; + + _targetPositionASL = eyePos _x; + _relativePosition = _targetPositionASL vectorDiff _posASL; + _axisDistance = _relativePosition vectorDotProduct _direction; + _distance = vectorMagnitude _relativePosition; + _angle = acos (_axisDistance / _distance); + + _line = [_posASL, _targetPositionASL, _firer, _x]; + _line2 = [_posASL, _targetPositionASL]; + TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); + + if (_angle < _overpressureAngle && {_distance < _overpressureRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { + private ["_alpha", "_beta", "_damage"]; + + _alpha = sqrt (1 - _distance / _overpressureRange); + _beta = sqrt (1 - _angle / _overpressureAngle); + + _damage = 2 * _alpha * _beta * _overpressureDamage; + + // If the target is the ACE_player + if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; + + // TODO: Sort this interaction with medical + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { + [_x, "HitBody", ([_x, "", (_x getHitPointDamage "HitBody") + _damage, objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); + _x spawn { + sleep 0.5; + [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); + }; + } else { + _x setDamage (damage _x + _damage); + }; + }; + }; +} forEach (_pos nearEntities ["CAManBase", _overpressureRange]); diff --git a/addons/overpressure/functions/script_component.hpp b/addons/overpressure/functions/script_component.hpp new file mode 100644 index 0000000000..d66ac7aec3 --- /dev/null +++ b/addons/overpressure/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\overpressure\script_component.hpp" \ No newline at end of file diff --git a/addons/overpressure/script_component.hpp b/addons/overpressure/script_component.hpp new file mode 100644 index 0000000000..8dac72cbbf --- /dev/null +++ b/addons/overpressure/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT overpressure +#include "\z\ace\Addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_OVERPRESSURE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_ENABLED_OVERPRESSURE + #define DEBUG_SETTINGS DEBUG_ENABLED_OVERPRESSURE +#endif + +#include "\z\ace\Addons\main\script_macros.hpp" \ No newline at end of file