From 23f47f97ae2b818381e6d42b4d7b4536cfc00ac5 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 15 Apr 2015 18:32:47 -0500 Subject: [PATCH 1/4] Wirecutter - better sound effects, cleanup --- .../logistics_wirecutter/CfgEventHandlers.hpp | 1 - addons/logistics_wirecutter/CfgSounds.hpp | 15 ++++-------- addons/logistics_wirecutter/CfgWeapons.hpp | 24 +++++++++---------- addons/logistics_wirecutter/config.cpp | 2 +- .../functions/fnc_cutDownFence.sqf | 19 ++++++++++----- .../functions/fnc_getNearestFence.sqf | 6 ++--- .../functions/fnc_interactEH.sqf | 2 +- .../functions/fnc_isFence.sqf | 13 +++++----- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/addons/logistics_wirecutter/CfgEventHandlers.hpp b/addons/logistics_wirecutter/CfgEventHandlers.hpp index 79c3aaa959..3daad1425a 100644 --- a/addons/logistics_wirecutter/CfgEventHandlers.hpp +++ b/addons/logistics_wirecutter/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/logistics_wirecutter/CfgSounds.hpp b/addons/logistics_wirecutter/CfgSounds.hpp index 9958190ec1..aa5f3464f6 100644 --- a/addons/logistics_wirecutter/CfgSounds.hpp +++ b/addons/logistics_wirecutter/CfgSounds.hpp @@ -1,12 +1,7 @@ class CfgSounds { - class ACE_Wirecutter_sound { - name = "ACE_wirecutter_sound"; - sound[] = {QUOTE(PATHTOF(sound\wire_cut.ogg)), "db-0", 1}; - titles[] = {}; - }; - class ACE_Wirecutter_sound_long { - name = "ACE_wirecutter_sound_long"; - sound[] = {QUOTE(PATHTOF(sound\wire_cut_long.ogg)), "db-0", 1}; - titles[] = {}; - }; + class ACE_Wirecutter_sound { + name = "ACE_wirecutter_sound"; + sound[] = {QUOTE(PATHTOF(sound\wirecut.ogg)), "db-0", 1}; + titles[] = {}; + }; }; diff --git a/addons/logistics_wirecutter/CfgWeapons.hpp b/addons/logistics_wirecutter/CfgWeapons.hpp index 76b1003f34..648bc3a3f8 100644 --- a/addons/logistics_wirecutter/CfgWeapons.hpp +++ b/addons/logistics_wirecutter/CfgWeapons.hpp @@ -1,16 +1,16 @@ class CfgWeapons { - class InventoryItem_Base_F; - class ACE_ItemCore; + class InventoryItem_Base_F; + class ACE_ItemCore; - class ACE_wirecutter: ACE_ItemCore { - author = "$STR_ACE_Common_ACETeam"; - displayName = "$STR_ACE_logistics_wirecutter_wirecutterName"; - descriptionShort = "$STR_ACE_logistics_wirecutter_wirecutterDescription"; - model = "\A3\weapons_F\ammo\mag_univ.p3d"; - picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa)); - scope = 2; - class ItemInfo: InventoryItem_Base_F { - mass = 100; + class ACE_wirecutter: ACE_ItemCore { + author = "$STR_ACE_Common_ACETeam"; + displayName = "$STR_ACE_logistics_wirecutter_wirecutterName"; + descriptionShort = "$STR_ACE_logistics_wirecutter_wirecutterDescription"; + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 100; + }; }; - }; }; diff --git a/addons/logistics_wirecutter/config.cpp b/addons/logistics_wirecutter/config.cpp index 6e1db15061..8e14bde892 100644 --- a/addons/logistics_wirecutter/config.cpp +++ b/addons/logistics_wirecutter/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { units[] = {}; - weapons[] = {}; + weapons[] = {"ACE_wirecutter"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; author[] = {"gpgpgpgp", "PabstMirror"}; diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf index ee4c512cd2..0186ea4b3a 100644 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf @@ -16,19 +16,26 @@ */ #include "script_component.hpp" +#define SOUND_CLIP_TIME_SPACEING 1.5 private ["_timeToCut"]; PARAMS_2(_unit,_fenceObject); if (_unit != ACE_player) exitWith {}; -_timeToCut = if ([ACE_player] call EFUNC(common,isEngineer)) then {5} else {10}; +_timeToCut = if ([ACE_player] call EFUNC(common,isEngineer)) then {7.5} else {11}; [ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); -if (_timeToCut > 5) then { - playSound "ACE_wirecutter_sound_long"; -} else { - playSound "ACE_wirecutter_sound"; +_progressCheck = { + PARAMS_2(_args,_passedTime); + EXPLODE_2_PVT(_args,_fenceObject,_lastSoundEffectTime); + if (_passedTime > (_lastSoundEffectTime + SOUND_CLIP_TIME_SPACEING)) then { + // playSound "ACE_wirecutter_sound"; + playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL ACE_player), 1, 1, 10]; + _args set [1, _passedTime]; + }; + + ((!isNull _fenceObject) && {(damage _fenceObject) < 1} && {("ACE_wirecutter" in (items ACE_player))}) }; -[_timeToCut, [_fenceObject], {(_this select 0) call FUNC(cutDownFenceCallback)}, {(_this select 0) call FUNC(cutDownFenceAbort)}, localize "STR_ACE_logistics_wirecutter_CuttingFence"] call EFUNC(common,progressBar); +[_timeToCut, [_fenceObject,0], {(_this select 0) call FUNC(cutDownFenceCallback)}, {(_this select 0) call FUNC(cutDownFenceAbort)}, localize "STR_ACE_logistics_wirecutter_CuttingFence", _progressCheck] call EFUNC(common,progressBar); diff --git a/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf b/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf index c9e59b41a0..15bfbdb8ef 100644 --- a/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf @@ -20,9 +20,9 @@ PARAMS_1(_unit); _nearestFence = objNull; { - if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then { - _nearestFence = _x; - }; + if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then { + _nearestFence = _x; + }; } forEach nearestObjects [_unit, [], 15]; _nearestFence diff --git a/addons/logistics_wirecutter/functions/fnc_interactEH.sqf b/addons/logistics_wirecutter/functions/fnc_interactEH.sqf index 6dace9c42d..ddd180047c 100644 --- a/addons/logistics_wirecutter/functions/fnc_interactEH.sqf +++ b/addons/logistics_wirecutter/functions/fnc_interactEH.sqf @@ -35,7 +35,7 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {}; } else { // Prevent Rare Error when ending mission with interact key down: if (isNull ace_player) exitWith {}; - + //If player moved >5 meters from last pos, then rescan if (((getPosASL ace_player) distance _setPosition) > 5) then { diff --git a/addons/logistics_wirecutter/functions/fnc_isFence.sqf b/addons/logistics_wirecutter/functions/fnc_isFence.sqf index aee9a22ef9..1ab97a67af 100644 --- a/addons/logistics_wirecutter/functions/fnc_isFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_isFence.sqf @@ -17,11 +17,9 @@ #include "script_component.hpp" //find is case sensitive, so keep everything lowercase -#define FENCE_A3_TYPENAMES ["land_net_fence_4m_f", "land_net_fence_8m_f", "land_net_fenced_8m_f", "land_new_wiredfence_5m_f", "land_new_wiredfence_10m_dam_f", "land_new_wiredfence_10m_f", "land_pipe_fence_4m_f", "land_pipe_fence_4mnolc_f", "land_sportground_fence_f", "land_wired_fence_4m_f", "land_wired_fence_4md_f", "land_wired_fence_8m_f", "land_wired_fence_8md_f", "land_razorwire_f"] -#define FENCE_A3_P3DS ["mil_wiredfence_f.p3d"] +#define FENCE_TYPENAMES ["land_net_fence_4m_f", "land_net_fence_8m_f", "land_net_fenced_8m_f", "land_new_wiredfence_5m_f", "land_new_wiredfence_10m_dam_f", "land_new_wiredfence_10m_f", "land_pipe_fence_4m_f", "land_pipe_fence_4mnolc_f", "land_sportground_fence_f", "land_wired_fence_4m_f", "land_wired_fence_4md_f", "land_wired_fence_8m_f", "land_wired_fence_8md_f", "land_razorwire_f"] -#define FENCE_AIA_TYPENAMES [] -#define FENCE_AIA_P3DS ["wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"] +#define FENCE_P3DS ["mil_wiredfence_f.p3d","wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"] private ["_typeOf", "_returnValue"]; PARAMS_1(_object); @@ -30,14 +28,15 @@ _typeOf = toLower (typeOf _object); _returnValue = false; if (_typeOf != "") then { - _returnValue = _typeOf in (FENCE_A3_TYPENAMES + FENCE_AIA_TYPENAMES); + //If the fence has configEntry we can check it directly + _returnValue = _typeOf in FENCE_TYPENAMES; } else { _typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d" { - if ((_typeOf find _x) != -1) then { + if ((_typeOf find _x) != -1) exitWith { _returnValue = true; }; - } forEach (FENCE_A3_P3DS + FENCE_AIA_P3DS); + } forEach FENCE_P3DS; }; _returnValue From 80516f4f6197c87e7fe9080cb1734b5d1461175a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 15 Apr 2015 22:27:12 -0500 Subject: [PATCH 2/4] Increase Sound Volume --- addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf index 0186ea4b3a..5153176de2 100644 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf @@ -31,7 +31,7 @@ _progressCheck = { EXPLODE_2_PVT(_args,_fenceObject,_lastSoundEffectTime); if (_passedTime > (_lastSoundEffectTime + SOUND_CLIP_TIME_SPACEING)) then { // playSound "ACE_wirecutter_sound"; - playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL ACE_player), 1, 1, 10]; + playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL ACE_player), 3, 1, 10]; _args set [1, _passedTime]; }; From 58dfc6aa97c80dae442483c477ae7c2816466287 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 15 Apr 2015 22:34:24 -0500 Subject: [PATCH 3/4] Add item to ace misc box --- addons/logistics_wirecutter/CfgVehicles.hpp | 8 ++++++++ addons/logistics_wirecutter/config.cpp | 1 + 2 files changed, 9 insertions(+) create mode 100644 addons/logistics_wirecutter/CfgVehicles.hpp diff --git a/addons/logistics_wirecutter/CfgVehicles.hpp b/addons/logistics_wirecutter/CfgVehicles.hpp new file mode 100644 index 0000000000..a31d9c0d99 --- /dev/null +++ b/addons/logistics_wirecutter/CfgVehicles.hpp @@ -0,0 +1,8 @@ +class CfgVehicles { + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_wirecutter,4); + }; + }; +}; diff --git a/addons/logistics_wirecutter/config.cpp b/addons/logistics_wirecutter/config.cpp index 8e14bde892..89fbd1c10f 100644 --- a/addons/logistics_wirecutter/config.cpp +++ b/addons/logistics_wirecutter/config.cpp @@ -15,3 +15,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgSounds.hpp" #include "CfgWeapons.hpp" +#include "CfgVehicles.hpp" From 7d5a70246b6f352d9a25e1e69927bfa8d7484f68 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 16 Apr 2015 22:10:33 -0500 Subject: [PATCH 4/4] Remove unnecessary cfgSounds --- addons/logistics_wirecutter/CfgSounds.hpp | 7 ------- addons/logistics_wirecutter/config.cpp | 1 - 2 files changed, 8 deletions(-) delete mode 100644 addons/logistics_wirecutter/CfgSounds.hpp diff --git a/addons/logistics_wirecutter/CfgSounds.hpp b/addons/logistics_wirecutter/CfgSounds.hpp deleted file mode 100644 index aa5f3464f6..0000000000 --- a/addons/logistics_wirecutter/CfgSounds.hpp +++ /dev/null @@ -1,7 +0,0 @@ -class CfgSounds { - class ACE_Wirecutter_sound { - name = "ACE_wirecutter_sound"; - sound[] = {QUOTE(PATHTOF(sound\wirecut.ogg)), "db-0", 1}; - titles[] = {}; - }; -}; diff --git a/addons/logistics_wirecutter/config.cpp b/addons/logistics_wirecutter/config.cpp index 89fbd1c10f..d83cff4035 100644 --- a/addons/logistics_wirecutter/config.cpp +++ b/addons/logistics_wirecutter/config.cpp @@ -13,6 +13,5 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" -#include "CfgSounds.hpp" #include "CfgWeapons.hpp" #include "CfgVehicles.hpp"