attach post CBAify. StackedEventHandlers needs converting to cba_fnc_addPerFrameHandler.

This commit is contained in:
jaynus 2015-01-11 10:33:44 -08:00
parent fa5098b169
commit ab46d7c0c8
8 changed files with 36 additions and 23 deletions

View File

@ -1,5 +1,5 @@
class CfgPatches { class CfgPatches {
class AGM_Attach { class ADDON {
units[] = {}; units[] = {};
weapons[] = {"AGM_IR_Strobe_Item"}; weapons[] = {"AGM_IR_Strobe_Item"};
requiredVersion = 0.60; requiredVersion = 0.60;
@ -13,9 +13,9 @@ class CfgPatches {
}; };
class CfgFunctions { class CfgFunctions {
class AGM_Attach { class ADDON {
class AGM_Attach { class ADDON {
file = "AGM_Attach\functions"; file = PATHTOF(functions);
class attach; class attach;
class canAttach; class canAttach;
class canDetach; class canDetach;
@ -35,24 +35,24 @@ class CfgVehicles {
class CAManBase: Man { class CAManBase: Man {
class AGM_SelfActions { class AGM_SelfActions {
class AGM_Equipment { class AGM_Equipment {
class AGM_Attach { class ADDON {
displayName = "$STR_AGM_Attach_AttachDetach"; displayName = "$STR_AGM_Attach_AttachDetach";
condition = "[_player, ''] call AGM_Attach_fnc_canAttach"; condition = QUOTE( [_player, ''] call FUNC(canAttach) );
statement = "[_player] call AGM_Attach_fnc_openAttachUI;"; statement = QUOTE( [_player] call FUNC(openAttachUI); );
exceptions[] = {"AGM_Drag_isNotDragging"}; exceptions[] = {"AGM_Drag_isNotDragging"};
showDisabled = 0; showDisabled = 0;
priority = 5; priority = 5;
icon = "\AGM_Attach\UI\attach_ca.paa"; icon = PATHTOF(UI\attach_ca.paa);
hotkey = "T"; hotkey = "T";
}; };
class AGM_Attach_Detach { class GVAR(Detach) {
displayName = "$STR_AGM_Attach_Detach"; displayName = "$STR_AGM_Attach_Detach";
condition = "[_player] call AGM_Attach_fnc_canDetach"; condition = QUOTE( [_player] call FUNC(canDetach );
statement = "[_player] call AGM_Attach_fnc_detach"; statement = QUOTE( [_player] call FUNC(detach) );
exceptions[] = {"AGM_Drag_isNotDragging"}; exceptions[] = {"AGM_Drag_isNotDragging"};
showDisabled = 0; showDisabled = 0;
priority = 5; priority = 5;
icon = "\AGM_Attach\UI\detach_ca.paa"; icon = PATHTOF(UI\detach_ca.paa);
hotkey = "T"; hotkey = "T";
}; };
}; };
@ -138,7 +138,7 @@ class CfgWeapons {
displayName = "$STR_AGM_IrStrobe_Name"; displayName = "$STR_AGM_IrStrobe_Name";
descriptionShort = "$STR_AGM_IrStrobe_Description"; descriptionShort = "$STR_AGM_IrStrobe_Description";
model = "\A3\weapons_F\ammo\mag_univ.p3d"; model = "\A3\weapons_F\ammo\mag_univ.p3d";
picture = "\AGM_Attach\UI\irstrobe_item.paa"; picture = PATHTOF(UI\irstrobe_item.paa);
scope = 2; scope = 2;
AGM_attachable = 1; AGM_attachable = 1;
class ItemInfo: InventoryItem_Base_F { class ItemInfo: InventoryItem_Base_F {

View File

@ -17,7 +17,7 @@ _unit = _this select 0;
_itemName = _this select 1; _itemName = _this select 1;
// Check if unit has an attached item // Check if unit has an attached item
if (_unit getVariable ["AGM_AttachedItemName", ""] != "") exitWith {}; if (_unit getVariable [QGVAR(ItemName), ""] != "") exitWith {};
// Check if the unit still has the item // Check if the unit still has the item
if !((_itemName in items _unit) or (_itemName in magazines _unit)) exitWith {}; if !((_itemName in items _unit) or (_itemName in magazines _unit)) exitWith {};
@ -56,5 +56,5 @@ switch true do {
// Remove item // Remove item
_unit removeItem _itemName; _unit removeItem _itemName;
_unit setVariable ["AGM_AttachedItemName", _itemName, true]; _unit setVariable [QGVAR(ItemName), _itemName, true];
_unit setVariable ["AGM_AttachedItem", _attachedItem, true]; _unit setVariable ["AGM_AttachedItem", _attachedItem, true];

View File

@ -16,4 +16,4 @@ private ["_unit", "_item"];
_unit = _this select 0; _unit = _this select 0;
_item = _this select 1; _item = _this select 1;
canStand _unit && {_unit getVariable ["AGM_AttachedItemName", ""] == ""} && {_item in (magazines _unit + items _unit + [""])} canStand _unit && {_unit getVariable [QGVAR(ItemName), ""] == ""} && {_item in (magazines _unit + items _unit + [""])}

View File

@ -14,4 +14,4 @@ private "_unit";
_unit = _this select 0; _unit = _this select 0;
canStand _unit && {_unit getVariable ["AGM_AttachedItemName", ""] != ""} canStand _unit && {_unit getVariable [QGVAR(ItemName), ""] != ""}

View File

@ -13,7 +13,7 @@ none
private ["_unit", "_itemName", "_count", "_attachedItem"]; private ["_unit", "_itemName", "_count", "_attachedItem"];
_unit = _this select 0; _unit = _this select 0;
_itemName = _unit getVariable ["AGM_AttachedItemName", ""]; _itemName = _unit getVariable [QGVAR(ItemName), ""];
// Check if unit has an attached item // Check if unit has an attached item
if (_itemName == "") exitWith {}; if (_itemName == "") exitWith {};
@ -27,7 +27,7 @@ if ((count items _unit) + (count magazines _unit) <= _count) exitWith {
if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") then { if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") then {
// Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle // Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle
[_unit getVariable "AGM_AttachedItem", _unit] spawn { [_unit getVariable QGVAR(Item), _unit] spawn {
_attachedItem = _this select 0; _attachedItem = _this select 0;
_unit = _this select 1; _unit = _this select 1;
detach _attachedItem; detach _attachedItem;
@ -39,12 +39,12 @@ if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "
else else
{ {
// Delete attached item // Delete attached item
deleteVehicle (_unit getVariable "AGM_AttachedItem"); deleteVehicle (_unit getVariable QGVAR(Item));
}; };
// Reset unit variables // Reset unit variables
_unit setVariable ["AGM_AttachedItemName","", true]; _unit setVariable [QGVAR(ItemName),"", true];
_unit setVariable ["AGM_AttachedItem",nil, true]; _unit setVariable [QGVAR(Item),nil, true];
// Display message // Display message
switch true do { switch true do {

View File

@ -53,7 +53,7 @@ _attachables = items _unit;
[ [
_actions, _actions,
{ {
[AGM_player, _this] call AGM_Attach_fnc_attach; [AGM_player, _this] call FUNC(attach);
call AGM_Interaction_fnc_hideMenu; call AGM_Interaction_fnc_hideMenu;
}, },
{ {

View File

@ -0,0 +1 @@
z\ace\Addons\laser

View File

@ -0,0 +1,12 @@
#define COMPONENT attach
#include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_ATTACH
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_ATTACH
#define DEBUG_SETTINGS DEBUG_SETTINGS_ATTACH
#endif
#include "\z\ace\Addons\main\script_macros.hpp"