-
Notifications
You must be signed in to change notification settings - Fork 740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interaction - Add Interaction to take another players launcher #10541
Open
Cplhardcore
wants to merge
14
commits into
acemod:master
Choose a base branch
from
Cplhardcore:AT-Grab
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+133
−0
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
252332f
Initial
Cplhardcore b99c2d0
Delete fnc_passLauncher.sqf
Cplhardcore ddbe7f8
weee
Cplhardcore 5ce2e39
rework
Cplhardcore 0305f3f
Update fnc_takeLauncher.sqf
Cplhardcore a8c251a
Update fnc_takeLauncher.sqf
Cplhardcore 4d878a3
Update addons/interaction/functions/fnc_takeLauncher.sqf
Cplhardcore ec26dc6
Tabs to spaces
Cplhardcore 035a886
Update fnc_takeLauncher.sqf
Cplhardcore d4cf48c
Update addons/interaction/functions/fnc_takeLauncher.sqf
Cplhardcore 4a24432
Update addons/interaction/initSettings.inc.sqf
Cplhardcore 8a49044
Update addons/interaction/functions/fnc_takeLauncher.sqf
Cplhardcore 83ec64e
Update addons/interaction/functions/fnc_takeLauncher.sqf
Cplhardcore 32b594a
Update addons/interaction/initSettings.inc.sqf
Cplhardcore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,28 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: Timi007, Cplhardcore | ||
* Checks if target unit can accept given launcher. | ||
* Does not check if the launcher exists in the inventory of the player. | ||
* | ||
* Arguments: | ||
* 0: Unit that passes the launcher <OBJECT> | ||
* 1: Unit to pass the launcher to <OBJECT> | ||
* 2: Launcher classname <STRING> | ||
* | ||
* Return Value: | ||
* Unit can pass launcher <BOOL> | ||
* | ||
* Example: | ||
* [_player, _target, "launch_NLAW_F"] call ace_interaction_fnc_canTakeLauncher | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_player", "_target"]; | ||
if (GVAR(enableLauncherTaking) && | ||
secondaryWeapon _target != "" && | ||
secondaryWeapon _player == "" && | ||
isNull objectParent _target && | ||
isNull objectParent _player && | ||
side _target == side _player) exitWith {true}; | ||
false | ||
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,59 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: Timi007. Cplhardcore | ||
* Pass launcher to another unit. | ||
* | ||
* Arguments: | ||
* 0: Unit that passes the launcher <OBJECT> | ||
* 1: Unit to pass the launcher to <OBJECT> | ||
* 2: Launcher classname <STRING> | ||
* | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [_player, _target, "launch_NLAW_F"] call ace_interaction_fnc_passLauncher | ||
* | ||
* Public: No | ||
*/ | ||
params ["_player", "_target", "_launcher"]; | ||
TRACE_3("Take launcher params",_player,_target,_launcher); | ||
|
||
private _playerName = [_player] call EFUNC(common,getName); | ||
private _cfgWeapons = configFile >> "CfgWeapons" >> _launcher; | ||
private _displayName = getText (_cfgWeapons >> "displayName"); | ||
[QEGVAR(common,displayTextStructured), [[LSTRING(TakingLauncherHint), _playerName, _displayName], 1.5, _target], _target] call CBA_fnc_targetEvent; | ||
|
||
if (_launcher isEqualTo "") exitWith {ERROR("No launcher specified.")}; | ||
if (secondaryWeapon _player isNotEqualTo "") exitWith {ERROR("Cannot add launcher to target due to lack of inventory space.")}; | ||
[_player, _target, 0] call FUNC(tapShoulder); | ||
[GVAR(launcherTime), | ||
[_player, _target, _launcher, _displayName], | ||
{ | ||
params ["_args"]; | ||
_args params ["_player", "_target", "_launcher", "_displayName"]; | ||
TRACE_4("launcher params",_player,_target,_launcher,_displayName); | ||
private _items = (getUnitLoadout _target) select 1; | ||
|
||
private _magazines = _items select [4, 2]; | ||
_items deleteRange [4, 2]; | ||
|
||
_target removeWeapon _launcher; | ||
|
||
[_player, _launcher, true, _magazines] call EFUNC(common,addWeapon); | ||
|
||
// Add attachments | ||
{ | ||
_player addWeaponItem [_launcher, _x, true]; | ||
} forEach (_items select {_x != ""}); | ||
|
||
[_player, "PutDown"] call EFUNC(common,doGesture); | ||
|
||
private _playerName = [_player] call EFUNC(common,getName); | ||
private _targetName = [_target] call EFUNC(common,getName); | ||
[QEGVAR(common,displayTextStructured), [[LSTRING(GaveLauncherHint), _playerName, _displayName], 1.5, _target], _target] call CBA_fnc_targetEvent; | ||
[QEGVAR(common,displayTextStructured), [[LSTRING(TookLauncherHint), _targetName, _displayName], 1.5, _player], _player] call CBA_fnc_targetEvent; | ||
[_player, _target, 0] call FUNC(tapShoulder); | ||
}, | ||
{}, LLSTRING(PassingLauncher)] call EFUNC(common,progressBar); |
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 |
---|---|---|
|
@@ -78,3 +78,18 @@ | |
[[0, 1, 2], [ELSTRING(common,Never), LSTRING(interactWithEnemyCrew_allowCSW), ELSTRING(common,Always)], 0], | ||
true | ||
] call CBA_fnc_addSetting; | ||
|
||
[ | ||
QGVAR(enableLauncherTaking), "CHECKBOX", | ||
LSTRING(takeLauncherSetting), | ||
format ["ACE %1", LLSTRING(DisplayName)], | ||
true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
] call CBA_fnc_addSetting; | ||
|
||
[ | ||
QGVAR(launcherTime), "SLIDER", | ||
LSTRING(takeLauncherTime), | ||
format ["ACE %1", LLSTRING(DisplayName)], | ||
[1, 20, 5, 0], | ||
1 | ||
] call CBA_fnc_addSetting; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd personally also wrap every single statement in a lazy eval, but I haven't tested the performance impact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this would work when the target is unconscious, as
side
changes. Imo would be better to check if the sides have friendly relations (using the sides of the group).