mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix placing and picking up flags
This commit is contained in:
parent
f6500a52c0
commit
e86fbf4888
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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),
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -24,5 +24,3 @@
|
||||
#define MAX_HEIGHT 2
|
||||
|
||||
#define FLAG_PLACING_DISTANCE 2
|
||||
|
||||
#define PICKUP_RADIUS 2
|
||||
|
Loading…
Reference in New Issue
Block a user