-
Notifications
You must be signed in to change notification settings - Fork 52
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
base: master
Are you sure you want to change the base?
Conversation
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. |
@ampersand38 |
Ah! I'm just learning about editorconfig now. Will try again to get it to work. Thanks. |
Much appreciated for the review @CreepPork. I'll aim to adhere to the standards. |
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". |
fae0efc
to
4b9c790
Compare
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.
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.
I seem to have this working!
When I use |
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.
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. |
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.
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.
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.
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.
Pushing to 1.10 since I think there is some cleanup left to do as well as consider:
|
Co-authored-by: Ralfs Garkaklis <[email protected]>
6055271
to
2cfb05c
Compare
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
Co-authored-by: NeilZar <[email protected]>
Co-authored-by: Ralfs Garkaklis <[email protected]>
Co-authored-by: Ralfs Garkaklis <[email protected]>
Co-authored-by: Ralfs Garkaklis <[email protected]>
Co-authored-by: Ralfs Garkaklis <[email protected]>
Co-authored-by: Ralfs Garkaklis <[email protected]>
Co-authored-by: Ralfs Garkaklis <[email protected]>
Co-authored-by: Ralfs Garkaklis <[email protected]>
Co-authored-by: Ralfs Garkaklis <[email protected]>
private _group = group _assistant; | ||
_group setBehaviourStrong "CARELESS"; | ||
_group deleteGroupWhenEmpty true; | ||
_group enableAttack false; |
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.
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 { |
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.
isNotEqualTo
.
[_gunner, _assistant, _targetPos] call FUNC(unpackStaticWeaponPFH); | ||
}; | ||
|
||
if (!(_targetPos isEqualTo [])) then { |
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.
isNotEqualTo
.
[QGVAR(unpackStaticWeapon), _this, _gunner] call CBA_fnc_targetEvent; | ||
}; | ||
|
||
if (!(_targetPos isEqualTo [])) then { |
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.
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 = [];}; |
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.
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 = [];}; |
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.
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)}) |
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.
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 { |
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.
_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 { |
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.
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)}} |
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.
isNull
.
When merged this pull request will: