Skip to content
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

Add Unpack Static Weapon module #378

Open
wants to merge 75 commits into
base: master
Choose a base branch
from

Conversation

ampersand38
Copy link
Member

When merged this pull request will:

@BrettMayson
Copy link
Contributor

BrettMayson commented May 14, 2020

I think there should be some settings added here, maybe one for max range between the two units. It would also be interesting to see if we could get the assistant to go to the gunner if they are outside that range.

@CreepPork
Copy link
Member

@ampersand38
Use a text editor that supports the .editorconfig file. It seems that your editor is using tabs not spaces which is disallowed.

@CreepPork CreepPork added the feature Adds a new feature label May 14, 2020
@CreepPork CreepPork added this to the 1.8.0 milestone May 14, 2020
@ampersand38
Copy link
Member Author

I think there should be some settings added here, maybe one for max range between the two units. It would also be interesting to see if we could get the assistant to go to the gunner if they are outside that range.

Ah! I'm just learning about editorconfig now. Will try again to get it to work. Thanks.

addons/modules/XEH_PREP.hpp Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
@ampersand38
Copy link
Member Author

Much appreciated for the review @CreepPork. I'll aim to adhere to the standards.

@mharis001 mharis001 modified the milestones: 1.8.0, 1.9.0 May 19, 2020
@ampersand38
Copy link
Member Author

I think there should be some settings added here, maybe one for max range between the two units. It would also be interesting to see if we could get the assistant to go to the gunner if they are outside that range.

I haven't had a lot of success getting the weapon carriers to move together while under fire, even when pulling apart something like https://github.com/acemod/ACE3/blob/master/addons/ai/functions/fnc_garrisonMove.sqf

It may be a case of "don't use this when players can clearly observe that the ai can't do this".

Copy link
Member

@mharis001 mharis001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently looks weird having the gunner and assistant apart from each other. Should definitely try to get them to move towards each other.

Maybe have the gunner perform an action to get in the turret instead of immediately moving them in.

addons/ai/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
@ampersand38
Copy link
Member Author

Currently looks weird not having the gunner and assistant apart from each other. Should definitely try to get them to move towards each other.

I seem to have this working!

Maybe have the gunner perform an action to get in the turret instead of immediately moving them in.

When I use orderGetIn the AI just run a little circle and then teleport in anyway. It seems there's no getIn animation for these turrets.

https://youtu.be/6h9xUblJzlI

Copy link
Member

@mharis001 mharis001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works a little bit better in combat but, still fails in some situations. Maybe try using setBehaviour and setCombatMode on the group.

Also, currently you do some handling for the weapon assembly in the module's function (movement, behaviour) and some in unpackStaticWeapon. All of it should be handled in unpackStaticWeapon, the module should just call the ai component's function.

addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
@ampersand38
Copy link
Member Author

Works a little bit better in combat but, still fails in some situations. Maybe try using setBehaviour and setCombatMode on the group.

Also, currently you do some handling for the weapon assembly in the module's function (movement, behaviour) and some in unpackStaticWeapon. All of it should be handled in unpackStaticWeapon, the module should just call the ai component's function.

I didn't want to stop the rest of the group from firing, so I'm having the assistant join his own group and managing behaviour from there.

I've also moved the pfh to the AI addon.

addons/ai/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeaponPFH.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeaponPFH.sqf Outdated Show resolved Hide resolved
Copy link
Member

@mharis001 mharis001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The weapon assembly works consistently now both in and out of combat 👍 . However, the gunner will sometimes not get into the weapon when in combat. May need to switch back to using moveInGunner to make that work.

Also, should add the static weapon to curator editable objects.

addons/ai/functions/fnc_unpackStaticWeaponPFH.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeaponPFH.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeaponPFH.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeaponPFH.sqf Outdated Show resolved Hide resolved
addons/modules/stringtable.xml Outdated Show resolved Hide resolved
Copy link
Member

@mharis001 mharis001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just some code cleanup.

A bit weird in terms of structure that unpackStaticWeaponPFH is called first. I think it should be the other way around where unpackStaticWeapon deals with all of the setup and starting the PFH if needed.

