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

Cargo - Add ability to add custom name to cargo objects #8023

Merged
merged 20 commits into from
Oct 12, 2021

Conversation

JasperRab
Copy link
Contributor

@JasperRab JasperRab commented Nov 29, 2020

Ever had more than 5 of the same ammo boxes in a vehicle? And you need to find that one with your favorite banana?
Well with this you can change the name of the boxes that are loadable into the cargo system.

When merged this pull request will:

  • Add the ability to add a custom name to crates/boxes. Either via in-game action on the object it self, via 3den attributes or via a setVariable.

Pictures:
image
Cargo menu with custom names and default (some) names.

image
3den attribute where the custom name can be set by mission makers.

image
UI of the renaming interface.

Added the ability to edit cargo objects (crates/boxes only) names. Either via in-game action on the object it self or via 3den attributes.

Added a single function which spawns the UI to edit the name and also edits it. This is an scripted UI, it could be changed to a config version if wanted, but as I'm not good in UI coding I left it on this simple version mainly for testing.

Added 4 new stringtable entries, 2 for action and 2 for 3den attributes.
Forgot to add the UI to the stringtable.
@jonpas
Copy link
Member

jonpas commented Nov 29, 2020

I've added a single function which spawns the UI to edit the name and also edits it. This is an scripted UI, it could be changed to a config version if wanted, but as I'm not good in UI coding I left it on this simple version mainly for testing, and to test the idea.

Scripted UI is better, easier to work with.

These require extra translations.

Just leave them empty. Translators will translate (add their own languages) whenever they will.

However the game did not like it as it kept creating this from it:

QUOTE adds a double quote (") around text, anything inside a double quote is literal (macros will not get resolved. You can either use a single quote (') or another set of double quotes (eg. QQGVAR˙ does that). Depends what your GET_STRING` is.

@jonpas
Copy link
Member

jonpas commented Nov 29, 2020

I don't particularly like another interaction menu node just for that. Why not put it into the cargo menu itself? Load and then rename.

I would also keep the base object name and add custom part to the end.

@JasperRab
Copy link
Contributor Author

JasperRab commented Nov 29, 2020

Well the issue we have in our unit is that we use crates a lot for rearming, and loading the crates in to just rename them feels like extra work, and an hindrance. Also we use different boxes for different ammo type, currently I've created multiple empty boxes with different names. However this option would give mission makers/logistic workers the freedom to do stuff their own way, not being limited to the names.
However if others think it would better fit in the cargo menu I could have a look at it.

I could add the custom tag to the end of the normal name, however I initially didn't want to add too much text as it could be annoying.

@jonpas
Copy link
Member

jonpas commented Nov 29, 2020

and loading the crates in to just rename them feels like extra work

But it's only visible in the cargo menu anyways? I would understand if it would be displayed somewhere else.

As an alternative, Rename action could be a child of the Load action to decrease clutter.

@Drofseh
Copy link
Contributor

Drofseh commented Nov 29, 2020

I think a child action of Load would be good.

@JasperRab
Copy link
Contributor Author

JasperRab commented Nov 30, 2020

As an alternative, Rename action could be a child of the Load action to decrease clutter.

When adding it as a child action to Load it would mean that you can't edit the name when you can't load it (when far away from vehicle). As it won't be visible then. I'm not 100% happy about this compromise, I do agree less clutter is better but if it would mean the action won't be available all the time I'd leave it at the mainaction.

But it's only visible in the cargo menu anyways? I would understand if it would be displayed somewhere else.

True, but I prefer if it can be changed without needing to load an object, that way you can prepare a few crates for later.

@jonpas
Copy link
Member

jonpas commented Apr 20, 2021

2 things I want for this:

  • Keep the base object name and add custom part to the end.
  • Setting to hide the "Rename" interaction, so people can hide it if they don't want to use it.

Added new function "getNameItem" that will get the items name.
Put the custom name behind the original name between brackets "[...]".
Also removed an unused _itemClass from postInit.
@JasperRab
Copy link
Contributor Author

JasperRab commented Apr 24, 2021

I've changed it so that the custom part is behind the base name (see picture below).
Also I've added the setting to enable/disable the action (default is visible), this can be changed to hidden by default if wanted.

image

I also saw that there are some conflicting files, I tried to merge from the master to my branch but that hasn't resolved it.
How can I fix this?

Copy link
Member

@jonpas jonpas left a comment

Choose a reason for hiding this comment

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

Fixed merge conflicts for you, some more styling suggestions.

addons/cargo/CfgEden.hpp Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_getNameItem.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_getNameItem.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_getNameItem.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_getNameItem.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_renameObject.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_renameObject.sqf Outdated Show resolved Hide resolved
JasperRab and others added 2 commits April 24, 2021 15:07
Co-authored-by: jonpas <jonpas33@gmail.com>
Added my name
@JasperRab
Copy link
Contributor Author

JasperRab commented Apr 24, 2021

Just did a last test with your suggestions and the merge from master, all works as intended.
I've also added myself to the authors file.

@jonpas jonpas modified the milestones: 3.14.1, 3.14.0 Apr 24, 2021
@jonpas jonpas removed the status/WIP label Apr 24, 2021
Copy link
Member

@jonpas jonpas left a comment

Choose a reason for hiding this comment

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

Somebody else look at the UI stuff.

addons/cargo/initSettings.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_renameObject.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_renameObject.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_renameObject.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_renameObject.sqf Outdated Show resolved Hide resolved
addons/cargo/XEH_postInit.sqf Outdated Show resolved Hide resolved
addons/cargo/XEH_postInit.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_getNameItem.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_getNameItem.sqf Outdated Show resolved Hide resolved
addons/cargo/XEH_PREP.hpp Outdated Show resolved Hide resolved
@BrettMayson
Copy link
Member

Is the only holdout here the UI?

@JasperRab
Copy link
Contributor Author

Is the only holdout here the UI?

As far as I know I've applied all the requested changes, if anything else needs to be changed be free to tell me.

@jonpas
Copy link
Member

jonpas commented Jul 23, 2021

@mharis001 re-review please.

@jonpas jonpas requested a review from mharis001 July 23, 2021 13:39
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.

If you click the background in the GUI the edit box loses focus and cannot be clicked into. Only way to go back into the edit box is by using TAB. Also, if the edit box is not in focus, you can move the player around with WASD (use a dialog to fix).

addons/cargo/stringtable.xml Outdated Show resolved Hide resolved
addons/cargo/stringtable.xml Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_getNameItem.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_renameObject.sqf Outdated Show resolved Hide resolved
@JasperRab
Copy link
Contributor Author

I've moved the UI to a config file so it can be used with createDialog.
New UI looks like this:
image

To make the UI I've taken the cargo menu as template and rebuild it with the correct sizes from there.
I've also rewritten the renameObject function as the UI stuff wasn't needed anymore.

Fixed tabs to spaces.
@JasperRab
Copy link
Contributor Author

@mharis001 I've fixed/reworked the UI as stated in my last message, could you have another look at it?

@BrettMayson
Copy link
Member

@JasperRab Can you fix the conflict?

@JasperRab
Copy link
Contributor Author

@BrettMayson Done, wasn't aware about the conflict. so thanks for reminding.

addons/arsenal/ui/RscAttributes.hpp Outdated Show resolved Hide resolved
@jonpas jonpas requested a review from mharis001 October 12, 2021 20:54
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.

Dislike the use of ACE_gui_X GUI base classes over the base game's RscX. But, I guess that is an overall issue with the cargo component.

GUI works as expected now.

addons/cargo/functions/fnc_initObject.sqf Outdated Show resolved Hide resolved
addons/cargo/functions/fnc_renameObject.sqf Outdated Show resolved Hide resolved
@PabstMirror PabstMirror merged commit 257d953 into acemod:master Oct 12, 2021
@jonpas jonpas added kind/feature Release Notes: **ADDED:** and removed kind/added feature labels Oct 14, 2021
AndreasBrostrom pushed a commit to AndreasBrostrom/ACE3 that referenced this pull request Dec 3, 2021
* First Push

Added the ability to edit cargo objects (crates/boxes only) names. Either via in-game action on the object it self or via 3den attributes.

Added a single function which spawns the UI to edit the name and also edits it. This is an scripted UI, it could be changed to a config version if wanted, but as I'm not good in UI coding I left it on this simple version mainly for testing.

Added 4 new stringtable entries, 2 for action and 2 for 3den attributes.

* Add extra stringtable

Forgot to add the UI to the stringtable.

* Update fnc_renameObject.sqf

fixing tabs

* Show custom name only behind

Added new function "getNameItem" that will get the items name.
Put the custom name behind the original name between brackets "[...]".

* Added "Hide Rename Action" setting

Also removed an unused _itemClass from postInit.

* Apply suggestions from code review

Co-authored-by: jonpas <jonpas33@gmail.com>

* Update AUTHORS.txt

Added my name

* Applied the sugesstions.

* Fixed function crash

* Moved to dialog.

* Removed unused comment/code

* Update renameMenu.hpp

Fixed tabs to spaces.

* Update renameMenu.hpp

* move rename to common

* Update addons/arsenal/ui/RscAttributes.hpp

* style and use addActionToObject

Co-authored-by: jonpas <jonpas33@gmail.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Release Notes: **ADDED:** status/discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants