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

Dragging - Improve carrying by allowing carried object to be loaded into vehicle by key or mouse #9138

Merged
merged 4 commits into from
Jun 23, 2023

Conversation

ampersand38
Copy link
Contributor

@ampersand38 ampersand38 commented Jan 29, 2023

When merged this pull request will:

  • allowing carried object to be loaded into vehicle by key or mouse
  • carrying mouse hint updates to show possibility of loading
  • dragging behaviour is not modified due to need to to move backwards and thus not immediately looking toward target vehicle
  • https://youtu.be/hVRH48DeybQ

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

if (_target isKindOf "CAManBase") then {
private _vehicles = [cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat);
if ([cursorObject] isEqualTo _vehicles) then {
[ACE_player, _target, cursorObject] call EFUNC(medical_treatment,loadUnit);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to check isModLoaded for medical

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How's this? 438d06b

ampersand38 and others added 2 commits January 28, 2023 23:28
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
Comment on lines 34 to 51
// Update mouse hint
private _ctrlTextLMB = (uiNamespace getVariable [QEGVAR(interaction,mouseHint), displayNull]) displayCtrl 2420;
if (
!isNull cursorObject
&& {([ACE_player, cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith))}
&& {
if (_target isKindOf "CAManBase") then {
([] isNotEqualTo ([cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat)))
&& {([_target, cursorObject] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
} else {
[_target, cursorObject] call EFUNC(cargo,canLoadItemIn)
}
}
) then {
_ctrlTextLMB ctrlSetText localize ELSTRING(Cargo,loadObject);
} else {
_ctrlTextLMB ctrlSetText localize LSTRING(Drop);
};
Copy link
Member

Choose a reason for hiding this comment

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

Could maybe do what refuel does instead of directly manipulating the mouse hint UI.

private _hintLMB = "";
private _hintRMB = localize ELSTRING(dragging,Drop);
getCursorObjectParams params ["_cursorObject", "", "_distance"];
if (!isNull _cursorObject && {_distance < REFUEL_NOZZLE_ACTION_DISTANCE}) then {
if (
1 == getNumber (configOf _cursorObject >> QGVAR(canReceive))
&& {isNull (_cursorObject getVariable [QGVAR(nozzle), objNull])}
) then {
_hintLMB = localize LSTRING(Connect);
};
if ([_unit, _cursorObject] call FUNC(canReturnNozzle)) then {
_hintRMB = localize LSTRING(Return);
};
};
private _hint = [_hintLMB, _hintRMB];
if (_hint isNotEqualTo (_unit getVariable [QGVAR(hint), []])) then {
_unit setVariable [QGVAR(hint), _hint];
_hint call EFUNC(interaction,showMouseHint);
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's an elegant approach! I'll give it a shot.
I based what I did on

// Update mouse hint
private _ctrlTextLMB = (uiNamespace getVariable [QEGVAR(interaction,mouseHint), displayNull]) displayCtrl 2420;
if (_badPosition) then {
_ctrlTextLMB ctrlSetText localize LSTRING(BlockedAction);
} else {
if (isNull _attachVehicle) then {
_ctrlTextLMB ctrlSetText localize LSTRING(PlaceAction);
} else {
_ctrlTextLMB ctrlSetText localize LSTRING(AttachAction);
};
};

@ampersand38 ampersand38 requested a review from mharis001 March 27, 2023 14:25
@LinkIsGrim LinkIsGrim added this to the 3.16.0 milestone Jun 19, 2023
@jonpas jonpas added the kind/enhancement Release Notes: **IMPROVED:** label Jun 19, 2023
@LinkIsGrim LinkIsGrim merged commit e565491 into acemod:master Jun 23, 2023
@ampersand38 ampersand38 deleted the load-carried-object branch July 28, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants