diff --git a/addons/logistics_wirecutter/CfgVehicles.hpp b/addons/logistics_wirecutter/CfgVehicles.hpp index 41c47c70b8..8a16d1b828 100644 --- a/addons/logistics_wirecutter/CfgVehicles.hpp +++ b/addons/logistics_wirecutter/CfgVehicles.hpp @@ -1,98 +1,19 @@ -#define MACRO_CUTWIRE \ - class ACE_Wirecutter_cut { \ - displayName = "$STR_ACE_CutFence"; \ - distance = 4; \ - condition = QUOTE('ToolKit' in items _player && {alive _target}); \ - statement = QUOTE([ARR_2(5, _target)] call FUNC(cutDownFence)); \ - showDisabled = 1; \ - priority = 2.1; \ - icon = QUOTE(PATHTOF(ui\wirecutter_ca.paa)); \ - }; - -#define MACRO_CUTWIRE_LONG \ - class ACE_Wirecutter_cut { \ - displayName = "$STR_ACE_CutFence"; \ - distance = 4; \ - condition = QUOTE('ToolKit' in items _player && {alive _target}); \ - statement = QUOTE([ARR_2(5, _target)] call FUNC(cutDownFence)); \ - showDisabled = 1; \ - priority = 2.1; \ - icon = QUOTE(PATHTOF(ui\wirecutter_ca.paa)); \ - }; - class CfgVehicles { - - class Wall_F; - class Land_Net_Fence_4m_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(CutFence) { + displayName = "$STR_ACE_logistics_wirecutter_CutFence"; + condition = QUOTE([_player] call FUNC(canCutFence)); + statement = QUOTE([_player] call FUNC(cutDownFence)); + exceptions[] = {}; + showDisabled = 1; + priority = 0; + icon = PATHTOF(UI\wirecutter_ca.paa); + hotkey = "C"; + }; + }; }; }; - class Land_Net_Fence_8m_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE_LONG - }; - }; - class Land_Net_FenceD_8m_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; - class Land_New_WiredFence_5m_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; - class Land_New_WiredFence_10m_Dam_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; - class Land_New_WiredFence_10m_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE_LONG - }; - }; - class Land_Pipe_fence_4m_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; - class Land_Pipe_fence_4mNoLC_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; - class Land_SportGround_fence_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; - class Land_Wired_Fence_4m_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; - class Land_Wired_Fence_4mD_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; - class Land_Wired_Fence_8m_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE_LONG - }; - }; - class Land_Wired_Fence_8mD_F: Wall_F { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; - - class NonStrategic; - class Land_Razorwire_F: NonStrategic { - class ACE_Actions { - MACRO_CUTWIRE - }; - }; -}; +}; \ No newline at end of file diff --git a/addons/logistics_wirecutter/CfgWeapons.hpp b/addons/logistics_wirecutter/CfgWeapons.hpp new file mode 100644 index 0000000000..f2d35337a2 --- /dev/null +++ b/addons/logistics_wirecutter/CfgWeapons.hpp @@ -0,0 +1,16 @@ +class CfgWeapons { + class InventoryItem_Base_F; + class ACE_ItemCore; + + class ACE_wirecutter: ACE_ItemCore { + author = "$STR_ACE_Core_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/XEH_preInit.sqf b/addons/logistics_wirecutter/XEH_preInit.sqf index facd43451e..7588a109e6 100644 --- a/addons/logistics_wirecutter/XEH_preInit.sqf +++ b/addons/logistics_wirecutter/XEH_preInit.sqf @@ -2,8 +2,11 @@ ADDON = false; +PREP(canCutFence); PREP(cutDownFence); PREP(cutDownFenceAbort); PREP(cutDownFenceCallback); +PREP(getNearestFence); +PREP(isFence); ADDON = true; diff --git a/addons/logistics_wirecutter/config.cpp b/addons/logistics_wirecutter/config.cpp index 2cc1227a7d..9a48b83e46 100644 --- a/addons/logistics_wirecutter/config.cpp +++ b/addons/logistics_wirecutter/config.cpp @@ -15,3 +15,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgSounds.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/logistics_wirecutter/functions/fnc_canCutFence.sqf b/addons/logistics_wirecutter/functions/fnc_canCutFence.sqf new file mode 100644 index 0000000000..e5edf14c34 --- /dev/null +++ b/addons/logistics_wirecutter/functions/fnc_canCutFence.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" +PARAMS_1(_unit); + +("ACE_wirecutter" in (items _unit)) && {!(isNull ([_unit] call FUNC(getNearestFence)))} diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf index 092b6348b0..ea5f2590eb 100644 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf @@ -1,14 +1,13 @@ // by gpgpgpgp, edited by commy2 #include "script_component.hpp" -PARAMS_2(_timeToCut,_fenceObject); +PARAMS_1(_unit); +if (_unit != ACE_player) exitWith {}; -// if (cadetMode) then { - // { - // [ACE_player, "{_this groupChat localize 'STR_ACE_CuttingFenceChat'}", _x] call ACE_Core_fnc_execRemoteFnc; - // } forEach units group ACE_player; -// }; +_fenceObject = [ACE_player] call FUNC(getNearestFence); +if (isNull _fenceObject) exitWith {}; +_timeToCut = 5; if !([ACE_player] call EFUNC(common,isEngineer)) then { _timeToCut = _timeToCut + 5; }; diff --git a/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf b/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf new file mode 100644 index 0000000000..b8ba8898cd --- /dev/null +++ b/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf @@ -0,0 +1,13 @@ +#include "script_component.hpp" + +private "_nearestFence"; +PARAMS_1(_unit); + +_nearestFence = objNull; +{ + if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then { + _nearestFence = _x; + }; +} forEach nearestObjects [_unit, [], 5]; + +_nearestFence diff --git a/addons/logistics_wirecutter/functions/fnc_isFence.sqf b/addons/logistics_wirecutter/functions/fnc_isFence.sqf new file mode 100644 index 0000000000..178e0c0f39 --- /dev/null +++ b/addons/logistics_wirecutter/functions/fnc_isFence.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" + +#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"] + + +private ["_typeOf", "_returnValue"]; +PARAMS_1(_object); + +_typeOf = typeOf _object; +_returnValue = false; + +if (_typeOf != "") then { + systemChat format ["checking %1", _typeOf]; + _returnValue = _typeOf in FENCE_A3_TYPENAMES; +} else { + _typeOf = str _object; + { + if ((_typeOf find _x) != -1) then { + _returnValue = true; + }; + } forEach FENCE_A3_P3DS; +}; +_returnValue diff --git a/addons/logistics_wirecutter/stringtable.xml b/addons/logistics_wirecutter/stringtable.xml index b9ec851a81..cf6e96c1aa 100644 --- a/addons/logistics_wirecutter/stringtable.xml +++ b/addons/logistics_wirecutter/stringtable.xml @@ -2,7 +2,15 @@ - + + Wirecutter + Drahtschneider + Wirecutter + + + Wirecutter + + Cut Fence Zaun schneiden Cortar alambrado @@ -14,7 +22,7 @@ Drótkerítés átvágása Вырезать забор - + Cutting Fences / Wires ... Zaun / Draht schneiden ... Cortando alambrado / cables ... @@ -26,19 +34,7 @@ Drótok elvágása ... Вырезаем забор / провода ... - - Cutting Fences! - Schneide Zaun! - Cortando alambrado! - Przecinanie płotu! - Stříhání plotu! - Cisaillage! - Cortando Cerca! - La sto tagliando! - Átvágom a drótkerítést! - Вырезаем забор! - - + Fence cut Zaun geschnitten Alambrado cortado diff --git a/addons/logistics_wirecutter/ui/item_wirecutter_ca.paa b/addons/logistics_wirecutter/ui/item_wirecutter_ca.paa new file mode 100644 index 0000000000..768b061359 Binary files /dev/null and b/addons/logistics_wirecutter/ui/item_wirecutter_ca.paa differ