From 049edd1483702c0d5eba6e78dff3fac7f38c5d36 Mon Sep 17 00:00:00 2001 From: Kavinsky Date: Fri, 10 Apr 2015 03:49:50 +0200 Subject: [PATCH 1/6] Added ACE Attach posibility to add more types of attachable items --- addons/attach/CfgMagazines.hpp | 25 +++++++ addons/attach/CfgWeapons.hpp | 1 + addons/attach/functions/fnc_attach.sqf | 34 +++------ addons/attach/functions/fnc_detach.sqf | 15 ++-- addons/attach/stringtable.xml | 96 +++++++------------------- 5 files changed, 64 insertions(+), 107 deletions(-) diff --git a/addons/attach/CfgMagazines.hpp b/addons/attach/CfgMagazines.hpp index d63b8db36b..8a1b590e3b 100644 --- a/addons/attach/CfgMagazines.hpp +++ b/addons/attach/CfgMagazines.hpp @@ -3,10 +3,35 @@ class CfgMagazines { class CA_Magazine; class B_IR_Grenade: CA_Magazine { ACE_Attachable = 1; + ACE_attachable_effect = "B_IRStrobe"; + }; + + class O_IR_Grenade: B_IR_Grenade { + ACE_attachable_effect = "O_IRStrobe"; + }; + + class I_IR_Grenade: B_IR_Grenade { + ACE_attachable_effect = "I_IRStrobe"; }; class SmokeShell; class Chemlight_green: SmokeShell { ACE_Attachable = 1; + ACE_attachable_effect = "Chemlight_green"; + }; + + class Chemlight_blue: Chemlight_green { + ACE_Attachable = 1; + ACE_attachable_effect = "Chemlight_blue"; + }; + + class Chemlight_red: Chemlight_green { + ACE_Attachable = 1; + ACE_attachable_effect = "Chemlight_red"; + }; + + class Chemlight_yellow: Chemlight_green { + ACE_Attachable = 1; + ACE_attachable_effect = "Chemlight_yellow"; }; }; diff --git a/addons/attach/CfgWeapons.hpp b/addons/attach/CfgWeapons.hpp index 4ad34832c5..6737662f10 100644 --- a/addons/attach/CfgWeapons.hpp +++ b/addons/attach/CfgWeapons.hpp @@ -5,6 +5,7 @@ class CfgWeapons { class ACE_IR_Strobe_Item: ACE_ItemCore { ACE_attachable = 1; + ACE_attachable_effect = "ACE_IR_Strobe_Effect"; author = "$STR_ACE_Common_ACETeam"; scope = 2; displayName = "$STR_ACE_IrStrobe_Name"; diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 3703514fb6..3d9ecf4c3c 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -25,35 +25,19 @@ _itemClassname = [_args, 0, ""] call CBA_fnc_defaultParam; //Sanity Check (_unit has item in inventory, not over attach limit) if ((_itemClassname == "") || {!(_this call FUNC(canAttach))}) exitWith {ERROR("Tried to attach, but check failed");}; -_itemVehClass = ""; -_onAtachText = ""; _selfAttachPosition = [_unit, [-0.05, 0, 0.12], "rightshoulder"]; -switch (true) do { -case (_itemClassname == "ACE_IR_Strobe_Item"): { - _itemVehClass = "ACE_IR_Strobe_Effect"; - _onAtachText = localize "STR_ACE_Attach_IrStrobe_Attached"; - //_selfAttachPosition = [_unit, [0, -0.11, 0.16], "pilot"]; //makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri - }; -case (_itemClassname == "B_IR_Grenade"): { - _itemVehClass = "B_IRStrobe"; - _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; - }; -case (_itemClassname == "O_IR_Grenade"): { - _itemVehClass = "O_IRStrobe"; - _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; - }; -case (_itemClassname == "I_IR_Grenade"): { - _itemVehClass = "I_IRStrobe"; - _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; - }; -case (toLower _itemClassname in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]): { - _itemVehClass = _itemClassname; - _onAtachText = localize "STR_ACE_Attach_Chemlight_Attached"; - }; +_itemVehClass = getText (configFile >> "CfgWeapons" >> _itemClassname >> "ACE_attachable_effect"); +_onAtachText = getText (configFile >> "CfgWeapons" >> _itemClassname >> "displayName"); + +if (_itemVehClass == "") then { + _itemVehClass = getText (configFile >> "CfgMagazines" >> _itemClassname >> "ACE_attachable_effect"); + _onAtachText = getText (configFile >> "CfgMagazines" >> _itemClassname >> "displayName"); }; -if (_itemVehClass == "") exitWith {ERROR("no _itemVehClass for Item");}; +if (_itemVehClass == "") exitWith {ERROR("no ACE_attachable_effect for Item"); ERROR(_itemClassname);}; + +_onAtachText = format [localize "STR_ACE_Attach_Item_Attached", _onAtachText]; if (_unit == _attachToVehicle) then { //Self Attachment _unit removeItem _itemClassname; // Remove item diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index 124e5910d6..99ac646013 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -73,14 +73,9 @@ _attachToVehicle setVariable [QGVAR(Objects), _attachedObjects, true]; _attachToVehicle setVariable [QGVAR(ItemNames), _attachedItems, true]; // Display message -switch (true) do { -case (_itemName == "ACE_IR_Strobe_Item") : { - [localize "STR_ACE_Attach_IrStrobe_Detached"] call EFUNC(common,displayTextStructured); - }; -case (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) : { - [localize "STR_ACE_Attach_IrGrenade_Detached"] call EFUNC(common,displayTextStructured); - }; -case (toLower _itemName in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]) : { - [localize "STR_ACE_Attach_Chemlight_Detached"] call EFUNC(common,displayTextStructured); - }; +_itemDisplayName = getText (configFile >> "CfgWeapons" >> _itemName >> "displayName"); +if (_itemDisplayName == "") then { + _itemDisplayName = getText (configFile >> "CfgMagazines" >> _itemName >> "displayName"); }; + +[format [localize "STR_ACE_Attach_Item_Detached", _itemDisplayName]] call EFUNC(common,displayTextStructured); diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index 34e8883537..caa020ffb4 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -38,78 +38,6 @@ Tárgy lecsatolása Отсоединить - - IR Strobe Attached - IR-Stroboskop befestigt - Marcador IR acoplado - Przyczepiono stroboskop IR - Strobe IR attaché - IR Značkovač Připnutý - Marcador IV Acoplado - Strobo IR attaccata - Infravörös jeladó hozzácsatolva - ИК строб присоединён - - - IR Strobe Detached - IR-Stroboskop entfernt - Marcador IR quitado - Odczepiono stroboskop IR - Strobe IR détaché - IR Značkovač Odepnutý - Marcador IV Separado - Strobo IR staccata - Infravörös jeladó lecsatolva - ИК строб отсоединён - - - IR Grenade Attached - IR-Granate befestigt - Granada IR acoplada - Przyczepiono granat IR - Grenade IR attachée - IR Granát Připnutý - Granada IV Acoplada - Granata IR attaccata - Infravörös gránát hozzácsatolva - ИК граната присоединена - - - IR Grenade Detached - IR-Granate entfernt - Granada IR quitada - Odczepiono granat IR - Grenade IR détachée - IR Granát Odepnutý - Granada IV Separada - Granata IR staccata - Infravörös gránát lecsatolva - ИК граната отсоединена - - - Chemlight Attached - Leuchtstab befestigt - Barra de luz acoplada - Przyczepiono światło chemiczne - Chemlight attaché - Chemické světlo Připnuto - Chemlight Acoplada - Chemlight attaccata - Chemlight hozzácsatolva - Химсвет присоединён - - - Chemlight Detached - Leuchtstab entfernt - Barra de luz quitada - Odczepiono światło chemiczne - Chemlight détaché - Chemické světlo Odepnuto - Chemlight Separada - Chemlight staccata - Chemlight hozzácsatolva - Химсвет отсоединён - No inventory space Kein Platz im Inventar @@ -175,5 +103,29 @@ Присоединить Ошибка Error al acoplar + + %1 Attached + %1 befestigt + %1 acoplada + Przyczepiono %1 + %1 attachée + %1 Připnutý + %1 Acoplada + %1 attaccata + %1 hozzácsatolva + %1 присоединена + + + %1 Detached + %1 entfernt + %1 quitada + Odczepiono %1 + %1 détachée + %1 Odepnutý + %1 Separada + %1 staccata + %1 lecsatolva + %1 отсоединена + From 999ad49fd02bc7e666579804e1c8dcbdcd783c31 Mon Sep 17 00:00:00 2001 From: Kavinsky Date: Fri, 10 Apr 2015 03:58:14 +0200 Subject: [PATCH 2/6] removed duplicated debugging error --- addons/attach/functions/fnc_attach.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 3d9ecf4c3c..654932824a 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -35,7 +35,7 @@ if (_itemVehClass == "") then { _onAtachText = getText (configFile >> "CfgMagazines" >> _itemClassname >> "displayName"); }; -if (_itemVehClass == "") exitWith {ERROR("no ACE_attachable_effect for Item"); ERROR(_itemClassname);}; +if (_itemVehClass == "") exitWith {ERROR("no ACE_attachable_effect for Item");}; _onAtachText = format [localize "STR_ACE_Attach_Item_Attached", _onAtachText]; From adaee74a576260573236641f5ea7a008df8a47c1 Mon Sep 17 00:00:00 2001 From: Kavinsky Date: Fri, 10 Apr 2015 04:00:26 +0200 Subject: [PATCH 3/6] removed config redundancy --- addons/attach/CfgMagazines.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/attach/CfgMagazines.hpp b/addons/attach/CfgMagazines.hpp index 8a1b590e3b..a8b56c76ed 100644 --- a/addons/attach/CfgMagazines.hpp +++ b/addons/attach/CfgMagazines.hpp @@ -21,17 +21,14 @@ class CfgMagazines { }; class Chemlight_blue: Chemlight_green { - ACE_Attachable = 1; ACE_attachable_effect = "Chemlight_blue"; }; class Chemlight_red: Chemlight_green { - ACE_Attachable = 1; ACE_attachable_effect = "Chemlight_red"; }; class Chemlight_yellow: Chemlight_green { - ACE_Attachable = 1; ACE_attachable_effect = "Chemlight_yellow"; }; }; From b49fec58e6c64740c4bfb274cc03245d92afbb14 Mon Sep 17 00:00:00 2001 From: Kavinsky Date: Fri, 10 Apr 2015 04:35:21 +0200 Subject: [PATCH 4/6] Updated stringtable --- addons/attach/stringtable.xml | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index caa020ffb4..86c260b35f 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -104,28 +104,28 @@ Error al acoplar - %1 Attached - %1 befestigt - %1 acoplada - Przyczepiono %1 - %1 attachée - %1 Připnutý - %1 Acoplada - %1 attaccata - %1 hozzácsatolva - %1 присоединена + %1<br/>Attached + %1<br/>befestigt + %1<br/>acoplada + %1<br/>Przyczepiono + %1<br/>attachée + %1<br/>Připnutý + %1<br/>Acoplada + %1<br/>attaccata + %1<br/>hozzácsatolva + %1<br/>присоединена - %1 Detached - %1 entfernt - %1 quitada - Odczepiono %1 - %1 détachée - %1 Odepnutý - %1 Separada - %1 staccata - %1 lecsatolva - %1 отсоединена + %1<br/>Detached + %1<br/>entfernt + %1<br/>quitada + %1<br/>Odczepiono + %1<br/>détachée + %1<br/>Odepnutý + %1<br/>Separada + %1<br/>staccata + %1<br/>lecsatolva + %1<br/>отсоединена From a118cae13d0146bb33d6b8fe942a135f923c3bd0 Mon Sep 17 00:00:00 2001 From: Kavinsky Date: Fri, 10 Apr 2015 04:36:28 +0200 Subject: [PATCH 5/6] unified ACE_Attachable config entry now ACE_Attachable its a string and hold the effect for the item --- addons/attach/CfgMagazines.hpp | 16 +++++++--------- addons/attach/CfgWeapons.hpp | 3 +-- addons/attach/functions/fnc_attach.sqf | 6 +++--- .../functions/fnc_getChildrenAttachActions.sqf | 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/addons/attach/CfgMagazines.hpp b/addons/attach/CfgMagazines.hpp index a8b56c76ed..a000222adc 100644 --- a/addons/attach/CfgMagazines.hpp +++ b/addons/attach/CfgMagazines.hpp @@ -2,33 +2,31 @@ class CfgMagazines { class CA_Magazine; class B_IR_Grenade: CA_Magazine { - ACE_Attachable = 1; - ACE_attachable_effect = "B_IRStrobe"; + ACE_Attachable = "B_IRStrobe"; }; class O_IR_Grenade: B_IR_Grenade { - ACE_attachable_effect = "O_IRStrobe"; + ACE_Attachable = "O_IRStrobe"; }; class I_IR_Grenade: B_IR_Grenade { - ACE_attachable_effect = "I_IRStrobe"; + ACE_Attachable = "I_IRStrobe"; }; class SmokeShell; class Chemlight_green: SmokeShell { - ACE_Attachable = 1; - ACE_attachable_effect = "Chemlight_green"; + ACE_Attachable = "Chemlight_green"; }; class Chemlight_blue: Chemlight_green { - ACE_attachable_effect = "Chemlight_blue"; + ACE_Attachable = "Chemlight_blue"; }; class Chemlight_red: Chemlight_green { - ACE_attachable_effect = "Chemlight_red"; + ACE_Attachable = "Chemlight_red"; }; class Chemlight_yellow: Chemlight_green { - ACE_attachable_effect = "Chemlight_yellow"; + ACE_Attachable = "Chemlight_yellow"; }; }; diff --git a/addons/attach/CfgWeapons.hpp b/addons/attach/CfgWeapons.hpp index 6737662f10..9734ceb273 100644 --- a/addons/attach/CfgWeapons.hpp +++ b/addons/attach/CfgWeapons.hpp @@ -4,8 +4,7 @@ class CfgWeapons { class InventoryItem_Base_F; class ACE_IR_Strobe_Item: ACE_ItemCore { - ACE_attachable = 1; - ACE_attachable_effect = "ACE_IR_Strobe_Effect"; + ACE_attachable = "ACE_IR_Strobe_Effect"; author = "$STR_ACE_Common_ACETeam"; scope = 2; displayName = "$STR_ACE_IrStrobe_Name"; diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 654932824a..3bb54eee16 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -27,15 +27,15 @@ if ((_itemClassname == "") || {!(_this call FUNC(canAttach))}) exitWith {ERROR(" _selfAttachPosition = [_unit, [-0.05, 0, 0.12], "rightshoulder"]; -_itemVehClass = getText (configFile >> "CfgWeapons" >> _itemClassname >> "ACE_attachable_effect"); +_itemVehClass = getText (configFile >> "CfgWeapons" >> _itemClassname >> "ACE_Attachable"); _onAtachText = getText (configFile >> "CfgWeapons" >> _itemClassname >> "displayName"); if (_itemVehClass == "") then { - _itemVehClass = getText (configFile >> "CfgMagazines" >> _itemClassname >> "ACE_attachable_effect"); + _itemVehClass = getText (configFile >> "CfgMagazines" >> _itemClassname >> "ACE_Attachable"); _onAtachText = getText (configFile >> "CfgMagazines" >> _itemClassname >> "displayName"); }; -if (_itemVehClass == "") exitWith {ERROR("no ACE_attachable_effect for Item");}; +if (_itemVehClass == "") exitWith {ERROR("no ACE_Attachable for Item");}; _onAtachText = format [localize "STR_ACE_Attach_Item_Attached", _onAtachText]; diff --git a/addons/attach/functions/fnc_getChildrenAttachActions.sqf b/addons/attach/functions/fnc_getChildrenAttachActions.sqf index 6ff9410475..3594e10bd6 100644 --- a/addons/attach/functions/fnc_getChildrenAttachActions.sqf +++ b/addons/attach/functions/fnc_getChildrenAttachActions.sqf @@ -26,7 +26,7 @@ _actions = []; if !(_x in _listed) then { _listed pushBack _x; _item = ConfigFile >> "CfgMagazines" >> _x; - if (getNumber (_item >> "ACE_Attachable") == 1) then { + if (getText (_item >> "ACE_Attachable") != "") then { _displayName = getText(_item >> "displayName"); _picture = getText(_item >> "picture"); _action = [_x, _displayName, _picture, {_this call FUNC(attach)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); @@ -39,7 +39,7 @@ _actions = []; if !(_x in _listed) then { _listed pushBack _x; _item = ConfigFile >> "CfgWeapons" >> _x; - if (getNumber (_item >> "ACE_Attachable") == 1) then { + if (getText (_item >> "ACE_Attachable") != "") then { _displayName = getText(_item >> "displayName"); _picture = getText(_item >> "picture"); _action = [_x, _displayName, _picture, {_this call FUNC(attach)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); From 7c2b1a4ecc158b43499cc1423f5e38c1b4f5779b Mon Sep 17 00:00:00 2001 From: Kavinsky Date: Fri, 10 Apr 2015 17:03:07 +0200 Subject: [PATCH 6/6] Added Kavinsky to AUTHORS.txt --- AUTHORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.txt b/AUTHORS.txt index b931d774ac..4fac690aa4 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -65,3 +65,4 @@ simon84 Tonic Tourorist Valentin Torikian +Kavinsky \ No newline at end of file