-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interaction - Add open backpack action (#10525)
Co-authored-by: PabstMirror <[email protected]> Co-authored-by: johnb432 <[email protected]>
- Loading branch information
1 parent
f6a38c4
commit 7aeb6b5
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: DartRuffian | ||
* Checks if the player can open a unit's backpack. | ||
* | ||
* Arguments: | ||
* 0: Target <OBJECT> | ||
* 1: Player <OBJECT> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [cursorObject, player] call ace_interaction_fnc_canOpenBackpack | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_target", "_player"]; | ||
|
||
private _backpackContainer = backpackContainer _target; | ||
|
||
!isNull _backpackContainer && | ||
{!lockedInventory _backpackContainer} && | ||
{maxLoad _backpackContainer > 0} && | ||
{getNumber (configOf _backpackContainer >> "disableInventory") != 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: DartRuffian | ||
* Return a suitable position for the action point for the target's backpack. | ||
* | ||
* Arguments: | ||
* None (uses local variable _target) | ||
* | ||
* Return Value: | ||
* Position of _target's backpack in model space <ARRAY> | ||
* | ||
* Example: | ||
* call ace_interaction_fnc_getBackpackPos | ||
* | ||
* Public: No | ||
*/ | ||
|
||
//IGNORE_PRIVATE_WARNING ["_target"]; | ||
|
||
private _position = _target selectionPosition "spine3"; | ||
(((_target selectionPosition "rightshoulder" vectorDiff _position) vectorCrossProduct (_target selectionPosition "leftshoulder" vectorDiff _position)) vectorMultiply 4) vectorAdd _position; |
27 changes: 27 additions & 0 deletions
27
addons/interaction/functions/fnc_modifyOpenBackpackAction.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: DartRuffian | ||
* Modifies the ACE_OpenBackpack action to show backpack name. | ||
* | ||
* Arguments: | ||
* 0: Target <OBJECT> | ||
* 1: Player <OBJECT> | ||
* 2: Args <ANY> | ||
* 3: Action Data <ARRAY> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [cursorObject, player, [], []] call ace_interaction_fnc_modifyOpenBackpackAction | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_target", "_player", "", "_actionData"]; | ||
|
||
private _backpack = backpackContainer _target; | ||
private _actionText = format [localize "STR_ACTION_OPEN_BAG", getText (configOf _backpack >> "displayName")]; | ||
TRACE_3("",_target,_backpack,_actionText); | ||
|
||
_actionData set [1, _actionText]; |