diff --git a/addons/flags/CfgVehicles.hpp b/addons/flags/CfgVehicles.hpp index bf04c570aa..d9513d77f6 100644 --- a/addons/flags/CfgVehicles.hpp +++ b/addons/flags/CfgVehicles.hpp @@ -10,7 +10,7 @@ class CfgVehicles { icon = QPATHTOF(data\icons\place\white_place_icon.paa); class GVAR(furlFlag) { - displayName = CSTRING(furlFlag); + displayName = CSTRING(furl); condition = QUOTE(_player call FUNC(carriesFlag)); statement = QUOTE(_player call FUNC(furlFlag)); icon = QPATHTOF(data\icons\carry\white_furl_icon.paa); diff --git a/addons/flags/XEH_postInit.sqf b/addons/flags/XEH_postInit.sqf index a735b04ada..4f09eebd70 100644 --- a/addons/flags/XEH_postInit.sqf +++ b/addons/flags/XEH_postInit.sqf @@ -8,23 +8,23 @@ GVAR(isPlacing) = PLACE_CANCEL; [QGVAR(flagPlaced), { params ["_unit", "_item", "_flag"]; - (GVAR(cache) get _item) params ["_displayName"]; + TRACE_1("Somebody placed flag", _this); + + (GVAR(flagItemCache) get _item) params ["_displayName"]; private _pickupFlag = [ QGVAR(pickup), format [LLSTRING(pickup), _displayName], QPATHTOF(data\icons\place\white_pickup_icon.paa), { - params ["_flag", "_unit", "_args"]; - _args params ["_item"]; - + params ["_flag", "_unit", "_item"]; [_unit, _item, _flag] call FUNC(pickupFlag); }, {true}, {}, - [_item], - [0, 0, 0], - PICKUP_RADIUS + _item, + [0, -0.45, 0.75], + 2 ] call ace_interact_menu_fnc_createAction; [_flag, 0, [], _pickupFlag] call ace_interact_menu_fnc_addActionToObject; }] call CBA_fnc_addEventHandler; diff --git a/addons/flags/functions/fnc_addActions.sqf b/addons/flags/functions/fnc_addActions.sqf index 69a3fe15f6..65e2232e93 100644 --- a/addons/flags/functions/fnc_addActions.sqf +++ b/addons/flags/functions/fnc_addActions.sqf @@ -20,15 +20,18 @@ params ["_player"]; private _actions = []; { - (GVAR(flagItemCache) get _x) params ["_displayName", "_texture", "_actionIconPlace", "_actionIconCarry"]; + (GVAR(flagItemCache) get _x) params ["_flagName", "_texture", "_actionIconPlace", "_actionIconCarry"]; // Place flag _actions pushBack [ [ "place_" + _x, - format [LLSTRING(place), _displayName], + format [LLSTRING(place), _flagName], _actionIconPlace, - {[_this select 0, _this select 2] call FUNC(placeFlag)}, + { + params ["_player", "", "_item"]; + [_player, _item] call FUNC(placeFlag); + }, {true}, {}, _x @@ -41,10 +44,13 @@ private _actions = []; _actions pushBack [ [ "carry_" + _x, - format [LLSTRING(carry), _displayName], + format [LLSTRING(carry), _flagName], _actionIconCarry, - {[_this select 0, _this select 2] call FUNC(carryFlag)}, - {!([_this select 1] call FUNC(carriesFlag))}, // Should not carry flag already + { + params ["_player", "", "_item"]; + [_player, _item] call FUNC(carryFlag); + }, + {!([_this select 0] call FUNC(carriesFlag))}, // Should not carry flag already {}, _x ] call EFUNC(interact_menu,createAction), diff --git a/addons/flags/functions/fnc_pickupFlag.sqf b/addons/flags/functions/fnc_pickupFlag.sqf index 84677b7580..dd210f8651 100644 --- a/addons/flags/functions/fnc_pickupFlag.sqf +++ b/addons/flags/functions/fnc_pickupFlag.sqf @@ -18,13 +18,13 @@ */ params ["_unit", "_item", "_flag"]; +TRACE_3("Flag pickup", _unit, _item, _flag); [_unit, "PutDown"] call EFUNC(common,doGesture); -[{((animationState _unit) select [25,7]) isEqualTo "putdown"}, { +[{ params ["_unit", "_item", "_flag"]; [_unit, _item] call EFUNC(common,addToInventory); - deleteVehicle _flag; -}, _this] call CBA_fnc_waitUntilAndExecute; +}, [_unit, _item, _flag], 0.7] call CBA_fnc_waitAndExecute; diff --git a/addons/flags/functions/fnc_placeFlag.sqf b/addons/flags/functions/fnc_placeFlag.sqf index d3b7124e41..e82da77b64 100644 --- a/addons/flags/functions/fnc_placeFlag.sqf +++ b/addons/flags/functions/fnc_placeFlag.sqf @@ -18,6 +18,7 @@ */ params ["_player", "_item"]; +TRACE_2("Placing flag", _player, _item); // Create local object private _flag = "FlagChecked_F" createVehicle [0, 0, 0]; @@ -27,7 +28,9 @@ GVAR(objectHeight) = MIN_HEIGHT; GVAR(isPlacing) = PLACE_WAITING; -(GVAR(flagItemCache) get _x) params ["_flagName"]; +(GVAR(flagItemCache) get _item) params ["_flagName", "_texture"]; + +_flag setFlagTexture _texture; // Add info dialog for the player which show the controls private _placeFlagText = format [LLSTRING(place), _flagName]; @@ -59,12 +62,10 @@ private _mouseClickID = [_player, "DefaultAction", { [_player, "PutDown"] call EFUNC(common,doGesture); - [{(animationState _player select [25, 7]) isEqualTo "putdown"}, { - params ["_player", "_item", "_flag"]; + _player removeItem _item; - [QGVAR(flagPlaced), [_player, _item, _flag]] call CBA_fnc_globalEventJIP; - [QGVAR(flagPlaced), _flag] call CBA_fnc_removeGlobalEventJIP; - }, [_player, _item, _flag]] call CBA_fnc_waitUntilAndExecute; + private _jipID = [QGVAR(flagPlaced), [_player, _item, _flag]] call CBA_fnc_globalEventJIP; + [_jipID, _flag] call CBA_fnc_removeGlobalEventJIP; } else { // Action is canceled deleteVehicle _flag; diff --git a/addons/flags/script_component.hpp b/addons/flags/script_component.hpp index 99d6b04d49..7cac6efd70 100644 --- a/addons/flags/script_component.hpp +++ b/addons/flags/script_component.hpp @@ -24,5 +24,3 @@ #define MAX_HEIGHT 2 #define FLAG_PLACING_DISTANCE 2 - -#define PICKUP_RADIUS 2