addons/ai/functions/fnc_unpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeaponPFH.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeaponPFH.sqf Outdated Show resolved Hide resolved
addons/ai/functions/fnc_unpackStaticWeaponPFH.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
addons/modules/functions/fnc_moduleUnpackStaticWeapon.sqf Outdated Show resolved Hide resolved
@mharis001 mharis001 modified the milestones: 1.9.0, 1.10.0 Aug 25, 2020
@mharis001
Copy link
Member

Pushing to 1.10 since I think there is some cleanup left to do as well as consider:

  • groups with players.
  • single backpack static weapons.
  • selecting the closest assistant if multiple are possible.

@Bummeri
Copy link

Bummeri commented Oct 12, 2020

Deploy_static.zip

You can use that potrait if you like for the module

- Dropping module on unit in the same group as a player will only show a message
- Single-bag weapons such as UAVs and Remote Designators are now supported
- Check all compatible assistants and choose the closest one
- Error msg if closest assistant is over 100m away since it would probably take too long
@mharis001 mharis001 modified the milestones: 1.10.0, 1.11.0 Feb 3, 2021
Comment on lines +30 to +33
private _group = group _assistant;
_group setBehaviourStrong "CARELESS";
_group deleteGroupWhenEmpty true;
_group enableAttack false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably use new setCombatBehaviour and setUnitCombatMode commands to avoid affecting the entire group. Also, likely make units more responsive even in combat.

[QEGVAR(common,addObjects), [[_weapon]]] call CBA_fnc_serverEvent;

private _targetPos = _gunner getVariable [QGVAR(unpackStaticWeaponTargetPos), []];
if (!(_targetPos isEqualTo [])) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNotEqualTo.

[_gunner, _assistant, _targetPos] call FUNC(unpackStaticWeaponPFH);
};

if (!(_targetPos isEqualTo [])) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNotEqualTo.

[QGVAR(unpackStaticWeapon), _this, _gunner] call CBA_fnc_targetEvent;
};

if (!(_targetPos isEqualTo [])) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNotEqualTo.


private _assembleInfo = ["assembleTo", "base", "displayName", "dissasembleTo", "primary"] apply {(configOf backpackContainer _gunner >> "assembleInfo" >> _x) call BIS_fnc_getCfgData};
_assembleInfo params ["_assembleTo", "_compatibleBases", "_displayName", "_dissasembleTo", "_primary"];
if (_compatibleBases isEqualType "") then {_compatibleBases = [];};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-line.


private _assembleInfo = ["assembleTo", "base", "displayName", "dissasembleTo", "primary"] apply {(configOf backpackContainer _gunner >> "assembleInfo" >> _x) call BIS_fnc_getCfgData};
_assembleInfo params ["_assembleTo", "_compatibleBases", "_displayName", "_dissasembleTo", "_primary"];
if (_compatibleBases isEqualType "") then {_compatibleBases = [];};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? the base config entry is text when there is only one compatible base but this line makes it so there are none.

{
if (
// Has matching backpack
(backpack _x in _compatibleBases || {_backpack in ((configOf backpackContainer _x >> "assembleInfo" >> "base") call BIS_fnc_getCfgData)})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base config entry is not guaranteed to be an array.

_assembleInfo params ["_assembleTo", "_compatibleBases", "_displayName", "_dissasembleTo", "_primary"];
if (_compatibleBases isEqualType "") then {_compatibleBases = [];};

if (_primary == 1 && {_compatibleBases isEqualTo [] || {_compatibleBases isEqualTo "" || {_compatibleBases isEqualTo [""]}}}) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_compatibleBases cannot be a string at this point. Line 50 changes it to an array.

[QEGVAR(common,addObjects), [[_weapon]]] call CBA_fnc_serverEvent;

private _targetPos = _gunner getVariable [QGVAR(unpackStaticWeaponTargetPos), []];
if (!(_targetPos isEqualTo [])) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNotEqualTo.

// Has matching backpack
(backpack _x in _compatibleBases || {_backpack in ((configOf backpackContainer _x >> "assembleInfo" >> "base") call BIS_fnc_getCfgData)})
// Closer than current
&& {_assistant == objNull || {(_gunner distance _x) < (_gunner distance _assistant)}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNull.

@mharis001 mharis001 modified the milestones: 1.11.0, 1.12.0 Jun 14, 2021
@mharis001 mharis001 modified the milestones: 1.12.0, 1.13.0 Sep 3, 2021
@mharis001 mharis001 modified the milestones: 1.13.0, Backlog Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants