-
Notifications
You must be signed in to change notification settings - Fork 149
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
Changed/Updated isTurnedOut/isAttenuated function #1015
Conversation
…able; rename _out to _return; added gunnerAction check for rhs m2 humvee and vanilla B_LSV_01_armed_F; added window check for rhs vehicle cargo windows;
This function is legacy due to isTurnedOut command, no? |
No, this functions has better results. For example the gunner of the B_LSV_01_armed_F (https://community.bistudio.com/wikidata/images/b/b5/B_LSV_01_armed_F.jpg) is with isTurnedOut FALSE... also cargo of a open cargo truck. |
addons/common/fnc_isTurnedOut.sqf
Outdated
if (driver _vehicle == _unit) then { | ||
_return = (_vehicle animationPhase "hatchDriver") > 0; | ||
} else { | ||
private _assignedRole = assignedVehicleRole _unit; |
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.
This command reports nil
while remote controlling a unit. Try this function while remote controlling an AI with zeus, and it should fail.
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.
It reports []
... a params should fix that...
addons/common/fnc_isTurnedOut.sqf
Outdated
if ((count _attenuateCargo) > 0) then { | ||
private _index = (count _attenuateCargo)-1; // wait for command to get cargo index | ||
private _gunnerAction = getText (_turret >> "gunnerAction"); | ||
private _hatchAnimation = getText(_turret >> "animationSourceHatch"); |
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.
space
addons/common/fnc_isTurnedOut.sqf
Outdated
if (_index > -1) then { | ||
if (_index > (count _attenuateCargo) - 1) then { | ||
_index = (count _attenuateCargo) - 1; | ||
}; |
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.
_index = _index max (count _attenuateCargo - 1);
?
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.
Or the whole thing:
_return = _attenuateCargo param [_index, -1] == 0;
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.
that is old code untouched by me but will change
@commy2 because FFVs are ever outside is it possible to get the functions |
This will return true, even if not actually turned out in "open" vehicles? Like cabrio's and stuff? |
@dedmen yes... also gunners like the rhs humvee m2 gunner... also tfar can now handle open cargo seats with |
Top. One of the issues with intercom was detection of turned out units |
Nice. |
addons/common/fnc_isTurnedOut.sqf
Outdated
private _attenuateCargo = getArray (_cfg >> "soundAttenuationCargo"); | ||
if !(_attenuateCargo isEqualTo []) then { | ||
private _count = count _attenuateCargo; | ||
_return = 0 == _attenuateCargo select (if (_cargoIndex >= _count) then {_count - 1} else {_cargoIndex}); |
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.
This line... is art?
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.
Should i change it?
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've been looking at it for the last 6 minutes and I still have no idea what it does.
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.
#1015 (comment) the last part about soundAttenuationCargo
addons/common/fnc_isTurnedOut.sqf
Outdated
private _window = ['ani_window_1', 'ani_window_2', 'ani_window_4', 'ani_window_3'] select (_cargoIndex + 1); | ||
if ((_vehicle doorPhase _window) > 0) exitWith {_return = true}; | ||
|
||
if ([_unit] call ace_common_fnc_getTurretIndex in ([_vehicle] call ace_common_fnc_getTurretsFFV)) exitWith {_return = true}; |
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.
These are unavailable when ACE is not used. Bad idea.
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 wrote it as attention in the first message and as @ mention comment to you #1015 (comment)
Can i add them to cba... or is there an other alternative?
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.
Will thonk about to tomorrow morning.
I think i should make a own cba function or a function for tfar itself. |
Was isTurnedOut deprecated so far? I would vote for moving the ACE func into CBA. As it seems to be universally useful. |
@dedmen |
Edit: for me this behavior is good, should it be added for ffs? |
I understand this works for same cases as vanilla SQF command, but it does not work for Cargo and FFV seats, please correct me if I am wrong. Since goal of this PR includes:
it makes sense in my eyes that it is done properly, including Cargo and FFV seats. If it does not work for all cases, then neither mod will use those new functions. Additionally, gunner of the Chinook is indeed inside the vehicle, and even has a headset on as far as I know! He is not turned out. |
@jonpas sry but you dont unterstand this PR... look at function isAttenuated |
Is my understanding of the following correct?
I have worded it badly in my previous comment, but in case of Chinook gunner this would result in:
@TheMagnetar is that your understanding also? |
My understanding:
Im a little bit frustrated and done with this PR. |
FYI: I have corrected my above example, got confused and inverted a thing! |
|
@jonpas without the "headphones on" part. Door gunner on Chinook could return both really.. But should be false (can hear people from outside) Ref to @Magnetar
|
addons/common/fnc_isAttenuated.sqf
Outdated
private _attenuationType = getText (_config >> "attenuationEffectType"); | ||
if (_attenuationType in ["OpenCarAttenuation", "OpenHeliAttenuation"]) exitWith {false}; | ||
if (_attenuationType in ["OpenCarAttenuation", "OpenHeliAttenuation", "jsrs_OpenCar_Attenuation", "jsrs_SemiOpenCar_Attenuation"]) exitWith {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 we avoid mod specific "compatibilities" in CBA?
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.
If you check out those classes, you can see that they don't have anything to do with whether you should or shouldn't hear anyone outside the vehicle anyway.
Tbh, it seems to me like this is something the radio mods should worry about. There is no link from the base game to this. The ingame sounds clearly follow different rules that wouldn't work for the radio mods.
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.
@commy2 This line is THE key line of this function. Because of this value i get quads, boots, littlebirds and open jeeps as open vehicles. It is not important what these classes define in cfgSoundEffects... it is important that these classes give a hint that the vehicle is open to the outside. If i delete this check... the function is useless.
@TheMagnetar yes you are right, BUT then the function is broken if someone use the clientside mod JSRS... what should i do?
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.
Ideally have a "registerAttenuationClass" function which adds those to a global array. Similar to how "registerFeatureCamera" is but without code stuff.
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.
This line is THE key line of this function.
But it isn't. It is an arbitrary list that would have to be expanded every time someone makes a new class that would qualify in a random mod. I am not going to approve and merge references to i.e. JSRS in CBA.
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.
Ideally have a "registerAttenuationClass" function which adds those to a global array. Similar to how "registerFeatureCamera" is but without code stuff.
No, because vehicle attenuation as it appears in Arma is not linked to whether you should be able to hear someone outside the vehicle from inside or not.
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.
changed after review
@dedmen headphones, distance and other blocking things are so special edge cases that they should done by the mod that needs them in my opinion. |
My time with this PR is now over... i was so happy to make something for CBA but this is the end. Im done. Have fun commenting. |
Just integrated into TFAR. Works beautifully. both I tried replacing it by Replacing |
|
||
// outside of the vehicle or turned out | ||
if (isNull objectParent _unit) exitWith {false}; | ||
private _turnedOut = [_unit] call CBA_fnc_isTurnedOut; |
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.
Setting this variable is nonsense. If it's true then the script exits, makes no sense checking for !_turnedOut
in lines 80 or 100
}; | ||
|
||
// Specialcase | ||
if (_return && {_role isEqualTo "gunner"} && {!_turnedOut}) exitWith {true}; // return |
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.
This _return check makes no sense, you already forced _return to true in line 84
_return = if !(_animation isEqualTo "") then { | ||
(_vehicle animationSourcePhase _animation) > 0 | ||
} else { | ||
true // is everytime outside |
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.
But outside would mean not attenuated, which would mean this should return false? Or is the comment wrong?
I have a workaround for the "hardocded jsrs" issue. Can just read the attenuationEffectType's entries in config Yeah I ended up using that for TFAR. This fixes issues where isAttenuated would return true even though the AttenuationEffect's gain is 1, meaning not attenuated. |
I like your function way more than this PR, although it also should be called isAttenuated and not isTurnedOut. |
It's a copy of the PR, just turned around to return isNotAttenuated. |
Refering to this:
|
This is a PR for radio addons like acre and tfar that there isolation is not on outside gunners and the vanilla isTurnedOut command cant handle that.
You are free to use the function or parts of it in your mod, have fun with it!