-
Notifications
You must be signed in to change notification settings - Fork 739
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
UI - Fix selective UI in cargo #6585
Conversation
I don't like |
And I don't like |
show and hide |
[LSTRING(Disallowed), 2] call EFUNC(common,displayTextStructured); | ||
false | ||
}; | ||
|
||
_cachedElement params ["_idd", "_elements", "_location", "_conditions"]; | ||
|
||
// Exit if main vehicle type condition not fitting | ||
private _canUseWeapon = ACE_player call CBA_fnc_canUseWeapon; | ||
if ((_canUseWeapon && {_location == 2}) || {!_canUseWeapon && {_location == 1}}) exitWith {false}; | ||
private _cargoIndex = vehicle ACE_player getCargoIndex ACE_player; // nil if not in vehicle |
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.
Why check cargo specifically? Instead of just in vehicle check?
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.
because these controls (Soldier/Vehicle/Weapon Information, location = GROUND_ONLY
) should be set when on foot or in vehicle cargo including FFV. See also #3877
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.
Yeah but why cargo? Why exclude driver/gunner?
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.
@jonpas should know. I think because that info is shown while player is in cargo and isn't shown when in other seats.
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.
Why exactly does old way break with moveInCargo?
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.
Because ammocount
is disabled when player is on foot and not updated when he gets in cargo.
When moveInCargo
is used in init, player is never on foot at mission start and ammocount
is not disabled because CBA_fnc_canUseWeapon
returns false and location == GROUND_ONLY
for ammocount
.
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.
In fact I just added cargo seats to _canUseWeapon
condition (on foot and FFV was there) and I had to rename it because _canUseWeapon
name became wrong.
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 see, I will test this soon.
private _canUseWeapon = ACE_player call CBA_fnc_canUseWeapon; | ||
if ((_canUseWeapon && {_location == 2}) || {!_canUseWeapon && {_location == 1}}) exitWith {false}; | ||
private _cargoIndex = vehicle ACE_player getCargoIndex ACE_player; // nil if not in vehicle | ||
private _isOnFootOrInCargo = isNil "_cargoIndex" || {_cargoIndex > -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.
private _isOnFootOrInCargo = isNil "_cargoIndex" || {_cargoIndex > -1}; | |
private _isOnFootOrInCargo = isNil "_cargoIndex" || {_cargoIndex > -1} || {ACE_player call CBA_fnc_canUseWeapon}; |
Need this to handle non-cargo FFV turrets.
Example with merkel tank with commander gun,
inside it shows ammo (gunner ammo) fine
turn out and player's gun ammo shows, and exiting while in this state it will continue to show dismounted.
While turned out in turret::
ACE_player call CBA_fnc_canUseWeapon = false
vehicle ACE_player getCargoIndex ACE_player = -1
Could possibly also use isTurnedOut player
, but cba func isn't that expensive
@PabstMirror I added non-cargo FFV check with variable renaming. Also I'm not sure now if we should add more |
I guess ground and vehicle aren't perfect, but I think the intent is clear enough |
) exitWith { | ||
TRACE_3("skip location",_this,_canUseWeaponOrInCargo,_location); | ||
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.
I'd prefer this whole thing like this:
if ((_canUseWeaponOrInCargo && {_location == VEHICLE_ONLY}) ||
{!_canUseWeaponOrInCargo && {_location == GROUND_ONLY}}
) exitWith {
TRACE_3("skip location",_this,_canUseWeaponOrInCargo,_location);
false
};
Probably just because I am more used to it, either is mergable.
* UI - Fix selective UI in cargo * Add FFV not in cargo check
When merged this pull request will:
ace_ui_fnc_setAdvancedElement
:show
->fade
).Maybe now
VEHICLE_ONLY
andGROUND_ONLY
macros should be renamed e.g. toVEHICLE_NOT_CARGO
andGROUND_AND_CARGO
.